@@ -17,60 +17,48 @@ concurrency:
1717jobs :
1818 setup-latex-cache :
1919 name : Cache LaTeX packages
20- runs-on : ubuntu-latest
20+ # Force running on GitHub-hosted runners
21+ runs-on : ubuntu-24.04
2122
2223 steps :
23- - name : Configure apt cache
24- run : |
25- mkdir -p ${{ runner.temp }}/.cache/archives
26- mkdir -p ${{ runner.temp }}/.cache/lists
27- echo 'Dir::Cache::archives "${{ runner.temp }}/.cache/archives";' | sudo tee /etc/apt/apt.conf.d/apt-cache-tmp
28-
29- - name : Cache LaTeX apt packages
30- id : cache-latex-apt
24+ - name : Check texlive-fonts-extra installed files cache
25+ id : cache-fonts-extra
3126 uses : actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
3227 with :
33- path : |
34- ${{ runner.temp }}/.cache/archives
35- ${{ runner.temp }}/.cache/lists
36- key : latex-apt-${{ runner.os }}-${{ runner.arch }}-ubuntu-24.04-texlive-2023-v2
37- restore-keys : |
38- latex-apt-${{ runner.os }}-${{ runner.arch }}-ubuntu-24.04-
39- latex-apt-${{ runner.os }}-${{ runner.arch }}-
28+ path : ${{ github.workspace }}/.cache/texlive-fonts-extra
29+ key : latex-fonts-extra-${{ runner.os }}-${{ runner.arch }}-ubuntu-24.04-texlive-2023-v1
4030 lookup-only : true
4131
42- - name : Download LaTeX packages (cache miss only)
43- if : steps.cache-latex-apt .outputs.cache-hit != 'true'
32+ - name : Install texlive-fonts-extra and cache installed files (cache miss only)
33+ if : steps.cache-fonts-extra .outputs.cache-hit != 'true'
4434 run : |
4535 for i in 1 2 3; do
4636 sudo DEBIAN_FRONTEND=noninteractive apt-get update \
47- -o Dir::State::lists="${{ runner.temp }}/.cache/lists" \
4837 -o Acquire::Retries=3 && break
4938 echo "apt-get update failed (attempt $i), retrying in 15s..."
5039 sleep 15
5140 done
52- sudo DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
53- --download-only \
54- -o Dir::State::lists="${{ runner.temp }}/.cache/lists" \
55- python3-pil python3-pip texlive-fonts-recommended latexmk \
56- texlive-latex-extra texlive-latex-recommended texlive-xetex \
57- texlive-fonts-extra-links texlive-fonts-extra xindy tex-gyre
58- # Ensure downloaded packages are owned by the current user so they can be cached
59- sudo chown -R $(id -u):$(id -g) ${{ runner.temp }}/.cache/
60-
61- - name : Save LaTeX apt cache (cache miss only)
62- if : steps.cache-latex-apt.outputs.cache-hit != 'true'
41+ sudo DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends texlive-fonts-extra
42+ mkdir -p "$GITHUB_WORKSPACE/.cache/texlive-fonts-extra"
43+ while IFS= read -r f; do
44+ [ -f "$f" ] || [ -L "$f" ] || continue
45+ rel="${f#/}"
46+ dir="$GITHUB_WORKSPACE/.cache/texlive-fonts-extra/$(dirname "$rel")"
47+ mkdir -p "$dir"
48+ sudo cp -P "$f" "$dir/"
49+ done < <(dpkg -L texlive-fonts-extra)
50+ sudo chown -R $(id -u):$(id -g) "$GITHUB_WORKSPACE/.cache/texlive-fonts-extra"
51+
52+ - name : Save texlive-fonts-extra installed files cache (cache miss only)
53+ if : steps.cache-fonts-extra.outputs.cache-hit != 'true'
6354 uses : actions/cache/save@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
6455 with :
65- path : |
66- ${{ runner.temp }}/.cache/archives
67- ${{ runner.temp }}/.cache/lists
68- key : latex-apt-${{ runner.os }}-${{ runner.arch }}-ubuntu-24.04-texlive-2023-v2
56+ path : ${{ github.workspace }}/.cache/texlive-fonts-extra
57+ key : latex-fonts-extra-${{ runner.os }}-${{ runner.arch }}-ubuntu-24.04-texlive-2023-v1
6958
70- build :
71- name : Build ${{ matrix.manual.name }}
59+ build-html :
60+ name : Building ${{ matrix.manual.name }} HTML
7261 runs-on : ubuntu-latest
73- needs : setup-latex-cache
7462
7563 strategy :
7664 fail-fast : false
8068 directory : " user_manual"
8169 make_target : " html"
8270 build_path : " _build/html"
83- build_pdf_path : " _build/latex"
8471 publish : true
8572
8673 - name : " user_manual-en"
@@ -99,19 +86,51 @@ jobs:
9986 directory : " admin_manual"
10087 make_target : " html"
10188 build_path : " _build/html/com"
102- build_pdf_path : " _build/latex"
10389 publish : true
10490
10591 steps :
106- - name : Cache git metadata
107- uses : actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
92+ - name : Checkout repository
93+ uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
94+
95+ - uses : actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
96+ with :
97+ python-version : " 3.13"
98+ cache : " pip"
99+
100+ - name : Install pip dependencies
101+ run : pip install -r requirements.txt
102+
103+ - name : Build html documentation
104+ run : cd ${{ matrix.manual.directory }} && make ${{ matrix.manual.make_target }}
105+
106+ - name : Upload static documentation
107+ uses : actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
108+ if : ${{ matrix.manual.publish }}
108109 with :
109- path : .git
110- key : git-metadata-${{ github.sha }}
111- restore-keys : |
112- git-metadata-${{ github.sha }}
113- git-metadata
110+ name : ${{ matrix.manual.name }}
111+ path : ${{ matrix.manual.directory }}/${{ matrix.manual.build_path }}
112+
113+ # ============================================================================
114+ # BUILD PDF
115+ # ============================================================================
116+ build-pdf :
117+ name : Building ${{ matrix.manual.name }} PDF
118+ runs-on : [ubuntu-latest, self-hosted]
119+ needs : setup-latex-cache
120+
121+ strategy :
122+ fail-fast : false
123+ matrix :
124+ manual :
125+ - name : " user_manual"
126+ directory : " user_manual"
127+ build_pdf_path : " _build/latex"
128+
129+ - name : " admin_manual"
130+ directory : " admin_manual"
131+ build_pdf_path : " _build/latex"
114132
133+ steps :
115134 - name : Checkout repository
116135 uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
117136
@@ -123,44 +142,31 @@ jobs:
123142 - name : Install pip dependencies
124143 run : pip install -r requirements.txt
125144
126- - name : Configure apt cache
127- if : ${{ matrix.manual.build_pdf_path }}
128- run : |
129- mkdir -p ${{ runner.temp }}/.cache/archives
130- mkdir -p ${{ runner.temp }}/.cache/lists
131- echo 'Dir::Cache::archives "${{ runner.temp }}/.cache/archives";' | sudo tee /etc/apt/apt.conf.d/apt-cache-tmp
132-
133- - name : Restore LaTeX apt cache
134- if : ${{ matrix.manual.build_pdf_path }}
145+ - name : Restore texlive-fonts-extra installed files
135146 uses : actions/cache/restore@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
136147 with :
137- # Use relative path https://github.com/actions/cache/issues/1127
138- path : |
139- ${{ runner.temp }}/.cache/archives
140- ${{ runner.temp }}/.cache/lists
141- key : latex-apt-${{ runner.os }}-${{ runner.arch }}-ubuntu-24.04-texlive-2023-v2
142- restore-keys : |
143- latex-apt-${{ runner.os }}-${{ runner.arch }}-ubuntu-24.04-
144- latex-apt-${{ runner.os }}-${{ runner.arch }}-
145-
146- - name : Install LaTeX from cache
147- if : ${{ matrix.manual.build_pdf_path }}
148- timeout-minutes : 5
149- run : |
150- debs=(${{ runner.temp }}/.cache/archives/*.deb)
151- if [ ! -e "${debs[0]}" ]; then
152- echo "No .deb files found in cache archives — cache may be empty or missing." >&2
153- exit 1
154- fi
155- sudo dpkg -i --force-depends "${debs[@]}"
156- sudo DEBIAN_FRONTEND=noninteractive apt-get install -f -y --no-install-recommends \
157- -o Dir::State::lists="${{ runner.temp }}/.cache/lists"
148+ path : ${{ github.workspace }}/.cache/texlive-fonts-extra
149+ key : latex-fonts-extra-${{ runner.os }}-${{ runner.arch }}-ubuntu-24.04-texlive-2023-v1
150+ fail-on-cache-miss : true
158151
159- - name : Build html documentation
160- run : cd ${{ matrix.manual.directory }} && make ${{ matrix.manual.make_target }}
152+ - name : Install texlive-fonts-extra from cache
153+ run : sudo cp -r "$GITHUB_WORKSPACE/.cache/texlive-fonts-extra/." /
154+
155+ - name : Install LaTeX packages
156+ run : |
157+ for i in 1 2 3; do
158+ sudo DEBIAN_FRONTEND=noninteractive apt-get update \
159+ -o Acquire::Retries=3 && break
160+ echo "apt-get update failed (attempt $i), retrying in 15s..."
161+ sleep 15
162+ done
163+ sudo DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
164+ texlive-fonts-recommended latexmk texlive-latex-extra \
165+ texlive-latex-recommended texlive-xetex texlive-fonts-extra-links \
166+ xindy tex-gyre
167+ sudo mktexlsr
161168
162169 - name : Compute PDF release version
163- if : ${{ matrix.manual.build_pdf_path }}
164170 id : pdf_version
165171 run : |
166172 branch="${GITHUB_REF#refs/heads/}"
@@ -171,22 +177,19 @@ jobs:
171177 fi
172178
173179 - name : Build pdf documentation
174- if : ${{ matrix.manual.build_pdf_path }}
175180 env :
176181 DOCS_RELEASE : ${{ steps.pdf_version.outputs.release }}
177182 run : |
178183 set -e
179184 cd ${{ matrix.manual.directory }}
180185 make latexpdf
181186 ls -la ${{ matrix.manual.build_pdf_path }}
182- cp ${{ matrix.manual.build_pdf_path }}/*.pdf ${{ matrix.manual.build_path }}/
183187
184- - name : Upload static documentation
188+ - name : Upload PDF documentation
185189 uses : actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
186- if : ${{ matrix.manual.publish }}
187190 with :
188- name : ${{ matrix.manual.name }}
189- path : ${{ matrix.manual.directory }}/${{ matrix.manual.build_path }}
191+ name : ${{ matrix.manual.name }}-pdf
192+ path : ${{ matrix.manual.directory }}/${{ matrix.manual.build_pdf_path }}/*.pdf
190193
191194 # ============================================================================
192195 # STAGE AND VALIDATE
@@ -203,7 +206,7 @@ jobs:
203206 # ============================================================================
204207 stage-and-check :
205208 name : Stage and check documentation
206- needs : build
209+ needs : [ build-html, build-pdf]
207210 runs-on : ubuntu-latest
208211
209212 outputs :
@@ -223,15 +226,6 @@ jobs:
223226 additional_deployment : ${{ steps.branch.outputs.additional_deployment }}
224227
225228 steps :
226- - name : Cache git metadata
227- uses : actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
228- with :
229- path : .git
230- key : git-metadata-${{ github.sha }}
231- restore-keys : |
232- git-metadata-${{ github.sha }}
233- git-metadata
234-
235229 - name : Checkout repository
236230 uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
237231
@@ -249,22 +243,6 @@ jobs:
249243 # 2. Merge in the new artifacts (what we're about to deploy)
250244 # 3. Run link checks only on the NEW content, but with full context
251245 # ========================================================================
252- # ========================================================================
253- # FETCH GH-PAGES FOR LINK VALIDATION CONTEXT
254- # ========================================================================
255- # We need the existing gh-pages content (old versions) so that link
256- # validation can resolve cross-version references. We use git cache
257- # to make this fast.
258- # ========================================================================
259- - name : Cache git metadata for gh-pages
260- uses : actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
261- with :
262- path : .git
263- key : git-metadata-${{ github.sha }}
264- restore-keys : |
265- git-metadata-${{ github.sha }}
266- git-metadata
267-
268246 - name : Checkout gh-pages branch for validation context
269247 uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
270248 with :
@@ -402,15 +380,6 @@ jobs:
402380 pull-requests : write
403381
404382 steps :
405- - name : Cache git metadata
406- uses : actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
407- with :
408- path : .git
409- key : git-metadata-${{ github.sha }}
410- restore-keys : |
411- git-metadata-${{ github.sha }}
412- git-metadata
413-
414383 - name : Checkout gh-pages branch
415384 uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
416385 with :
@@ -526,7 +495,7 @@ jobs:
526495 GH_TOKEN : ${{ secrets.COMMAND_BOT_PAT }}
527496
528497 summary :
529- needs : [build, stage-and-check, deploy]
498+ needs : [build-html, build-pdf , stage-and-check, deploy]
530499 runs-on : ubuntu-latest-low
531500 if : always()
532501
@@ -540,10 +509,10 @@ jobs:
540509 run : |
541510 if ${{ github.event_name == 'pull_request' }}
542511 then
543- echo "This workflow ran for a pull request. We need build and stage-and-check to succeed, but deploy will be skipped"
544- if ${{ needs.build.result != 'success' || needs.stage-and-check.result != 'success' || needs.deploy.result != 'skipped' }}; then exit 1; fi
512+ echo "This workflow ran for a pull request. We need build-html and stage-and-check to succeed, but deploy will be skipped"
513+ if ${{ needs.build-html.result != 'success' || needs.build-pdf .result != 'success' || needs.stage-and-check.result != 'success' || needs.deploy.result != 'skipped' }}; then exit 1; fi
545514 else
546515 echo "This workflow ran for a push. We need all jobs to succeed, including deploy"
547- if ${{ needs.build.result != 'success' || needs.stage-and-check.result != 'success' || needs.deploy.result != 'success' }}; then exit 1; fi
516+ if ${{ needs.build-html.result != 'success' || needs.build-pdf .result != 'success' || needs.stage-and-check.result != 'success' || needs.deploy.result != 'success' }}; then exit 1; fi
548517 fi
549518
0 commit comments