Skip to content

Commit 18b227f

Browse files
Copilotskjnldsv
andauthored
Fix flaky LaTeX cache in sphinxbuild.yml: cache apt lists alongside debs, use dpkg for install
Agent-Logs-Url: https://github.com/nextcloud/documentation/sessions/872269b8-1ded-4db5-8d42-72115ccab6fa Co-authored-by: skjnldsv <14975046+skjnldsv@users.noreply.github.com>
1 parent 166c4e9 commit 18b227f

1 file changed

Lines changed: 17 additions & 11 deletions

File tree

.github/workflows/sphinxbuild.yml

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,16 @@ jobs:
2323
- name: Configure apt cache
2424
run: |
2525
mkdir -p ${{ runner.temp }}/.cache/archives
26+
mkdir -p ${{ runner.temp }}/.cache/lists
2627
echo 'Dir::Cache::archives "${{ runner.temp }}/.cache/archives";' | sudo tee /etc/apt/apt.conf.d/apt-cache-tmp
2728
2829
- name: Cache LaTeX apt packages
2930
id: cache-latex-apt
3031
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
3132
with:
32-
path: ${{ runner.temp }}/.cache/archives
33+
path: |
34+
${{ runner.temp }}/.cache/archives
35+
${{ runner.temp }}/.cache/lists
3336
key: latex-apt-${{ runner.os }}-${{ runner.arch }}-ubuntu-24.04-texlive-2023-v2
3437
restore-keys: |
3538
latex-apt-${{ runner.os }}-${{ runner.arch }}-ubuntu-24.04-
@@ -39,20 +42,23 @@ jobs:
3942
- name: Download LaTeX packages (cache miss only)
4043
if: steps.cache-latex-apt.outputs.cache-hit != 'true'
4144
run: |
42-
sudo DEBIAN_FRONTEND=noninteractive apt-get update
45+
sudo DEBIAN_FRONTEND=noninteractive apt-get update -o Dir::State::lists="${{ runner.temp }}/.cache/lists"
4346
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
4447
--download-only \
48+
-o Dir::State::lists="${{ runner.temp }}/.cache/lists" \
4549
python3-pil python3-pip texlive-fonts-recommended latexmk \
4650
texlive-latex-extra texlive-latex-recommended texlive-xetex \
4751
texlive-fonts-extra-links texlive-fonts-extra xindy tex-gyre
4852
# Ensure downloaded packages are owned by the current user so they can be cached
49-
sudo chown -R $(id -u):$(id -g) ${{ runner.temp }}/.cache/archives
53+
sudo chown -R $(id -u):$(id -g) ${{ runner.temp }}/.cache/
5054
5155
- name: Save LaTeX apt cache (cache miss only)
5256
if: steps.cache-latex-apt.outputs.cache-hit != 'true'
5357
uses: actions/cache/save@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
5458
with:
55-
path: ${{ runner.temp }}/.cache/archives
59+
path: |
60+
${{ runner.temp }}/.cache/archives
61+
${{ runner.temp }}/.cache/lists
5662
key: latex-apt-${{ runner.os }}-${{ runner.arch }}-ubuntu-24.04-texlive-2023-v2
5763

5864
build:
@@ -114,14 +120,17 @@ jobs:
114120
if: ${{ matrix.manual.build_pdf_path }}
115121
run: |
116122
mkdir -p ${{ runner.temp }}/.cache/archives
123+
mkdir -p ${{ runner.temp }}/.cache/lists
117124
echo 'Dir::Cache::archives "${{ runner.temp }}/.cache/archives";' | sudo tee /etc/apt/apt.conf.d/apt-cache-tmp
118125
119126
- name: Restore LaTeX apt cache
120127
if: ${{ matrix.manual.build_pdf_path }}
121128
uses: actions/cache/restore@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
122129
with:
123130
# Use relative path https://github.com/actions/cache/issues/1127
124-
path: ${{ runner.temp }}/.cache/archives
131+
path: |
132+
${{ runner.temp }}/.cache/archives
133+
${{ runner.temp }}/.cache/lists
125134
key: latex-apt-${{ runner.os }}-${{ runner.arch }}-ubuntu-24.04-texlive-2023-v2
126135
restore-keys: |
127136
latex-apt-${{ runner.os }}-${{ runner.arch }}-ubuntu-24.04-
@@ -131,12 +140,9 @@ jobs:
131140
if: ${{ matrix.manual.build_pdf_path }}
132141
timeout-minutes: 5
133142
run: |
134-
sudo DEBIAN_FRONTEND=noninteractive apt-get update
135-
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
136-
--no-download \
137-
python3-pil python3-pip texlive-fonts-recommended latexmk \
138-
texlive-latex-extra texlive-latex-recommended texlive-xetex \
139-
texlive-fonts-extra-links texlive-fonts-extra xindy tex-gyre
143+
sudo dpkg -i --force-depends ${{ runner.temp }}/.cache/archives/*.deb
144+
sudo DEBIAN_FRONTEND=noninteractive apt-get install -f -y --no-install-recommends \
145+
-o Dir::State::lists="${{ runner.temp }}/.cache/lists"
140146
141147
- name: Build html documentation
142148
run: cd ${{ matrix.manual.directory }} && make ${{ matrix.manual.make_target }}

0 commit comments

Comments
 (0)