|
11 | 11 | # publish Builds the source distribution and wheel, then uploads to PyPI |
12 | 12 | # using Trusted Publishing (OIDC — no API token required). |
13 | 13 | # |
| 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 | +# |
14 | 18 | # github-release |
15 | 19 | # Creates a GitHub Release for the tag with auto-generated release |
16 | 20 | # notes drawn from merged pull requests since the previous release. |
17 | 21 | # |
18 | | -# Job order: validate → publish → github-release |
| 22 | +# Job order: validate + docs → publish → github-release |
19 | 23 | # |
20 | 24 | # References |
21 | 25 | # ────────── |
@@ -76,15 +80,58 @@ jobs: |
76 | 80 | run: python scripts/benchmark_import.py --trials 10 --target-ms 1000 |
77 | 81 |
|
78 | 82 | # ─────────────────────────────────────────────────────────────────────────── |
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 |
80 | 127 | # Uses PyPA Trusted Publishing (OIDC) — no API token needed. |
81 | 128 | # Requires a Trusted Publisher entry configured on pypi.org for this |
82 | 129 | # repository / workflow file / environment. |
83 | 130 | # ─────────────────────────────────────────────────────────────────────────── |
84 | 131 | publish: |
85 | 132 | name: Build and publish to PyPI |
86 | 133 | runs-on: ubuntu-latest |
87 | | - needs: validate |
| 134 | + needs: [validate, docs] |
88 | 135 | permissions: |
89 | 136 | id-token: write # required for OIDC Trusted Publishing |
90 | 137 | environment: |
@@ -119,7 +166,7 @@ jobs: |
119 | 166 | # the id-token: write permission and the PyPI Trusted Publisher config. |
120 | 167 |
|
121 | 168 | # ─────────────────────────────────────────────────────────────────────────── |
122 | | - # 3. Create GitHub Release |
| 169 | + # 5. Create GitHub Release |
123 | 170 | # Runs only after a successful PyPI publish so the release notes are |
124 | 171 | # never created for a failed upload. |
125 | 172 | # ─────────────────────────────────────────────────────────────────────────── |
|
0 commit comments