|
| 1 | +name: docs |
| 2 | +on: |
| 3 | + pull_request: |
| 4 | + paths: |
| 5 | + - 'docs/**' |
| 6 | + - 'README.md' |
| 7 | + - 'setup.cfg' |
| 8 | + - '.readthedocs.yml' |
| 9 | + - '.github/workflows/docs.yml' |
| 10 | + workflow_dispatch: |
| 11 | + schedule: |
| 12 | + # Weekly linkcheck (Monday 06:00 UTC). External links rot on their |
| 13 | + # own schedule, not the PR schedule; checking them per-PR cost ~10 |
| 14 | + # minutes of runner time and its failures were masked by |
| 15 | + # continue-on-error anyway. |
| 16 | + - cron: '0 6 * * 1' |
| 17 | + |
| 18 | +jobs: |
| 19 | + # Job id/name kept distinct from the pytest workflow's `run` job: |
| 20 | + # duplicate check names across workflows get deduplicated in the PR |
| 21 | + # checks UI and can hide failures. |
| 22 | + docs-build: |
| 23 | + if: github.event_name != 'schedule' |
| 24 | + runs-on: ubuntu-latest |
| 25 | + # Normal runs take ~4 minutes (install ~1, HTML build ~3 with |
| 26 | + # parallel read), so 15 leaves headroom without letting a wedged |
| 27 | + # run camp on a runner. |
| 28 | + timeout-minutes: 15 |
| 29 | + steps: |
| 30 | + - uses: actions/checkout@v4 |
| 31 | + - name: Setup Python |
| 32 | + uses: actions/setup-python@v5 |
| 33 | + with: |
| 34 | + # Match the Read the Docs build (.readthedocs.yml). |
| 35 | + python-version: '3.12' |
| 36 | + - name: Install pandoc |
| 37 | + # nbsphinx needs the pandoc binary; the `pandoc` pip package in |
| 38 | + # the doc extra does not ship it. |
| 39 | + run: sudo apt-get update && sudo apt-get install -y pandoc |
| 40 | + - name: Install dependencies |
| 41 | + # Same extras as the Read the Docs pre_build step, so this job |
| 42 | + # and RTD cannot drift apart. |
| 43 | + run: | |
| 44 | + python -m pip install --upgrade pip |
| 45 | + pip install -e '.[doc,tests]' |
| 46 | + - name: Build HTML |
| 47 | + # No -W: the build carries a handful of pre-existing warnings in |
| 48 | + # notebooks and reference pages. Gate on errors only. |
| 49 | + # |
| 50 | + # -j auto: the read phase is dominated by plot-directive examples |
| 51 | + # in the reference docstrings (sample data load + numba compile |
| 52 | + # per page, 30-60s each); all extensions in conf.py declare |
| 53 | + # parallel_read_safe, so this fans them out across the runner's |
| 54 | + # cores. |
| 55 | + run: sphinx-build -b html -j auto docs/source docs/build/html |
| 56 | + |
| 57 | + # Linkcheck runs on the weekly schedule (or manual dispatch), not on |
| 58 | + # PRs: it took ~10 minutes per PR and never gated anything. Here it |
| 59 | + # is allowed to fail loudly so broken links actually surface. |
| 60 | + linkcheck: |
| 61 | + if: github.event_name != 'pull_request' |
| 62 | + runs-on: ubuntu-latest |
| 63 | + timeout-minutes: 30 |
| 64 | + steps: |
| 65 | + - uses: actions/checkout@v4 |
| 66 | + - name: Setup Python |
| 67 | + uses: actions/setup-python@v5 |
| 68 | + with: |
| 69 | + python-version: '3.12' |
| 70 | + - name: Install pandoc |
| 71 | + run: sudo apt-get update && sudo apt-get install -y pandoc |
| 72 | + - name: Install dependencies |
| 73 | + run: | |
| 74 | + python -m pip install --upgrade pip |
| 75 | + pip install -e '.[doc,tests]' |
| 76 | + - name: Link check |
| 77 | + run: sphinx-build -b linkcheck docs/source docs/build/linkcheck |
0 commit comments