From 6510194f6764413e1a3b4ae069dcca3159041c59 Mon Sep 17 00:00:00 2001 From: Rafael Fontenelle Date: Sun, 14 Sep 2025 16:41:39 -0300 Subject: [PATCH 01/11] Enable PDF build --- .github/workflows/check.yml | 32 ++++++++++++++++++++++++++------ scripts/build.sh | 14 ++++++++++++-- 2 files changed, 38 insertions(+), 8 deletions(-) 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 From 9f4a2addce63a55d4edb20d2eee748b8148da9a0 Mon Sep 17 00:00:00 2001 From: Rafael Fontenelle Date: Sat, 4 Oct 2025 10:49:50 -0300 Subject: [PATCH 02/11] Adjust artifact filename --- .github/workflows/check.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index a8f920321..6505d8fca 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -108,7 +108,7 @@ jobs: if: always() && steps.build.outcome == 'failure' uses: actions/upload-artifact@v4 with: - name: ${{ inputs.version }}-build-logs + name: build-${{ inputs.version }}-${{ matrix.format }} path: logs/* # Build Python docs in PDF format and make available for download. From 5ee754b3a1be6272ec6e58f9594dfe20969586a9 Mon Sep 17 00:00:00 2001 From: Rafael Fontenelle Date: Sat, 4 Oct 2025 11:43:17 -0300 Subject: [PATCH 03/11] add texlive-langportuguese --- .github/workflows/check.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 6505d8fca..0ce374969 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -120,7 +120,7 @@ jobs: 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: sudo apt-get install -y latexmk texlive-xetex fonts-freefont-otf xindy texlive-langportuguese - run: make - uses: actions/upload-artifact@v4 with: From 283834e96d418b150bce6741b33e3ad3e19a4360 Mon Sep 17 00:00:00 2001 From: Rafael Fontenelle Date: Sat, 4 Oct 2025 11:56:32 -0300 Subject: [PATCH 04/11] Fix package name --- .github/workflows/check.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 0ce374969..480f9e70b 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -120,7 +120,7 @@ jobs: 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-langportuguese + - run: sudo apt-get install -y latexmk texlive-xetex fonts-freefont-otf xindy texlive-lang-portuguese - run: make - uses: actions/upload-artifact@v4 with: From 54ae7975479fc6614b83fa7efffd792dbde9907b Mon Sep 17 00:00:00 2001 From: Rafael Fontenelle Date: Sat, 4 Oct 2025 17:23:58 -0300 Subject: [PATCH 05/11] Rename jobs' display name --- .github/workflows/check.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 480f9e70b..312c757b9 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -45,7 +45,7 @@ jobs: # 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 @@ -113,6 +113,7 @@ jobs: # Build Python docs in PDF format and make available for download. output-pdf: + name: Build docs (pdf) runs-on: ubuntu-latest needs: [ 'build' ] steps: From 68b07f657eb9d838a986244737bae53d42152746 Mon Sep 17 00:00:00 2001 From: Rafael Fontenelle Date: Sat, 4 Oct 2025 17:51:03 -0300 Subject: [PATCH 06/11] adjust log name and remove format check --- scripts/build.sh | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/scripts/build.sh b/scripts/build.sh index e601382f5..1e01af409 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -1,18 +1,15 @@ #!/bin/sh # Build translated docs -# Expects input 'html' or 'latex', defaults to 'html'. +# Expects input like 'html' and 'latex', defaults to 'html'. # # SPDX-License-Identifier: CC0-1.0 set -xeu -format="$1" - -if [ -z "$format" ]; then +if [ -z "$1" ]; then format=html -elif [ ! "$format" = html ] && [ ! "$format" = latex ]; then - echo "Invalid format. Expected html or latex" - exit 1 +else + format="$1" fi # Fail earlier if required variables are not set @@ -24,7 +21,7 @@ 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" @@ -33,6 +30,6 @@ fi 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 From 257de7b0dfb4f0d3ba6715b7385e53af043bf133 Mon Sep 17 00:00:00 2001 From: Rafael Fontenelle Date: Sat, 4 Oct 2025 17:58:56 -0300 Subject: [PATCH 07/11] reorder upload-artifact and adjust log filename --- .github/workflows/check.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 312c757b9..fd2343b64 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -77,18 +77,11 @@ jobs: id: build run: ./scripts/build.sh ${{ matrix.format }} - - name: Upload artifact - docs - if: steps.build.outcome == 'success' - uses: actions/upload-artifact@v4.3.5 - with: - name: build-${{ inputs.version }}-${{ matrix.format }} - path: cpython/Doc/build/${{ matrix.format }} - - name: Prepare notification (only on error) 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 }} @@ -106,10 +99,17 @@ 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: build-${{ inputs.version }}-${{ matrix.format }} + name: logs-${{ inputs.version }}-${{ matrix.format }} path: logs/* + + - name: Upload artifact - docs + if: always() && steps.build.outcome == 'success' + uses: actions/upload-artifact@v4.3.5 + 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: From 43c3208ce64b9b336213309885959f1be7042dfd Mon Sep 17 00:00:00 2001 From: Rafael Fontenelle Date: Sat, 4 Oct 2025 19:36:49 -0300 Subject: [PATCH 08/11] Enable epub build --- .github/workflows/check.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index fd2343b64..31307c34d 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -50,7 +50,7 @@ jobs: strategy: fail-fast: false matrix: - format: [ html, latex ] + format: [ html, latex, epub ] steps: - uses: actions/checkout@v5 with: From 9121b40a93c7ef4b223d33c3e4da1e8b513a2680 Mon Sep 17 00:00:00 2001 From: Rafael Fontenelle Date: Sat, 4 Oct 2025 22:02:16 -0300 Subject: [PATCH 09/11] filter pdf files to upload artifact --- .github/workflows/check.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 31307c34d..e173b6f9f 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -126,7 +126,7 @@ jobs: - uses: actions/upload-artifact@v4 with: name: build-${{ inputs.version }}-pdf - path: . + path: ./*.pdf # Run sphinx-lint to find wrong reST syntax in PO files. Always store logs. # If issues are found, notify telegram and upload logs. From b473ea9ddd7b78351010a5a68afb0b85fcb043f5 Mon Sep 17 00:00:00 2001 From: Rafael Fontenelle Date: Mon, 6 Oct 2025 12:33:21 -0300 Subject: [PATCH 10/11] Rename artifact adding python-docs-pt-br --- .github/workflows/check.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index e173b6f9f..1aafa13b0 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -108,7 +108,7 @@ jobs: if: always() && steps.build.outcome == 'success' uses: actions/upload-artifact@v4.3.5 with: - name: build-${{ inputs.version }}-${{ matrix.format }} + name: python-docs-pt-br-${{ inputs.version }}-${{ matrix.format }} path: cpython/Doc/build/${{ matrix.format }} # Build Python docs in PDF format and make available for download. @@ -125,7 +125,7 @@ jobs: - run: make - uses: actions/upload-artifact@v4 with: - name: build-${{ inputs.version }}-pdf + name: python-docs-pt-br-${{ inputs.version }}-pdf path: ./*.pdf # Run sphinx-lint to find wrong reST syntax in PO files. Always store logs. From 391910519dafb8fb619695d88548de9e0cd4752e Mon Sep 17 00:00:00 2001 From: Rafael Fontenelle Date: Mon, 6 Oct 2025 12:46:57 -0300 Subject: [PATCH 11/11] Fix name of the artifact to download --- .github/workflows/check.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 1aafa13b0..12602d179 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -119,7 +119,7 @@ jobs: steps: - uses: actions/download-artifact@v5 with: - name: build-${{ inputs.version }}-latex + name: python-docs-pt-br-${{ 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