Repository navigation
Description
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-environmentwithinstall-latex: 'true'runs an uncachedapt-get updateandapt-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 inci.yml,cache.ymlandpublish.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 (
ImageOSandImageVersion) plus a hash of the package list, with arestore-keysfallback on the image prefix so that a changed list re-downloads only what changed. Acache-versioninput 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 thatactions/cachecan save it. - Hit. Install from that directory, so that no mirror is contacted for the archives. Whether
apt-get updatecan also be skipped on a hit, for example by installing the cached files directly withapt-get install ./*.deb, needs testing, sinceupdatealso 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 asawalsh128/cache-apt-pkgs-action, skip those scripts, which is fragile for TeX Live. - Guard the miss. Add a
timeout-minuteson 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
Activity
mmcky commentedon Nov 7, 2026
Checked against
mainate40924aon 2026-11-07. The problem is real, and larger than one incident. Since 2026-09-01, 12 of 220 TeX Live install steps across 6 active lecture repos took over 5 minutes, and 10 over 15 minutes: 267, 159, 129 and 40 minutes in lecture-python-advanced.myst; 354 (cancelled near the 6-hour limit), 52, 35, 21 and 20 minutes in lecture-python.zh-cn; and 92 minutes (cancelled) in lecture-intro.zh-cn. That is about 20 hours of runner time. The logs show slow downloads, 64–690 kB/s. The incident's second attempt did finish, after 2 h 09 min ("Fetched 1013 MB in 2h 6min 48s (133 kB/s)"). On a normal day, the 26.04 runner fetches lecture-python-advanced.myst's 141 packages (1077 MB) in 28 s, then spends about 90 s in dpkg and TeX's triggers, which no cache can save.Who is affected. 15 repos inline their own
apt-get install texlive-…, the 15 named above, and none has moved to a container; six of them are dormant. No repo usessetup-environment'sinstall-latex. Ten install the same nine packages; lecture-python.zh-cn's CI addslatex-cjk-all(1352 MB). The planned container moves cover intro, programming and advanced, but not the two zh-cn repos, which had 7 of the 12 slow steps.What changes in the proposal. (1)
setup-environmentcannot call the new action withuses:.quantecon/actions/setup-latex@v0would run the released copy, never the pull request's (the skewbuild-jupyter-cachealready has), and./setup-latexresolves against the caller's workspace. The two actions share a script underscripts/instead, as they already shareworkflow-command.sh. (2) No-o Acquire::Retries=3: the 26.04 runner image setsAcquire::Retries "1"and 15 s timeouts on purpose, so that a stalled mirror fails over to archive.ubuntu.com quickly. A higher count delays that, and the failover never trips on a mirror that trickles anyway. (3) A composite action's step cannot taketimeout-minutes, so the timeout is atimeoutin the script, aroundapt-get updateand the download only, never around dpkg. (4) The key hashes the installed package set (plus the OS release, architecture,cache-versionand the package list), notImageOS/ImageVersion. These exist only on GitHub's images, and an exact hit then means the cache holds every package this host lacks.apt-get updateon a hit. On an exact hit it is skipped: the cached archives are installed as local./*.debfiles with downloads disabled, so dpkg runs every maintainer script as it does today. A fallback restore or a miss runsupdate, downloads only what the cache lacks, installs, prunes stale archives and saves. The harness proves the hit by pointing apt's proxy at a local stand-in that records every request, and asserting it recorded none.The maintainer's decisions, 2026-11-07 (the timeout default revised from off to 30 minutes the same day, at the maintainer's request). Delivery: both, sharing one script under⚠️ marker, and says that a miss whose download runs past 30 minutes now fails rather than finishing slowly. No QuantEcon repository passes
scripts/, in two pull requests. The first adds a new action,setup-latex, which nothing calls yet. The second movessetup-environment'sinstall-latexonto the same script and cache, and merges only after the scheduled lecture-matrix run of 2026-11-09, which usesmain'ssetup-environment.setup-latex's interface: exactly one ofpackages(whitespace- or newline-separated,#comments allowed) orrequirements-file(the format oflatex-requirements-file) must be set, otherwise the action fails before installing anything; no bundled default list. It also takescache-version(defaultv1) anddownload-timeout-minutes, and outputscache-hit, meaning whatconda-cache-hitmeans. The timeout:download-timeout-minutesdefaults to30, and0means no limit.setup-environment:install-latexreusescache-version, gains alatex-cache-hitoutput, and uses the same fixed 30-minute download limit, with no input. The CHANGELOG entry is Changed, with noinstall-latex. Saving: on every miss or fallback restore, except from a tag ref, whose cache no later run could restore. No input.Claude Code (on behalf of mmcky), organiser session; the check by the mini:actions-latex session
fix(setup-latex): say why when the job's user has no passwordless sudo (
ci(harness): fail clearly when the apt stand-in never starts; the sum…
feat(setup-latex): install TeX Live from a cache of the downloaded pa…
feat(setup-environment): install-latex installs from the LaTeX packag…