| 1 | name: CI |
| 2 | |
| 3 | on: |
| 4 | push: |
| 5 | pull_request: |
| 6 | |
| 7 | jobs: |
| 8 | |
| 9 | Quality: |
| 10 | runs-on: ubuntu-latest |
| 11 | steps: |
| 12 | - uses: actions/checkout@v4 |
| 13 | - uses: actions/setup-python@v5 |
| 14 | with: |
| 15 | python-version: '3.11' |
| 16 | - uses: pre-commit/[email protected] |
| 17 | |
| 18 | Tests: |
| 19 | runs-on: ${{ matrix.os }} |
| 20 | strategy: |
| 21 | fail-fast: false |
| 22 | matrix: |
| 23 | os: [ubuntu-latest, macos-latest, windows-latest] |
| 24 | python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14", "pypy-3.8", "pypy-3.9"] |
| 25 | env: |
| 26 | OS: ${{ matrix.os }} |
| 27 | PYTHON: ${{ matrix.python-version }} |
| 28 | |
| 29 | steps: |
| 30 | - uses: actions/checkout@v4 |
| 31 | - name: Set up Python |
| 32 | uses: actions/setup-python@v5 |
| 33 | with: |
| 34 | python-version: ${{ matrix.python-version }} |
| 35 | - name: Install test requirements |
| 36 | run: pip install -e .[dev] |
| 37 | - name: Run tests |
| 38 | run: pytest |
| 39 | - name: Upload coverage |
| 40 | uses: codecov/codecov-action@v4 |
| 41 | with: |
| 42 | env_vars: OS,PYTHON |
| 43 | token: ${{ secrets.CODECOV_TOKEN }} |
| 44 | |
| 45 | Release: |
| 46 | runs-on: ubuntu-latest |
| 47 | needs: [Quality, Tests] |
| 48 | if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') |
| 49 | steps: |
| 50 | - uses: actions/checkout@v4 |
| 51 | - name: Set up Python |
| 52 | uses: actions/setup-python@v5 |
| 53 | with: |
| 54 | python-version: 3.8 |
| 55 | - name: Build wheel and source distribution |
| 56 | run: | |
| 57 | pip install build |
| 58 | python -m build --sdist --wheel |
| 59 | - name: Publish source package on PyPI |
| 60 | uses: pypa/gh-action-pypi-publish@release/v1 |
| 61 | with: |
| 62 | user: __token__ |
| 63 | password: ${{ secrets.pypi_password }} |