Add build pipeline and uv run script (#20) #33
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: | |
| - '*' | |
| tags: | |
| - '*' | |
| pull_request: | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| jobs: | |
| test: | |
| name: Build the package & run pytest | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| lfs: true | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| with: | |
| enable-cache: true | |
| - name: Install the project | |
| run: uv sync --all-extras --dev | |
| - name: Run pytest | |
| shell: bash -l {0} | |
| run: uv run pytest | |
| pypi-publish: | |
| name: upload release to PyPI | |
| runs-on: ubuntu-latest | |
| needs: test | |
| if: startsWith(github.ref, 'refs/tags/') | |
| environment: pypi | |
| permissions: | |
| # IMPORTANT: this permission is mandatory for Trusted Publishing | |
| id-token: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| lfs: true | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| with: | |
| enable-cache: true | |
| - name: Build the project | |
| run: uv build | |
| - name: Publish package distributions to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 |