Skip to content

Commit 14d37fa

Browse files
fix: gate PyPI releases on Sphinx docs build (#6)
1 parent 39aad41 commit 14d37fa

File tree

2 files changed

+51
-51
lines changed

2 files changed

+51
-51
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,6 @@
1212
# spec-validation Validates all TOML journal specs and runs the import-time
1313
# benchmark to catch regressions before they reach `main`.
1414
#
15-
# docs Builds the Sphinx documentation with -W (warnings as
16-
# errors). The generated HTML is uploaded as an artifact
17-
# so reviewers can inspect rendered output without a local
18-
# build.
19-
#
2015
# Job dependencies
2116
# ────────────────
2217
# All jobs are independent and run in parallel. There is no `needs:` chain
@@ -122,45 +117,3 @@ jobs:
122117

123118
- name: Benchmark cold import time
124119
run: python scripts/benchmark_import.py --trials 10 --target-ms 1000
125-
126-
# ───────────────────────────────────────────────────────────────────────────
127-
# Docs build — Sphinx with warnings-as-errors
128-
# Catches broken autodoc references, bad cross-links, and rst/md syntax
129-
# errors before they reach `main`. Built HTML is uploaded as an artifact
130-
# so reviewers can inspect rendered output without a local build.
131-
# ───────────────────────────────────────────────────────────────────────────
132-
docs:
133-
name: Docs build
134-
runs-on: ubuntu-latest
135-
steps:
136-
- name: Checkout source
137-
uses: actions/checkout@v6
138-
139-
- name: Set up Python ${{ env.CANONICAL_PYTHON }}
140-
uses: actions/setup-python@v6
141-
with:
142-
python-version: ${{ env.CANONICAL_PYTHON }}
143-
cache: pip
144-
145-
- name: Install package with docs extras
146-
# .[docs] installs sphinx, furo, myst-parser, and the package itself
147-
# so autodoc can import every module it documents.
148-
run: pip install ".[docs]"
149-
150-
- name: Build documentation
151-
# -W turns every Sphinx warning into a build error.
152-
# -n (nitpick) flags references to undefined labels or missing members.
153-
# --keep-going reports all errors rather than stopping on the first.
154-
# READTHEDOCS enables the full intersphinx mapping (matplotlib, numpy,
155-
# seaborn) so CI catches broken cross-links before they reach RTD.
156-
env:
157-
READTHEDOCS: "true"
158-
run: sphinx-build -W -n --keep-going -b html docs docs/_build/html
159-
160-
- name: Upload HTML documentation
161-
if: success()
162-
uses: actions/upload-artifact@v7
163-
with:
164-
name: docs-html
165-
path: docs/_build/html/
166-
retention-days: 14

.github/workflows/release.yml

Lines changed: 51 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,15 @@
1111
# publish Builds the source distribution and wheel, then uploads to PyPI
1212
# using Trusted Publishing (OIDC — no API token required).
1313
#
14+
# docs Builds the Sphinx documentation with -W (warnings as errors) and
15+
# uploads the rendered HTML as a release artifact so each published
16+
# version has a corresponding browsable docs snapshot.
17+
#
1418
# github-release
1519
# Creates a GitHub Release for the tag with auto-generated release
1620
# notes drawn from merged pull requests since the previous release.
1721
#
18-
# Job order: validate → publish → github-release
22+
# Job order: validate + docs → publish → github-release
1923
#
2024
# References
2125
# ──────────
@@ -76,15 +80,58 @@ jobs:
7680
run: python scripts/benchmark_import.py --trials 10 --target-ms 1000
7781

7882
# ───────────────────────────────────────────────────────────────────────────
79-
# 2. Build and publish to PyPI
83+
# 2. Docs build — Sphinx with warnings-as-errors
84+
# Verifies the documentation builds cleanly against the release commit.
85+
# The rendered HTML is uploaded as a release artifact so each published
86+
# version has a corresponding browsable docs snapshot.
87+
# ───────────────────────────────────────────────────────────────────────────
88+
docs:
89+
name: Docs build
90+
runs-on: ubuntu-latest
91+
needs: validate
92+
steps:
93+
- name: Checkout source
94+
uses: actions/checkout@v6
95+
96+
- name: Set up Python ${{ env.PYTHON_VERSION }}
97+
uses: actions/setup-python@v6
98+
with:
99+
python-version: ${{ env.PYTHON_VERSION }}
100+
cache: pip
101+
102+
- name: Install package with docs extras
103+
# .[docs] installs sphinx, furo, myst-parser, and the package itself
104+
# so autodoc can import every module it documents.
105+
run: pip install ".[docs]"
106+
107+
- name: Build documentation
108+
# -W turns every Sphinx warning into a build error.
109+
# -n (nitpick) flags references to undefined labels or missing members.
110+
# --keep-going reports all errors rather than stopping on the first.
111+
# READTHEDOCS enables the full intersphinx mapping (matplotlib, numpy,
112+
# seaborn) so CI catches broken cross-links before they reach RTD.
113+
env:
114+
READTHEDOCS: "true"
115+
run: sphinx-build -W -n --keep-going -b html docs docs/_build/html
116+
117+
- name: Upload HTML documentation
118+
if: success()
119+
uses: actions/upload-artifact@v7
120+
with:
121+
name: docs-html
122+
path: docs/_build/html/
123+
retention-days: 90 # keep for the lifetime of the release cycle
124+
125+
# ───────────────────────────────────────────────────────────────────────────
126+
# 4. Build and publish to PyPI
80127
# Uses PyPA Trusted Publishing (OIDC) — no API token needed.
81128
# Requires a Trusted Publisher entry configured on pypi.org for this
82129
# repository / workflow file / environment.
83130
# ───────────────────────────────────────────────────────────────────────────
84131
publish:
85132
name: Build and publish to PyPI
86133
runs-on: ubuntu-latest
87-
needs: validate
134+
needs: [validate, docs]
88135
permissions:
89136
id-token: write # required for OIDC Trusted Publishing
90137
environment:
@@ -119,7 +166,7 @@ jobs:
119166
# the id-token: write permission and the PyPI Trusted Publisher config.
120167

121168
# ───────────────────────────────────────────────────────────────────────────
122-
# 3. Create GitHub Release
169+
# 5. Create GitHub Release
123170
# Runs only after a successful PyPI publish so the release notes are
124171
# never created for a failed upload.
125172
# ───────────────────────────────────────────────────────────────────────────

0 commit comments

Comments
 (0)