Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
105 changes: 46 additions & 59 deletions .github/workflows/sphinxbuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,55 +17,44 @@ concurrency:
jobs:
setup-latex-cache:
name: Cache LaTeX packages
runs-on: ubuntu-latest
# Force running on GitHub-hosted runners
runs-on: ubuntu-24.04

steps:
- name: Configure apt cache
run: |
mkdir -p ${{ runner.temp }}/.cache/archives
mkdir -p ${{ runner.temp }}/.cache/lists
echo 'Dir::Cache::archives "${{ runner.temp }}/.cache/archives";' | sudo tee /etc/apt/apt.conf.d/apt-cache-tmp

- name: Cache LaTeX apt packages
id: cache-latex-apt
- name: Check texlive-fonts-extra installed files cache
id: cache-fonts-extra
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
with:
path: |
${{ runner.temp }}/.cache/archives
${{ runner.temp }}/.cache/lists
key: latex-apt-${{ runner.os }}-${{ runner.arch }}-ubuntu-24.04-texlive-2023-v2
restore-keys: |
latex-apt-${{ runner.os }}-${{ runner.arch }}-ubuntu-24.04-
latex-apt-${{ runner.os }}-${{ runner.arch }}-
path: ~/.cache/texlive-fonts-extra
key: latex-fonts-extra-${{ runner.os }}-${{ runner.arch }}-ubuntu-24.04-texlive-2023-v1
lookup-only: true

- name: Download LaTeX packages (cache miss only)
if: steps.cache-latex-apt.outputs.cache-hit != 'true'
- name: Install texlive-fonts-extra and cache installed files (cache miss only)
if: steps.cache-fonts-extra.outputs.cache-hit != 'true'
run: |
for i in 1 2 3; do
sudo DEBIAN_FRONTEND=noninteractive apt-get update \
-o Dir::State::lists="${{ runner.temp }}/.cache/lists" \
-o Acquire::Retries=3 && break
echo "apt-get update failed (attempt $i), retrying in 15s..."
sleep 15
done
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
--download-only \
-o Dir::State::lists="${{ runner.temp }}/.cache/lists" \
python3-pil python3-pip texlive-fonts-recommended latexmk \
texlive-latex-extra texlive-latex-recommended texlive-xetex \
texlive-fonts-extra-links texlive-fonts-extra xindy tex-gyre
# Ensure downloaded packages are owned by the current user so they can be cached
sudo chown -R $(id -u):$(id -g) ${{ runner.temp }}/.cache/

- name: Save LaTeX apt cache (cache miss only)
if: steps.cache-latex-apt.outputs.cache-hit != 'true'
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends texlive-fonts-extra
mkdir -p ~/.cache/texlive-fonts-extra
while IFS= read -r f; do
[ -f "$f" ] || [ -L "$f" ] || continue
rel="${f#/}"
dir="$HOME/.cache/texlive-fonts-extra/$(dirname "$rel")"
mkdir -p "$dir"
sudo cp -P "$f" "$dir/"
done < <(dpkg -L texlive-fonts-extra)
sudo chown -R $(id -u):$(id -g) ~/.cache/texlive-fonts-extra

- name: Save texlive-fonts-extra installed files cache (cache miss only)
if: steps.cache-fonts-extra.outputs.cache-hit != 'true'
uses: actions/cache/save@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
with:
path: |
${{ runner.temp }}/.cache/archives
${{ runner.temp }}/.cache/lists
key: latex-apt-${{ runner.os }}-${{ runner.arch }}-ubuntu-24.04-texlive-2023-v2
path: ~/.cache/texlive-fonts-extra
key: latex-fonts-extra-${{ runner.os }}-${{ runner.arch }}-ubuntu-24.04-texlive-2023-v1

build:
name: Build ${{ matrix.manual.name }}
Expand Down Expand Up @@ -123,38 +112,36 @@ jobs:
- name: Install pip dependencies
run: pip install -r requirements.txt

- name: Configure apt cache
if: ${{ matrix.manual.build_pdf_path }}
run: |
mkdir -p ${{ runner.temp }}/.cache/archives
mkdir -p ${{ runner.temp }}/.cache/lists
echo 'Dir::Cache::archives "${{ runner.temp }}/.cache/archives";' | sudo tee /etc/apt/apt.conf.d/apt-cache-tmp

- name: Restore LaTeX apt cache
- name: Restore texlive-fonts-extra installed files
if: ${{ matrix.manual.build_pdf_path }}
uses: actions/cache/restore@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
with:
# Use relative path https://github.com/actions/cache/issues/1127
path: |
${{ runner.temp }}/.cache/archives
${{ runner.temp }}/.cache/lists
key: latex-apt-${{ runner.os }}-${{ runner.arch }}-ubuntu-24.04-texlive-2023-v2
restore-keys: |
latex-apt-${{ runner.os }}-${{ runner.arch }}-ubuntu-24.04-
latex-apt-${{ runner.os }}-${{ runner.arch }}-
path: ~/.cache/texlive-fonts-extra
key: latex-fonts-extra-${{ runner.os }}-${{ runner.arch }}-ubuntu-24.04-texlive-2023-v1

- name: Install LaTeX from cache
- name: Install texlive-fonts-extra from cache
if: ${{ matrix.manual.build_pdf_path }}
timeout-minutes: 5
run: |
debs=(${{ runner.temp }}/.cache/archives/*.deb)
if [ ! -e "${debs[0]}" ]; then
echo "No .deb files found in cache archives — cache may be empty or missing." >&2
exit 1
if [ -d ~/.cache/texlive-fonts-extra ]; then
sudo cp -r ~/.cache/texlive-fonts-extra/. /
else
echo "texlive-fonts-extra cache not found, installing from apt..." >&2
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends texlive-fonts-extra
fi
sudo dpkg -i --force-depends "${debs[@]}"
sudo DEBIAN_FRONTEND=noninteractive apt-get install -f -y --no-install-recommends \
-o Dir::State::lists="${{ runner.temp }}/.cache/lists"

- name: Install LaTeX packages
if: ${{ matrix.manual.build_pdf_path }}
run: |
for i in 1 2 3; do
sudo DEBIAN_FRONTEND=noninteractive apt-get update \
-o Acquire::Retries=3 && break
echo "apt-get update failed (attempt $i), retrying in 15s..."
sleep 15
done
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
texlive-fonts-recommended latexmk texlive-latex-extra \
texlive-latex-recommended texlive-xetex texlive-fonts-extra-links \
xindy tex-gyre

- name: Build html documentation
run: cd ${{ matrix.manual.directory }} && make ${{ matrix.manual.make_target }}
Expand Down