Skip to content

Commit 7c66eb2

Browse files
Run check-html-ids.py in CI
1 parent 149c465 commit 7c66eb2

File tree

3 files changed

+46
-1
lines changed

3 files changed

+46
-1
lines changed

.github/workflows/reusable-docs.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,47 @@ jobs:
7575
--fail-if-regression \
7676
--fail-if-improved \
7777
--fail-if-new-news-nit
78+
- name: 'Collect HTML IDs'
79+
run: python Doc/tools/check-html-ids.py collect Doc/build/html -o Doc/build/html-ids-head.json.gz
80+
- name: 'Upload HTML IDs'
81+
uses: actions/upload-artifact@v6
82+
with:
83+
name: html-ids-head
84+
path: Doc/build/html-ids-head.json.gz
85+
86+
check-html-ids:
87+
name: 'Check for removed HTML IDs'
88+
needs: build-doc
89+
runs-on: ubuntu-latest
90+
timeout-minutes: 30
91+
steps:
92+
- name: 'Check out base commit'
93+
uses: actions/checkout@v6
94+
with:
95+
persist-credentials: false
96+
ref: ${{ github.event.pull_request.base.sha || github.event.before }}
97+
- name: 'Set up Python'
98+
uses: actions/setup-python@v6
99+
with:
100+
python-version: '3'
101+
cache: 'pip'
102+
cache-dependency-path: 'Doc/requirements.txt'
103+
- name: 'Install build dependencies'
104+
run: make -C Doc/ venv
105+
- name: 'Build HTML documentation'
106+
run: make -C Doc/ SPHINXOPTS="--quiet" html
107+
- name: 'Collect HTML IDs'
108+
run: python Doc/tools/check-html-ids.py collect Doc/build/html -o /tmp/html-ids-base.json.gz
109+
- name: 'Download PR base HTML IDs'
110+
uses: actions/download-artifact@v6
111+
with:
112+
name: html-ids-head
113+
path: /tmp
114+
- name: 'Check for removed HTML IDs'
115+
run: >-
116+
python Doc/tools/check-html-ids.py check
117+
/tmp/html-ids-base.json.gz /tmp/html-ids-head.json.gz
118+
--exclude-file Doc/tools/removed-html-ids.txt
78119
79120
# Run "doctest" on HEAD as new syntax doesn't exist in the latest stable release
80121
doctest:

Doc/tools/check-html-ids.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
from compression import gzip
1+
try:
2+
from compression import gzip
3+
except ImportError:
4+
import gzip
25
import concurrent.futures
36
from pathlib import Path
47
import html.parser

Doc/tools/removed-html-ids.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# HTML IDs excluded from the Doc/tools/check-html-ids.py check

0 commit comments

Comments
 (0)