| 1 | name: CI |
| 2 | |
| 3 | on: |
| 4 | push: |
| 5 | branches: |
| 6 | - main |
| 7 | pull_request: |
| 8 | |
| 9 | concurrency: |
| 10 | group: ${{ github.head_ref || github.run_id }} |
| 11 | cancel-in-progress: true |
| 12 | |
| 13 | permissions: write-all |
| 14 | |
| 15 | jobs: |
| 16 | lint: |
| 17 | runs-on: ubuntu-latest |
| 18 | steps: |
| 19 | - uses: actions/checkout@v6 |
| 20 | - uses: actions/setup-python@v6 |
| 21 | with: |
| 22 | python-version: "3.14" |
| 23 | - uses: snok/[email protected] |
| 24 | - name: Install Dependencies |
| 25 | run: poetry install |
| 26 | shell: bash |
| 27 | - uses: pre-commit/[email protected] |
| 28 | |
| 29 | test: |
| 30 | strategy: |
| 31 | fail-fast: false |
| 32 | matrix: |
| 33 | python-version: |
| 34 | - "3.14" |
| 35 | os: |
| 36 | - ubuntu-latest |
| 37 | runs-on: ${{ matrix.os }} |
| 38 | steps: |
| 39 | - uses: actions/checkout@v6 |
| 40 | - name: Set up Python |
| 41 | uses: actions/setup-python@v6 |
| 42 | with: |
| 43 | python-version: ${{ matrix.python-version }} |
| 44 | - uses: snok/[email protected] |
| 45 | - name: Install Dependencies |
| 46 | run: poetry install |
| 47 | shell: bash |
| 48 | - name: Test with Pytest |
| 49 | run: poetry run pytest --cov-report=xml |
| 50 | shell: bash |
| 51 | - name: Upload coverage to Codecov |
| 52 | uses: codecov/codecov-action@v5 |
| 53 | with: |
| 54 | token: ${{ secrets.CODECOV_TOKEN }} |
| 55 | |
| 56 | release: |
| 57 | runs-on: ubuntu-latest |
| 58 | environment: release |
| 59 | needs: |
| 60 | - test |
| 61 | - lint |
| 62 | |
| 63 | steps: |
| 64 | - uses: actions/checkout@v6 |
| 65 | with: |
| 66 | fetch-depth: 0 |
| 67 | ref: ${{ github.head_ref || github.ref_name }} |
| 68 | |
| 69 | - name: Release |
| 70 | id: release |
| 71 | uses: python-semantic-release/[email protected] |
| 72 | if: github.ref_name == 'main' |
| 73 | with: |
| 74 | github_token: ${{ secrets.GITHUB_TOKEN }} |
| 75 | |
| 76 | - name: Publish to PyPI |
| 77 | uses: pypa/gh-action-pypi-publish@release/v1 |
| 78 | if: github.ref_name == 'main' && steps.release.outputs.released == 'true' |
| 79 | with: |
| 80 | password: ${{ secrets.PYPI_TOKEN }} |
| 81 | |
| 82 | - name: Test release |
| 83 | uses: python-semantic-release/[email protected] |
| 84 | if: github.ref_name != 'main' |
| 85 | with: |
| 86 | github_token: ${{ secrets.GITHUB_TOKEN }} |
| 87 | no_operation_mode: true |