Skip to content

Commit c84566b

Browse files
committed
build: use --check --diff in CI
1 parent f0e4c06 commit c84566b

File tree

2 files changed

+27
-5
lines changed

2 files changed

+27
-5
lines changed

.github/workflows/ci.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,19 @@ jobs:
3737

3838
- uses: astral-sh/ruff-action@84f83ecf9e1e15d26b7984c7ec9cf73d39ffc946 # v3.3.1
3939

40+
- name: "Set up Python"
41+
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
42+
with:
43+
python-version: "3.13"
44+
45+
- name: "Install dependencies"
46+
run: |
47+
python -m pip install -r requirements.pip
48+
49+
- name: "Check the docs are up-to-date"
50+
run: |
51+
make lintdoc
52+
4053
tests:
4154
name: "Python ${{ matrix.python }} on ${{ matrix.os }}"
4255
runs-on: "${{ matrix.os }}-${{ matrix.os-version || 'latest' }}"

Makefile

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,28 @@ test: ## Run the test suite.
2828

2929
# Docs
3030

31-
.PHONY: cogdoc dochtml
31+
.PHONY: cogdoc lintdoc dochtml
32+
33+
# Normally I'd put this in a comment in index.px, but the
34+
# quoting/escaping would be impossible.
35+
COGARGS = -cP --markers='{{{cog }}} {{{end}}}' docs/running.rst
3236

3337
cogdoc: ## Run cog to keep the docs correct.
34-
# Normally I'd put this in a comment in index.px, but the
35-
# quoting/escaping would be impossible.
36-
python -m cogapp -crP --markers='{{{cog }}} {{{end}}}' docs/running.rst
38+
python -m cogapp -r $(COGARGS)
39+
40+
lintdoc: ## Check that the docs are up-to-date.
41+
@python -m cogapp --check --diff $(COGARGS); \
42+
if [ $$? -ne 0 ]; then \
43+
echo 'Docs need to be updated: `make cogdoc`'; \
44+
exit 1; \
45+
fi
3746

3847
dochtml: ## Build local docs.
3948
$(MAKE) -C docs html
4049

4150
# Release
4251

43-
.PHONY: dist pypi testpypi check_release
52+
.PHONY: dist pypi testpypi check_release _check_manifest
4453

4554
dist: ## Build distribution artifacts.
4655
python -m build

0 commit comments

Comments
 (0)