Set up tooling pyproject #3
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: | |
| - '*' | |
| pull_request: | |
| jobs: | |
| checks: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version: [ "3.12", "3.13" ] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: pip | |
| - name: Install project (dev) | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install -e ".[dev]" | |
| - name: Pre-commit (all files) | |
| run: pre-commit run --all-files | |
| - name: Lint with Ruff (explicit) | |
| run: ruff check . | |
| - name: Black --check | |
| run: black --check . | |
| - name: Type-check with mypy | |
| run: mypy src tests | |
| - name: Run tests with coverage | |
| run: pytest --cov | |
| - name: Coverage XML (artifact) | |
| run: coverage xml -o coverage.xml | |
| - name: Upload coverage.xml | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage-${{ matrix.python-version }} | |
| path: coverage.xml | |
| build: | |
| runs-on: ubuntu-latest | |
| needs: checks | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| cache: pip | |
| - run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install build twine | |
| python -m build | |
| python -m twine check dist/* | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: dists | |
| path: dist/* |