Skip to content

Commit 3f21cb0

Browse files
committed
Aligned docs checks between GitHub Actions and local development.
1 parent ffa1dad commit 3f21cb0

2 files changed

Lines changed: 33 additions & 55 deletions

File tree

.github/workflows/docs.yml

Lines changed: 10 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ permissions:
2222
jobs:
2323
docs:
2424
runs-on: ubuntu-24.04
25-
name: spelling
25+
defaults:
26+
run:
27+
working-directory: docs
2628
timeout-minutes: 60
2729
steps:
2830
- name: Checkout
@@ -37,51 +39,10 @@ jobs:
3739
cache-dependency-path: 'docs/requirements.txt'
3840
- name: Install system spell checker
3941
run: sudo apt update && sudo apt install -y aspell aspell-en
40-
- run: python -m pip install -r docs/requirements.txt
41-
- name: Build docs
42-
run: |
43-
cd docs
44-
sphinx-build -b spelling -n -q -W -d _build/doctrees -D language=en_US -j auto . _build/spelling
45-
46-
blacken-docs:
47-
runs-on: ubuntu-latest
48-
name: blacken-docs
49-
timeout-minutes: 60
50-
steps:
51-
- name: Checkout
52-
uses: actions/checkout@v6
53-
with:
54-
persist-credentials: false
55-
- name: Set up Python
56-
uses: actions/setup-python@v6
57-
with:
58-
python-version: '3.14'
59-
- run: python -m pip install blacken-docs
60-
- name: Build docs
61-
run: |
62-
cd docs
63-
make black
64-
RESULT=`cat _build/black/output.txt`
65-
if [ "$RESULT" -gt 0 ]; then
66-
echo "💥 📢 Code blocks in documentation must be reformatted with blacken-docs 📢 💥"
67-
fi;
68-
exit $RESULT
69-
70-
lint-docs:
71-
runs-on: ubuntu-latest
72-
name: lint-docs
73-
timeout-minutes: 60
74-
steps:
75-
- name: Checkout
76-
uses: actions/checkout@v6
77-
with:
78-
persist-credentials: false
79-
- name: Set up Python
80-
uses: actions/setup-python@v6
81-
with:
82-
python-version: '3.14'
83-
- run: python -m pip install sphinx-lint
84-
- name: Build docs
85-
run: |
86-
cd docs
87-
make lint
42+
- run: python -m pip install -r requirements.txt
43+
- name: Lint
44+
run: make lint
45+
- name: Black
46+
run: make black
47+
- name: Spelling
48+
run: SPHINXOPTS="-q -W" make spelling

docs/Makefile

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -171,16 +171,33 @@ spelling:
171171

172172
black:
173173
@mkdir -p $(BUILDDIR)/black
174-
find . -name "*.txt" -not -path "./_build/*" -not -path "./_theme/*" \
174+
@find . -name "*.txt" -not -path "./_build/*" -not -path "./_theme/*" \
175175
| xargs blacken-docs --rst-literal-block; echo $$? > "$(BUILDDIR)/black/output.txt"
176-
@echo
177-
@echo "Code blocks reformatted"
176+
@RESULT=`cat $(BUILDDIR)/black/output.txt`; \
177+
if [ "$$RESULT" -gt 0 ]; then \
178+
echo "💥 📢 Code blocks in documentation must be reformatted with blacken-docs 📢 💥"; \
179+
exit $$RESULT; \
180+
else \
181+
echo "Code blocks in documentation are properly formatted ✅"; \
182+
fi
178183

179184
lint:
180185
$(PYTHON) lint.py
181186
@echo
182187
@echo "Documentation lint complete."
183188

184-
check: spelling black lint
185-
@echo
186-
@echo "Style and spelling checks completed."
189+
check:
190+
@echo "=== Spelling check ==="; \
191+
$(MAKE) --no-print-directory SPHINXOPTS="-q -W" spelling; SPELLING=$$?; \
192+
echo ""; \
193+
echo "=== Code formatting check ==="; \
194+
$(MAKE) --no-print-directory black; BLACK=$$?; \
195+
echo ""; \
196+
echo "=== Lint check ==="; \
197+
$(MAKE) --no-print-directory lint; LINT=$$?; \
198+
echo ""; \
199+
if [ $$SPELLING -ne 0 ] || [ $$BLACK -ne 0 ] || [ $$LINT -ne 0 ]; then \
200+
echo "Some checks failed."; \
201+
exit 1; \
202+
fi; \
203+
echo "All style and spelling checks passed."

0 commit comments

Comments
 (0)