Skip to content

Commit 7938cfd

Browse files
authored
Add a docs-build CI job (#3252)
* Add docs-build CI job for PRs touching docs (#3249) * Address review: cap docs job at 30 minutes (#3249) * Raise docs job timeout to 45 minutes; runs take ~26 (#3249) * Cut docs-build PR time: parallel sphinx read, linkcheck moved to weekly cron (#3249) The PR job spent ~10 of its 18 minutes on linkcheck, whose failures were masked by continue-on-error, and ~8 on a serial HTML build whose read phase is dominated by plot-directive examples (sample data load plus numba compile per reference page). - build with -j auto; every extension in conf.py declares parallel_read_safe - run linkcheck on a weekly cron and workflow_dispatch instead of on PRs, without continue-on-error so broken links surface - drop the job timeout from 45 to 15 minutes to match
1 parent 1765d96 commit 7938cfd

1 file changed

Lines changed: 77 additions & 0 deletions

File tree

.github/workflows/docs.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
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

Comments
 (0)