docs(deps[gp-sphinx]): Wire sphinx-autodoc-pytest-fixtures and dogfood --doctest-docutils-modules #1450
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 | |
| on: [push, pull_request] | |
| jobs: | |
| build: | |
| if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version: ['3.10', '3.11', '3.12', '3.13', '3.14'] | |
| docutils-version: ['0.20', '0.22.4'] | |
| pytest-version: ['8', '9'] | |
| exclude: | |
| # docutils 0.22 removed the bundled docutils.utils.roman. Sphinx 8.1 | |
| # imports it, so its latex builder fails to load. Sphinx 8.2 dropped | |
| # that import but requires Python 3.11, and 8.1 is the newest release | |
| # supporting 3.10, leaving no working pair on that interpreter. | |
| - python-version: '3.10' | |
| docutils-version: '0.22.4' | |
| # Overrides the repo's .python-version so every uv command in this job | |
| # uses the matrix interpreter. `uv python install` only downloads one; | |
| # without this the environment is built against .python-version instead. | |
| env: | |
| UV_PYTHON: ${{ matrix.python-version }} | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v9.0.0 | |
| with: | |
| enable-cache: true | |
| - name: Set up Python ${{ matrix.python-version }} | |
| run: uv python install ${{ matrix.python-version }} | |
| - name: Install dependencies | |
| run: uv sync --all-extras --dev | |
| # Every step below runs --no-sync. A plain `uv run` re-syncs the | |
| # environment to uv.lock first, which would undo these pins and run | |
| # every matrix leg against the locked versions. | |
| - name: Install matrix pytest and docutils | |
| run: >- | |
| uv pip install | |
| "pytest~=${{ matrix.pytest-version }}.0" | |
| "docutils==${{ matrix.docutils-version }}" | |
| - name: Print python, pytest and docutils versions | |
| run: | | |
| python -V | |
| uv run --no-sync python -V | |
| uv run --no-sync pytest --version | |
| uv run --no-sync python -c 'import docutils; print(docutils.__version__)' | |
| - name: Lint with ruff check | |
| run: uv run --no-sync ruff check . | |
| - name: Format with ruff format | |
| run: uv run --no-sync ruff format . --check | |
| - name: Lint with mypy | |
| run: uv run --no-sync mypy . | |
| - name: Test with pytest | |
| run: uv run --no-sync py.test --cov=./ --cov-report=xml | |
| - uses: codecov/codecov-action@v7 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| release: | |
| runs-on: ubuntu-latest | |
| needs: build | |
| if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') | |
| permissions: | |
| id-token: write | |
| attestations: write | |
| strategy: | |
| matrix: | |
| python-version: ['3.14'] | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v9.0.0 | |
| with: | |
| enable-cache: true | |
| - name: Set up Python ${{ matrix.python-version }} | |
| run: uv python install ${{ matrix.python-version }} | |
| - name: Install dependencies | |
| run: uv sync --all-extras --dev | |
| - name: Build package | |
| if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') | |
| run: uv build | |
| - name: Publish package | |
| if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| attestations: true | |
| skip-existing: true |