Skip to content

gh-136155: Docs: check for EPUB fatal errors in CI #134074

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

m-aciek
Copy link
Contributor

@m-aciek m-aciek commented May 15, 2025

Validate EPUB documentation for not having warnings with level FATAL when running EPUBCheck in the CI.

This should prevent issues similar to #136155 in the future.

The check will pass after rebase on #136187 merged to the main branch.

m-aciek referenced this pull request in python/python-docs-pl May 16, 2025
@m-aciek m-aciek changed the title Docs EPUB: check in CI Docs EPUB: check fatal errors in CI Jul 1, 2025
@m-aciek m-aciek changed the title Docs EPUB: check fatal errors in CI gh-136155: Docs: check for EPUB fatal errors in CI Jul 1, 2025
@m-aciek m-aciek marked this pull request as ready for review July 1, 2025 23:02
Copy link
Member

@hugovk hugovk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR!

@@ -512,6 +512,7 @@

epub_author = 'Python Documentation Authors'
epub_publisher = 'Python Software Foundation'
epub_exclude_files = ('index.xhtml', 'download.xhtml')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For reference:

A sequence of files that are generated/copied in the build directory but should not be included in the EPUB file.
https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-epub_exclude_files

from pathlib import Path


def main():
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def main():
def main() -> int:

Comment on lines +15 to +22
fatals = [warning for warning in warnings if warning[0] == "FATAL"]

if fatals:
print("\nError: must not contain fatal errors:\n")
for fatal in fatals:
print(" - ".join(fatal))

return len(fatals)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
fatals = [warning for warning in warnings if warning[0] == "FATAL"]
if fatals:
print("\nError: must not contain fatal errors:\n")
for fatal in fatals:
print(" - ".join(fatal))
return len(fatals)
fatal_warnings = [warning for warning in warnings if warning[0] == "FATAL"]
if fatal_warnings:
print("\nError: must not contain fatal errors:\n")
for warning in fatal_warnings:
print(" - ".join(warning))
return len(fatal_warnings)

Comment on lines +106 to +107
epubcheck:
name: 'EPUB check'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
epubcheck:
name: 'EPUB check'
check-epub:
name: 'Check EPUB'

Comment on lines +129 to +139
- name: 'Build and load EPUB checks to file'
continue-on-error: true
run: |
set -Eeuo pipefail
make -C Doc/ PYTHON=../python SPHINXOPTS="--quiet" epub
pip install epubcheck
epubcheck Doc/build/epub/Python.epub &> Doc/epubcheck.txt
- name: 'Check for FATAL errors in EPUB'
if: github.event_name == 'pull_request'
run: |
python Doc/tools/check-epub.py
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than this new job, shall we add these two steps to the end of the existing build-doc job?

That can help prevent quite a bit of duplicate setup config.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants