Cache the TeX Live apt install: a slow Ubuntu mirror stalls PDF builds for hours

Chiusa
#224 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@mmcky ci sta già lavorando.

Dal 7/11/2026.

  • #284 di @mmcky — aperta

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
48/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
github-actions, shell, ubuntu
Ambito
ci-cd, devops

Direzione di ricerca

Start by reading the setup-environment action and its install-latex path, then inspect the repository’s action definitions for how a standalone setup-latex action could be shared. The issue proposes caching .deb archives with actions/cache, but leaves cache-hit installation and skipping apt-get update to be tested. Done means a reusable cached install path serves inline steps and setup-environment, with a bounded timeout and retries on cache misses.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

enhancement infrastructure

Every lecture build that makes the PDF downloads TeX Live from the Ubuntu archive on every run. For lecture-python-advanced.myst that is 138 packages and 1013 MB. It usually takes a minute or two, but it depends entirely on the speed of the mirror the runner is given, and when that mirror is slow, the build stalls for hours without failing.

What happened

On 2026-10-25 the publish-2026oct25 publish of lecture-python-advanced.myst (run 40234381123) sat in "Install latex dependencies":

  • Attempt 1 downloaded 82 MB in 23 minutes from azure.archive.ubuntu.com, about 60 KB/s. At that rate the full 1013 MB would have taken about 4.5 hours, close to the 6-hour job limit. It was cancelled by hand.
  • Attempt 2 was still in the same step 27 minutes later.
  • The PR's CI run for the same commit, an hour earlier, downloaded the same 1013 MB in about a minute.

Nothing errors, so nothing alerts: the job simply runs on, and someone has to notice.

Who is affected

  • setup-environment with install-latex: 'true' runs an uncached apt-get update and apt-get install.
  • No lecture repo found by code search uses that input. Instead, about 17 repos inline their own sudo apt-get install texlive-… step, usually in ci.yml, cache.yml and publish.yml. They include lecture-python-advanced.myst, lecture-python-intro, lecture-python-programming, lecture-julia.myst, lecture-dle, lecture-dynamics, lecture-eqm, lecture-dps, lecture-tools-techniques, lecture-econometrics-machine-learning, lecture-python-programming.fa, lecture-intro.zh-cn, lecture-python.zh-cn, continuous_time_mcs and dse_2023.

A fix therefore needs to be easy for those inline steps to adopt, not only for repos that already use setup-environment.

Proposal

Cache the downloaded .deb archives with actions/cache, and install from the cache.

  • Key. The runner image (ImageOS and ImageVersion) plus a hash of the package list, with a restore-keys fallback on the image prefix so that a changed list re-downloads only what changed. A cache-version input lets a repo force a fresh cache.
  • Miss. Download into a workspace directory with apt-get install --download-only -o Dir::Cache::archives=<dir>, and hand the directory to the runner user so that actions/cache can save it.
  • Hit. Install from that directory, so that no mirror is contacted for the archives. Whether apt-get update can also be skipped on a hit, for example by installing the cached files directly with apt-get install ./*.deb, needs testing, since update also goes to the mirror.
  • Cache .debs, not installed files. dpkg still runs TeX Live's maintainer scripts (fmtutil, mktexlsr, font maps), so the result is the same as today's install. Actions that cache the installed files instead, such as awalsh128/cache-apt-pkgs-action, skip those scripts, which is fragile for TeX Live.
  • Guard the miss. Add a timeout-minutes on the step and -o Acquire::Retries=3, so that a slow mirror on a cache miss fails loudly in minutes rather than running for hours.

Delivery. I suggest a small standalone setup-latex action, which takes a package list or file plus cache-version. An inline repo can then switch with a one-step change, and setup-environment's install-latex path can call the same action internally.

Cost. About 1 GB of cache per repo, against the default 10 GB per-repository limit. Caches are per repository, so each repo pays one full download after each runner-image update.

Alternative already available

The QuantEcon images (ghcr.io/quantecon/quantecon-build, ghcr.io/quantecon/quantecon) already include TeX Live. They pull about 2.9 GB from GHCR, a different network path from the Ubuntu mirrors. Repos that move to containers sidestep this problem, but that is a larger migration than adopting a cached install step.

🤖 Generated with Claude Code

Lingua principale
Shell
Stelle
0
Fork
1
Merge medio
20h 3m
PR unite (30g)
48

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di QuantEcon/actions

Tutte le issue di QuantEcon/actions

Issue simili

Altre issue su Shell/Bash

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.