Fix CI: scope ruff check/format to src/ and tests/ only #20
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: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| # ----------------------------------------------------------------------- | |
| # Lint — always run | |
| # ----------------------------------------------------------------------- | |
| ruff: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: astral-sh/ruff-action@v3 | |
| with: | |
| args: "check src/ tests/" | |
| - uses: astral-sh/ruff-action@v3 | |
| with: | |
| args: "format --check --diff src/ tests/" | |
| codespell: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: codespell-project/actions-codespell@v2 | |
| # ----------------------------------------------------------------------- | |
| # Typecheck — always run | |
| # ----------------------------------------------------------------------- | |
| typecheck: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: astral-sh/setup-uv@v7 | |
| - run: uv run pyright src/ tests/typing/ | |
| typecheck-compat: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: astral-sh/setup-uv@v7 | |
| - run: uv run pytest tests/test_typecheck.py -v | |
| # ----------------------------------------------------------------------- | |
| # Test — always run (locked dev env) | |
| # ----------------------------------------------------------------------- | |
| test: | |
| needs: [ruff, codespell, typecheck] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: astral-sh/setup-uv@v7 | |
| - run: uv run tox run -e dev | |
| # ----------------------------------------------------------------------- | |
| # PR: fast compat matrix | |
| # ----------------------------------------------------------------------- | |
| compat-pr: | |
| if: github.event_name == 'pull_request' | |
| needs: [test] | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python: [py312, py314] | |
| beartype: [bt022] | |
| backend: [numpy24, jax09, torch210, optree019] | |
| exclude: | |
| - { python: py314, backend: torch210 } | |
| name: ${{ matrix.python }}-${{ matrix.beartype }}-${{ matrix.backend }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: astral-sh/setup-uv@v7 | |
| - run: uv run tox run -e "${{ matrix.python }}-${{ matrix.beartype }}-${{ matrix.backend }}" | |
| typecheck-pr: | |
| if: github.event_name == 'pull_request' | |
| needs: [test] | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - { env: py312-bt022-type-pyright1408 } | |
| - { env: py312-bt022-type-mypy119 } | |
| - { env: py312-bt022-type-ty } | |
| name: ${{ matrix.env }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: astral-sh/setup-uv@v7 | |
| - run: uv run tox run -e "${{ matrix.env }}" | |
| # ----------------------------------------------------------------------- | |
| # Push: medium compat matrix | |
| # ----------------------------------------------------------------------- | |
| compat-push: | |
| if: github.event_name == 'push' | |
| needs: [test] | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python: [py312, py313, py314] | |
| beartype: [bt022] | |
| backend: [numpy24, jax09, torch210, optree019] | |
| exclude: | |
| - { python: py314, backend: torch210 } | |
| name: ${{ matrix.python }}-${{ matrix.beartype }}-${{ matrix.backend }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: astral-sh/setup-uv@v7 | |
| - run: uv run tox run -e "${{ matrix.python }}-${{ matrix.beartype }}-${{ matrix.backend }}" | |
| typecheck-push: | |
| if: github.event_name == 'push' | |
| needs: [test] | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - { env: py312-bt022-type-pyright1392 } | |
| - { env: py312-bt022-type-pyright1400 } | |
| - { env: py312-bt022-type-pyright1408 } | |
| - { env: py312-bt022-type-mypy115 } | |
| - { env: py312-bt022-type-mypy117 } | |
| - { env: py312-bt022-type-mypy119 } | |
| - { env: py312-bt022-type-ty } | |
| name: ${{ matrix.env }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: astral-sh/setup-uv@v7 | |
| - run: uv run tox run -e "${{ matrix.env }}" |