diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 8f5a4d3ad..a8f920321 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -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 runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + format: [ html, latex ] steps: - uses: actions/checkout@v5 with: @@ -70,17 +75,17 @@ jobs: - name: Build docs id: build - run: ./scripts/build.sh + run: ./scripts/build.sh ${{ matrix.format }} - name: Upload artifact - docs if: steps.build.outcome == 'success' uses: actions/upload-artifact@v4.3.5 with: - name: docs - path: cpython/Doc/build/html + name: build-${{ inputs.version }}-${{ matrix.format }} + path: cpython/Doc/build/${{ 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 @@ -106,6 +111,21 @@ jobs: name: ${{ inputs.version }}-build-logs path: logs/* + # Build Python docs in PDF format and make available for download. + output-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 + - 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. diff --git a/scripts/build.sh b/scripts/build.sh index ee338368e..e601382f5 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -1,10 +1,20 @@ #!/bin/sh -# Build translated docs to pop up errors +# Build translated docs +# Expects input 'html' or 'latex', defaults to 'html'. # # SPDX-License-Identifier: CC0-1.0 set -xeu +format="$1" + +if [ -z "$format" ]; then + format=html +elif [ ! "$format" = html ] && [ ! "$format" = latex ]; then + echo "Invalid format. Expected html or latex" + exit 1 +fi + # Fail earlier if required variables are not set test -n ${PYDOC_LANGUAGE+x} @@ -20,7 +30,7 @@ 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