Skip to content

Commit 2978ec5

Browse files
committed
fix(ci): latex caching improvements
Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
1 parent f873421 commit 2978ec5

1 file changed

Lines changed: 18 additions & 7 deletions

File tree

.github/workflows/sphinxbuild.yml

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,33 +66,44 @@ jobs:
6666
- name: Install pip dependencies
6767
run: pip install -r requirements.txt
6868

69-
- name: Configure apt cache to use /tmp for caching LaTeX packages
69+
- name: Configure apt cache
7070
if: ${{ matrix.manual.build_pdf_path }}
7171
run: |
7272
mkdir -p /tmp/apt/cache/archives
7373
echo 'Dir::Cache::archives "/tmp/apt/cache/archives";' | sudo tee /etc/apt/apt.conf.d/apt-cache-tmp
7474
7575
- name: Cache LaTeX apt packages
7676
if: ${{ matrix.manual.build_pdf_path }}
77+
id: cache-latex-apt
7778
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
7879
with:
7980
path: /tmp/apt/cache/archives
80-
key: latex-apt-${{ runner.os }}-${{ hashFiles('.github/workflows/sphinxbuild.yml') }}
81+
key: latex-apt-${{ runner.os }}-${{ runner.arch }}-ubuntu-24.04-texlive-2023
8182
restore-keys: |
82-
latex-apt-${{ runner.os }}-
83+
latex-apt-${{ runner.os }}-${{ runner.arch }}-ubuntu-24.04-
84+
latex-apt-${{ runner.os }}-${{ runner.arch }}-
8385
8486
- name: Install LaTeX dependencies
85-
if: ${{ matrix.manual.build_pdf_path }}
87+
if: ${{ matrix.manual.build_pdf_path && steps.cache-latex-apt.outputs.cache-hit != 'true' }}
8688
run: |
87-
# Install required packages for PDF generation via LaTeX
8889
sudo DEBIAN_FRONTEND=noninteractive apt-get update
8990
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
9091
python3-pil python3-pip texlive-fonts-recommended latexmk \
9192
texlive-latex-extra texlive-latex-recommended texlive-xetex \
9293
texlive-fonts-extra-links texlive-fonts-extra xindy
9394
94-
- name: Fix apt cache ownership for caching
95-
if: ${{ matrix.manual.build_pdf_path }}
95+
- name: Install LaTeX from cache
96+
if: ${{ matrix.manual.build_pdf_path && steps.cache-latex-apt.outputs.cache-hit == 'true' }}
97+
run: |
98+
sudo DEBIAN_FRONTEND=noninteractive apt-get update
99+
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
100+
--no-download \
101+
python3-pil python3-pip texlive-fonts-recommended latexmk \
102+
texlive-latex-extra texlive-latex-recommended texlive-xetex \
103+
texlive-fonts-extra-links texlive-fonts-extra xindy
104+
105+
- name: Fix apt cache ownership
106+
if: ${{ matrix.manual.build_pdf_path && steps.cache-latex-apt.outputs.cache-hit != 'true' }}
96107
run: sudo chown -R $(id -u):$(id -g) /tmp/apt/cache/archives
97108

98109
- name: Build html documentation

0 commit comments

Comments
 (0)