Skip to content

Commit 68de3b0

Browse files
prevent this workflow from running on branches besides main and dev
1 parent 5f2f289 commit 68de3b0

3 files changed

Lines changed: 73 additions & 11 deletions

File tree

.github/workflows/docs_pages.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
name: Docs2Pages
2-
on: [ push, pull_request, workflow_dispatch ]
2+
on:
3+
push:
4+
branches: [main]
5+
workflow_dispatch:
36

47
permissions: {}
58

.github/workflows/publish.yml

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
name: Publish (PyPI)
22

33
# Publishes any tag starting with 'v' (e.g. v1.0, v0.5.1a0) to PyPI via OIDC
4-
# trusted publishing. The publish job is gated on the full pytest matrix
5-
# passing on the tagged commit — we don't ship a release that fails CI.
4+
# trusted publishing. The publish job is gated on the full pytest matrix AND
5+
# the strict Sphinx build passing on the tagged commit — we don't ship a
6+
# release that fails CI or has broken docs.
67
on:
78
push:
89
tags:
@@ -42,8 +43,30 @@ jobs:
4243
run: |
4344
uv run --python ${{ matrix.python-version }} pytest -v -m "not network"
4445
46+
# Strict Sphinx build — same gate `tests.yaml` runs on every dev push.
47+
# A release deserves the same docstring/signature drift check.
48+
docs:
49+
runs-on: ubuntu-latest
50+
permissions:
51+
contents: read
52+
steps:
53+
- name: Checkout
54+
uses: actions/checkout@v5
55+
56+
- name: Install uv
57+
uses: astral-sh/setup-uv@v6
58+
59+
- name: Install Python 3.13
60+
run: uv python install 3.13
61+
62+
- name: Install dependencies
63+
run: uv sync --all-extras
64+
65+
- name: Build Sphinx + Furo site (strict)
66+
run: uv run sphinx-build -W --keep-going -b html docs/source docs/build/sphinx
67+
4568
publish:
46-
needs: tests
69+
needs: [tests, docs]
4770
runs-on: ubuntu-latest
4871
environment:
4972
name: publish

.github/workflows/tests.yaml

Lines changed: 43 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ on:
55
# before publishing — skip here to avoid running the suite twice.
66
tags-ignore:
77
- '**'
8+
# `docs/**` is intentionally NOT ignored: docs-only commits still need
9+
# to validate via the strict Sphinx build (the `docs` job below).
810
paths-ignore:
9-
- 'docs/**'
1011
- 'README.md'
1112
- 'CLAUDE.md'
1213
- '.github/workflows/docs_pages.yaml'
1314
pull_request:
1415
paths-ignore:
15-
- 'docs/**'
1616
- 'README.md'
1717
- 'CLAUDE.md'
1818
- '.github/workflows/docs_pages.yaml'
@@ -67,11 +67,47 @@ jobs:
6767
if-no-files-found: warn
6868
retention-days: 7
6969

70+
# Strict Sphinx build acts as a docstring/signature drift gate. Runs in
71+
# parallel with pytest; publish-test depends on both. Same `-W` flag the
72+
# Pages deploy uses (docs_pages.yaml), so any failure here would also
73+
# break the production deploy on main. The built site is uploaded as a
74+
# workflow artifact so dev-branch docs changes can be previewed without
75+
# deploying to GitHub Pages (which only happens from main).
76+
docs:
77+
runs-on: ubuntu-latest
78+
permissions:
79+
contents: read
80+
steps:
81+
- name: Checkout
82+
uses: actions/checkout@v5
83+
84+
- name: Install uv
85+
uses: astral-sh/setup-uv@v6
86+
87+
- name: Install Python 3.13
88+
run: uv python install 3.13
89+
90+
- name: Install dependencies
91+
run: uv sync --all-extras
92+
93+
- name: Build Sphinx + Furo site (strict)
94+
run: uv run sphinx-build -W --keep-going -b html docs/source docs/build/sphinx
95+
96+
- name: Upload built docs as artifact
97+
if: always()
98+
uses: actions/upload-artifact@v4
99+
with:
100+
name: docs-html
101+
path: docs/build/sphinx
102+
if-no-files-found: warn
103+
retention-days: 14
104+
70105
# Publish a `.devN` pre-release wheel to TestPyPI on every push to dev,
71-
# gated on the full pytest matrix passing. Lives in this workflow (rather
72-
# than a separate `workflow_run`-triggered file) so that the gate is a
73-
# plain `needs:` dependency — `workflow_run` only fires from workflows
74-
# that exist on the default branch, which is a maintenance footgun.
106+
# gated on BOTH the full pytest matrix and the strict docs build passing.
107+
# Lives in this workflow (rather than a separate `workflow_run`-triggered
108+
# file) so that the gate is a plain `needs:` dependency — `workflow_run`
109+
# only fires from workflows that exist on the default branch, which is a
110+
# maintenance footgun.
75111
#
76112
# One-time setup required at https://test.pypi.org/manage/account/publishing/
77113
# Owner: Botts-Innovative-Research
@@ -80,7 +116,7 @@ jobs:
80116
# Environment: publish-test
81117
# And in this repo's Settings -> Environments, create env `publish-test`.
82118
publish-test:
83-
needs: pytest
119+
needs: [pytest, docs]
84120
if: github.event_name == 'push' && github.ref == 'refs/heads/dev'
85121
runs-on: ubuntu-latest
86122
environment:

0 commit comments

Comments
 (0)