unit test suite and CI #1
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: Tests | |
| # Runs on every PR and on pushes to main. | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| workflow_dispatch: | |
| jobs: | |
| unit-tests: | |
| name: Unit tests (Python ${{ matrix.python-version }}) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false # run both Python versions even if one fails, so we see both | |
| matrix: | |
| # 3.11+ only: the package uses `match` and `int | float` unions (3.10+) | |
| # and requires-python is >=3.11. Older versions fail on import. | |
| python-version: ["3.11", "3.12"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: "pip" | |
| cache-dependency-path: package/pyproject.toml | |
| # The workflow lives at repo root, but the package is in ./package, | |
| # so every step below runs from there (matches local dev from package/). | |
| - name: Install package with test dependencies | |
| working-directory: ./package | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -e ".[test]" | |
| # --check / --check-only report only; they never edit. CI fails if code | |
| # was committed unformatted. Mirrors the local pre-commit checks. | |
| - name: Check formatting (Black) | |
| working-directory: ./package | |
| run: black --check tests/ | |
| - name: Check import order (isort) | |
| working-directory: ./package | |
| run: isort --check-only tests/ | |
| # -m "not integration": runs everything except tests marked @pytest.mark.integration. | |
| # (no integration tests yet) | |
| - name: Run unit tests | |
| working-directory: ./package | |
| run: pytest -v -m "not integration" |