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
32 changes: 26 additions & 6 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
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
format: [ html, latex ]
steps:
- uses: actions/checkout@v5
with:
Expand All @@ -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/[email protected]
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
Expand All @@ -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.
Expand Down
14 changes: 12 additions & 2 deletions scripts/build.sh
Original file line number Diff line number Diff line change
@@ -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}

Expand All @@ -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
Expand Down
Loading