Repository navigation
Merge pull request #14 from LouieSlocombe/modernise-tooling #46
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: [main] | |
| pull_request: | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: ${{ github.event_name == 'pull_request' }} | |
| permissions: {} | |
| env: | |
| FORCE_COLOR: "1" | |
| jobs: | |
| lint: | |
| name: Lint and type check | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Check out the repository | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| - name: Set up uv | |
| uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0 | |
| - name: Install the project | |
| run: uv sync --locked | |
| - name: Run the pre-commit hooks | |
| run: uv run --locked prek run --all-files --show-diff-on-failure | |
| - name: Type check | |
| run: uv run --locked mypy | |
| test: | |
| name: Test (${{ matrix.os }}, Python ${{ matrix.python-version }}, ${{ matrix.resolution }}) | |
| runs-on: ${{ matrix.os }} | |
| timeout-minutes: 15 | |
| permissions: | |
| contents: read | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| python-version: ["3.14", "3.15"] | |
| resolution: [locked] | |
| include: | |
| # The oldest dependency versions allowed by pyproject.toml. | |
| - os: ubuntu-latest | |
| python-version: "3.14" | |
| resolution: lowest-direct | |
| # The free-threaded (no-GIL) build. | |
| - os: ubuntu-latest | |
| python-version: "3.14t" | |
| resolution: locked | |
| steps: | |
| - name: Check out the repository | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| - name: Set up uv | |
| uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Test with the locked dependencies | |
| if: matrix.resolution == 'locked' | |
| run: uv run --locked --no-default-groups --group test pytest | |
| - name: Test with the oldest allowed dependencies | |
| if: matrix.resolution == 'lowest-direct' | |
| run: uv run --resolution lowest-direct --no-default-groups --group test pytest | |
| build: | |
| name: Build distributions | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Check out the repository | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| - name: Set up uv | |
| uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0 | |
| - name: Build the sdist and wheel | |
| run: uv build --no-sources | |
| - name: Smoke test the wheel | |
| run: uv run --isolated --no-project --with dist/*.whl template-python CI | |
| - name: Smoke test the sdist | |
| run: uv run --isolated --no-project --with dist/*.tar.gz python -m template_python CI | |
| all-green: | |
| name: All checks passed | |
| if: always() | |
| needs: [lint, test, build] | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| permissions: {} | |
| steps: | |
| - name: Fail if any required job did not succeed | |
| if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') | |
| run: exit 1 |