File tree Expand file tree Collapse file tree 4 files changed +60
-1
lines changed
Misc/NEWS.d/next/Documentation Expand file tree Collapse file tree 4 files changed +60
-1
lines changed Original file line number Diff line number Diff line change 66
66
run : |
67
67
set -Eeuo pipefail
68
68
# Build docs with the nit-picky option; write warnings to file
69
- make -C Doc/ PYTHON=../python SPHINXOPTS="--quiet --nitpicky --fail-on-warning -- warning-file sphinx-warnings.txt" html
69
+ make -C Doc/ PYTHON=../python SPHINXOPTS="--quiet --nitpicky --warning-file sphinx-warnings.txt" html
70
70
- name : ' Check warnings'
71
71
if : github.event_name == 'pull_request'
72
72
run : |
@@ -102,3 +102,30 @@ jobs:
102
102
# Use "xvfb-run" since some doctest tests open GUI windows
103
103
- name : ' Run documentation doctest'
104
104
run : xvfb-run make -C Doc/ PYTHON=../python SPHINXERRORHANDLING="--fail-on-warning" doctest
105
+
106
+ check-epub :
107
+ name : ' Check EPUB'
108
+ runs-on : ubuntu-latest
109
+ timeout-minutes : 30
110
+ steps :
111
+ - uses : actions/checkout@v4
112
+ with :
113
+ persist-credentials : false
114
+ - name : ' Set up Python'
115
+ uses : actions/setup-python@v5
116
+ with :
117
+ python-version : ' 3'
118
+ cache : ' pip'
119
+ cache-dependency-path : ' Doc/requirements.txt'
120
+ - name : ' Install build dependencies'
121
+ run : |
122
+ make -C Doc/ venv
123
+ python -m pip install epubcheck
124
+ - name : ' Build EPUB documentation'
125
+ run : make -C Doc/ PYTHON=../python epub
126
+ - name : ' Run epubcheck'
127
+ continue-on-error : true
128
+ run : epubcheck Doc/build/epub/Python.epub &> Doc/epubcheck.txt
129
+ - run : cat Doc/epubcheck.txt
130
+ - name : ' Check for fatal errors in EPUB'
131
+ run : python Doc/tools/check-epub.py
Original file line number Diff line number Diff line change 440
440
441
441
epub_author = 'Python Documentation Authors'
442
442
epub_publisher = 'Python Software Foundation'
443
+ epub_exclude_files = ('index.xhtml' , 'download.xhtml' )
443
444
444
445
# index pages are not valid xhtml
445
446
# https://github.com/sphinx-doc/sphinx/issues/12359
Original file line number Diff line number Diff line change
1
+ from pathlib import Path
2
+
3
+ CPYTHON_ROOT = Path (
4
+ __file__ , # cpython/Doc/tools/check-epub.py
5
+ '..' , # cpython/Doc/tools
6
+ '..' , # cpython/Doc
7
+ '..' , # cpython
8
+ ).resolve ()
9
+ EPUBCHECK_PATH = CPYTHON_ROOT / 'Doc' / 'epubcheck.txt'
10
+
11
+
12
+ def main () -> int :
13
+ lines = EPUBCHECK_PATH .read_text (encoding = 'utf-8' ).splitlines ()
14
+ fatal_errors = [line for line in lines if line .startswith ('FATAL' )]
15
+
16
+ if fatal_errors :
17
+ err_count = len (fatal_errors )
18
+ s = 's' * (err_count != 1 )
19
+ print ()
20
+ print (f'Error: epubcheck reported { err_count } fatal error{ s } :' )
21
+ print ()
22
+ print ('\n ' .join (fatal_errors ))
23
+ return 1
24
+
25
+ print ('Success: no fatal errors found.' )
26
+ return 0
27
+
28
+
29
+ if __name__ == '__main__' :
30
+ raise SystemExit (main ())
Original file line number Diff line number Diff line change
1
+ We are now checking for fatal errors in EPUB builds in CI.
You can’t perform that action at this time.
0 commit comments