Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 36 additions & 15 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,16 @@ env:

jobs:

# Build documentation handling warnings as errors.
# If success, upload built docs. If failure, notify telegram and upload logs.
# Build documentation handling warnings as errors in both HTML and PDF.
# If success, upload built docs as artifact.
# If failure in HTML, notify telegram and upload logs.
build:
name: Build translated docs
name: Build docs
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
format: [ html, latex ]
steps:
- uses: actions/checkout@v5
with:
Expand All @@ -70,20 +75,13 @@ jobs:

- name: Build docs
id: build
run: ./scripts/build.sh

- name: Upload artifact - docs
if: steps.build.outcome == 'success'
uses: actions/[email protected]
with:
name: docs
path: cpython/Doc/build/html
run: ./scripts/build.sh ${{ matrix.format }}

- name: Prepare notification (only on error)
if: always() && steps.build.outcome == 'failure'
if: always() && steps.build.outcome == 'failure' && matrix.format == 'html'
id: prepare
run: |
scripts/prepmsg.sh logs/sphinxwarnings.txt logs/notify.txt
scripts/prepmsg.sh logs/sphinxwarnings-${format}.txt logs/notify.txt
cat logs/notify.txt
env:
GITHUB_JOB: ${{ github.job }}
Expand All @@ -101,11 +99,34 @@ jobs:

- name: Upload artifact - log files
if: always() && steps.build.outcome == 'failure'
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v4.3.5
with:
name: ${{ inputs.version }}-build-logs
name: logs-${{ inputs.version }}-${{ matrix.format }}
path: logs/*

- name: Upload artifact - docs
if: always() && steps.build.outcome == 'success'
uses: actions/[email protected]
with:
name: build-${{ inputs.version }}-${{ matrix.format }}
path: cpython/Doc/build/${{ matrix.format }}

# Build Python docs in PDF format and make available for download.
output-pdf:
name: Build docs (pdf)
runs-on: ubuntu-latest
needs: [ 'build' ]
steps:
- uses: actions/download-artifact@v5
with:
name: build-${{ inputs.version }}-latex
- run: sudo apt-get update
- run: sudo apt-get install -y latexmk texlive-xetex fonts-freefont-otf xindy texlive-lang-portuguese
- run: make
- uses: actions/upload-artifact@v4
with:
name: build-${{ inputs.version }}-pdf
path: .

# Run sphinx-lint to find wrong reST syntax in PO files. Always store logs.
# If issues are found, notify telegram and upload logs.
Expand Down
17 changes: 12 additions & 5 deletions scripts/build.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
#!/bin/sh
# Build translated docs to pop up errors
# Build translated docs
# Expects input like 'html' and 'latex', defaults to 'html'.
#
# SPDX-License-Identifier: CC0-1.0

set -xeu

if [ -z "$1" ]; then
format=html
else
format="$1"
fi

# Fail earlier if required variables are not set
test -n ${PYDOC_LANGUAGE+x}

Expand All @@ -14,15 +21,15 @@ mkdir -p logs
# If version is 3.12 or older, set gettext_compact.
# This confval is not needed since 3.12.
# In 3.13, its presence messes 3.13's syntax checking (?)
opts="-D language=${PYDOC_LANGUAGE} --keep-going -w ../../logs/sphinxwarnings.txt"
opts="-D language=${PYDOC_LANGUAGE} --keep-going -w ../../logs/sphinxwarnings-${format}.txt"
minor_version=$(git -C cpython/Doc branch --show-current | sed 's|^3\.||')
if [ $minor_version -lt 12 ]; then
opts="$opts -D gettext_compact=False"
fi

make -C cpython/Doc html SPHINXOPTS="${opts}"
make -C cpython/Doc "${format}" SPHINXOPTS="${opts}"

# Remove empty file
if [ ! -s logs/sphinxwarnings.txt ]; then
rm logs/sphinxwarnings.txt
if [ ! -s "logs/sphinxwarnings-${format}.txt" ]; then
rm "logs/sphinxwarnings-${format}.txt"
fi