Skip to content

Commit 6510194

Browse files
committed
Enable PDF build
1 parent 2572853 commit 6510194

File tree

2 files changed

+38
-8
lines changed

2 files changed

+38
-8
lines changed

.github/workflows/check.yml

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,16 @@ env:
4141

4242
jobs:
4343

44-
# Build documentation handling warnings as errors.
45-
# If success, upload built docs. If failure, notify telegram and upload logs.
44+
# Build documentation handling warnings as errors in both HTML and PDF.
45+
# If success, upload built docs as artifact.
46+
# If failure in HTML, notify telegram and upload logs.
4647
build:
4748
name: Build translated docs
4849
runs-on: ubuntu-latest
50+
strategy:
51+
fail-fast: false
52+
matrix:
53+
format: [ html, latex ]
4954
steps:
5055
- uses: actions/checkout@v5
5156
with:
@@ -70,17 +75,17 @@ jobs:
7075

7176
- name: Build docs
7277
id: build
73-
run: ./scripts/build.sh
78+
run: ./scripts/build.sh ${{ matrix.format }}
7479

7580
- name: Upload artifact - docs
7681
if: steps.build.outcome == 'success'
7782
uses: actions/[email protected]
7883
with:
79-
name: docs
80-
path: cpython/Doc/build/html
84+
name: build-${{ inputs.version }}-${{ matrix.format }}
85+
path: cpython/Doc/build/${{ matrix.format }}
8186

8287
- name: Prepare notification (only on error)
83-
if: always() && steps.build.outcome == 'failure'
88+
if: always() && steps.build.outcome == 'failure' && matrix.format == 'html'
8489
id: prepare
8590
run: |
8691
scripts/prepmsg.sh logs/sphinxwarnings.txt logs/notify.txt
@@ -106,6 +111,21 @@ jobs:
106111
name: ${{ inputs.version }}-build-logs
107112
path: logs/*
108113

114+
# Build Python docs in PDF format and make available for download.
115+
output-pdf:
116+
runs-on: ubuntu-latest
117+
needs: [ 'build' ]
118+
steps:
119+
- uses: actions/download-artifact@v5
120+
with:
121+
name: build-${{ inputs.version }}-latex
122+
- run: sudo apt-get update
123+
- run: sudo apt-get install -y latexmk texlive-xetex fonts-freefont-otf xindy
124+
- run: make
125+
- uses: actions/upload-artifact@v4
126+
with:
127+
name: build-${{ inputs.version }}-pdf
128+
path: .
109129

110130
# Run sphinx-lint to find wrong reST syntax in PO files. Always store logs.
111131
# If issues are found, notify telegram and upload logs.

scripts/build.sh

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,20 @@
11
#!/bin/sh
2-
# Build translated docs to pop up errors
2+
# Build translated docs
3+
# Expects input 'html' or 'latex', defaults to 'html'.
34
#
45
# SPDX-License-Identifier: CC0-1.0
56

67
set -xeu
78

9+
format="$1"
10+
11+
if [ -z "$format" ]; then
12+
format=html
13+
elif [ ! "$format" = html ] && [ ! "$format" = latex ]; then
14+
echo "Invalid format. Expected html or latex"
15+
exit 1
16+
fi
17+
818
# Fail earlier if required variables are not set
919
test -n ${PYDOC_LANGUAGE+x}
1020

@@ -20,7 +30,7 @@ if [ $minor_version -lt 12 ]; then
2030
opts="$opts -D gettext_compact=False"
2131
fi
2232

23-
make -C cpython/Doc html SPHINXOPTS="${opts}"
33+
make -C cpython/Doc "${format}" SPHINXOPTS="${opts}"
2434

2535
# Remove empty file
2636
if [ ! -s logs/sphinxwarnings.txt ]; then

0 commit comments

Comments
 (0)