Skip to content

Commit 2aabec2

Browse files
authored
Merge pull request #14398 from nextcloud/copilot/fix-latex-cache-flakiness
2 parents b02bcda + 9331aed commit 2aabec2

1 file changed

Lines changed: 22 additions & 11 deletions

File tree

.github/workflows/sphinxbuild.yml

Lines changed: 22 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,14 @@ 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+
debs=(${{ runner.temp }}/.cache/archives/*.deb)
144+
if [ ! -e "${debs[0]}" ]; then
145+
echo "No .deb files found in cache archives — cache may be empty or missing." >&2
146+
exit 1
147+
fi
148+
sudo dpkg -i --force-depends "${debs[@]}"
149+
sudo DEBIAN_FRONTEND=noninteractive apt-get install -f -y --no-install-recommends \
150+
-o Dir::State::lists="${{ runner.temp }}/.cache/lists"
140151
141152
- name: Build html documentation
142153
run: cd ${{ matrix.manual.directory }} && make ${{ matrix.manual.make_target }}

0 commit comments

Comments
 (0)