Repository navigation
feat(setup-environment): install-latex installs from the LaTeX package cache, as setup-latex does (#224) - #284
Conversation
…ckages (#224) A new action, setup-latex, installs the apt packages it is given and keeps their downloaded .deb archives in the repository's Actions cache. The key hashes the installed package set, so an exact hit installs the archives as local files with no apt-get update and no download; a fallback restore or a miss downloads only what the cache lacks, prunes, and saves. A download-timeout-minutes limit (default 30) stops a mirror that trickles. The work is in scripts/latex-packages.sh, which setup-environment's install-latex will share. Part of #224. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WT8bMXtFLfZrVgBA6ycXev
…s and the example list's header (#224) ARCHITECTURE.md's parts table counts nine actions, and its shared scripts row names the cached LaTeX install. security.md lists packages among the inputs that may span lines. The example latex-requirements.txt names setup-latex, and its format note now matches the parser: '#' starts a comment anywhere on a line. Part of #224. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WT8bMXtFLfZrVgBA6ycXev
Brings in #280. The CHANGELOG's [Unreleased] keeps both entries, setup-latex's ### Added above #280's ### Changed. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WT8bMXtFLfZrVgBA6ycXev
apt fails at once a response whose length it knows to be wrong: a 1 GB InRelease is past its 10 MB limit, and a .deb's must match the index. With no length, apt reads until the connection closes, which the stand-in never does, so only download-timeout-minutes stops it. Part of #224. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WT8bMXtFLfZrVgBA6ycXev
…from a mirror (#224) Two things a runner showed. apt refuses even local .deb files under --no-download, so the completeness check always failed and every hit went online. And given a local file whose version the image's lists also carry, apt downloads that version from a mirror rather than read the file. With the cache as apt's Dir::Cache::archives, it finds each archive there and fetches nothing; a version only the file carries is read in place. The check is now apt's --print-uris, which lists what it would fetch and reads no mirror. Part of #224. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WT8bMXtFLfZrVgBA6ycXev
apt failed at once both a 1 GB length, past its 10 MB InRelease limit, and a response with no length, so apt-get update never hung. Part of #224. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WT8bMXtFLfZrVgBA6ycXev
…prune's says what it removes (#224) Part of #224. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WT8bMXtFLfZrVgBA6ycXev
Brings in #281. No conflict: the CHANGELOG's [Unreleased] keeps setup-latex's ### Added first, then #280's ### Changed and #281's ### Fixed. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WT8bMXtFLfZrVgBA6ycXev
…e cache, as setup-latex does (#224) install-latex now runs scripts/latex-packages.sh, as setup-latex does: an exact hit installs the cached archives with no apt-get update and no download; a fallback restore or a miss downloads what the cache lacks, within a fixed 30 minutes, and saves straight after the install. A new output, latex-cache-hit, says which. cache-version keys the LaTeX cache too. The list's entries must be apt package names. The harness gains env-latex-seed and env-latex-hit, the hit behind the refusing stand-in. The stand-in's setup moves into refuse-mirrors.sh, which latex-hit now uses too. PLAN.md drops #224. Part of #224. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WT8bMXtFLfZrVgBA6ycXev
#224) From Copilot's review of #283. On a self-hosted runner whose user cannot sudo without a password, prepare now fails before it makes anything, with an ::error:: that says apt needs root and how to give it, instead of sudo's own message. latex-inputs runs prepare with a sudo stub that asks for a password, and checks the message. Part of #224. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WT8bMXtFLfZrVgBA6ycXev
Brings in #283's sudo check (e4bb43a). TESTING.md keeps this branch's setup-environment row and #283's setup-latex row. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WT8bMXtFLfZrVgBA6ycXev
There was a problem hiding this comment.
Note
Copilot was unable to complete this review at the selected tier due to model policy or plan restrictions.
🟡 Changes recommended
A moderate active issue remains in .github/fixtures/setup-latex/refuse-mirrors.sh where the proxy readiness loop may exit without verifying apt-proxy is actually listening, leading to misleading mirror-related failures and flakier, harder-to-debug CI unless an explicit post-loop check is added.
1 open issue
What changed in this PR
This pull request updates setup-environment’s optional install-latex path to use the same cached-archive installation flow introduced for setup-latex, reducing repeated TeX Live downloads from Ubuntu mirrors and adding harness coverage for cache-hit behavior (including a fixed 30‑minute download/update timeout).
Changes:
- Refactors LaTeX installation in
setup-environmentinto list/prepare/cache-restore/install/cache-save steps driven byscripts/latex-packages.sh. - Adds a
latex-cache-hitoutput and updates action summaries/docs to reflect cache-hit vs fallback vs miss behavior. - Extends CI harness to seed and verify exact cache hits (including “no apt mirror requests”) and adds a shared “refuse mirrors” fixture.
| File | Summary |
|---|---|
setup-environment/action.yml |
Switches install-latex to the shared cached-install flow, adds latex-cache-hit, and updates summary/docs text (note: current latex-cache-hit/summary semantics can be misleading when an exact cache-key restore still falls back to downloading). |
scripts/latex-packages.sh |
Adjusts list-mode behavior/messages to support callers that only provide a requirements file (no inline packages input). |
docs/user/actions/setup-latex.md |
Documents that setup-environment now installs LaTeX via the same script+cache approach. |
docs/user/actions/setup-environment.md |
Regenerates/updates docs describing cached LaTeX install behavior, the fixed timeout, new output, and updated failure/troubleshooting guidance. |
docs/dev/TESTING.md |
Updates the testing matrix to include the new LaTeX cache harness coverage for setup-environment. |
docs/dev/PLAN.md |
Updates the plan/status tracking to reflect completion of the related work item. |
CHANGELOG.md |
Adds an Unreleased entry describing the changed LaTeX install behavior and the new output. |
.github/workflows/test-actions.yml |
Adds env-latex-seed/env-latex-hit harness jobs to validate miss→hit behavior and “no mirror contact” assertions. |
.github/fixtures/setup-latex/refuse-mirrors.sh |
New harness helper to stand up a refusing apt proxy; needs an explicit post-loop failure if the proxy never becomes ready to avoid flakiness/misattributed failures. |
Review effort: Balanced
| log="$RUNNER_TEMP/apt-proxy.log" | ||
| python3 "$(dirname "${BASH_SOURCE[0]}")/apt-proxy.py" refuse 3128 "$log" > "$RUNNER_TEMP/apt-proxy.out" 2>&1 & | ||
| for _ in $(seq 50); do | ||
| curl -s -o /dev/null http://127.0.0.1:3128/ && break | ||
| sleep 0.2 | ||
| done |
There was a problem hiding this comment.
Agreed, and fixed in 8701883. If apt-proxy.py is not listening after the 10 s loop, refuse-mirrors.sh now prints the stand-in's own output and fails with an ::error:: saying it was not listening, before it touches apt's configuration. latex-timeout's loop had the same gap, and got the same check.
On the review summary's other note, that latex-cache-hit and the summary can mislead when an exact match still downloads: the output keeps conda-cache-hit's meaning, the key match, as the maintainer decided. But the summary line no longer claims "no download", and now says "Installed from an exact cache match". The rare exact match that falls short is reported by the install step's warning, and the key should rule it out.
Claude Code (on behalf of mmcky)
…mary claims no download it cannot know (#224) From Copilot's review of #284. refuse-mirrors.sh and latex-timeout now fail, with the stand-in's output, when it is not listening after 10 s, instead of blaming the mirrors later. setup-environment's summary says an exact cache match, not 'no download', since the rare exact match that falls short downloads, with a warning in the install step. Part of #224. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WT8bMXtFLfZrVgBA6ycXev
Brings in #283's squash, d89b021, whose tree is that of e4bb43a, which this branch already holds. Where the two touch the same lines, this branch's version, which builds on e4bb43a, is kept: the tree is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WT8bMXtFLfZrVgBA6ycXev
Brings in #280, #281, #283 and #284. CHANGELOG keeps main's [Unreleased] entries and puts #142's in Changed; PLAN keeps main's rows and drops #142 from the Container validation row. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WT8bMZzgrBo6FK6GsstoUY
* release: v0.17.0 Cut [0.17.0] - 2026-11-10 under an empty [Unreleased]: setup-latex (#283), setup-environment's install-latex on the LaTeX cache (#284), the execution cache keyed on the environment and the templates restoring it (#280), preview-cloudflare's deploy-url (#281), and :latest promoted only after the smoke test (#274). PLAN's release line: 9 actions with setup-latex, v0.17.0 the latest release, @v0 on v0.16.0 until this release's canary and the lecture matrix have passed. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WT8bMbZoC2dpGt3sPyBjyd * docs(plan): format the release line's v0.17.0 as code, as its other versions are Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WT8bMbZoC2dpGt3sPyBjyd --------- Co-authored-by: Claude Opus 5.5 <[email protected]>

Important
This waits for Monday. It changes
setup-environment/, which the scheduled lecture-matrix run of 2026-11-09 02:00 UTC uses frommain, and which must still be v0.16.0's when that run letsv0move. Merge it only after that run passes.setup-environment'sinstall-latexdownloads TeX Live from the runner's Ubuntu mirror on every run, with a plainsudo apt-get updateandsudo apt-get install. A slow mirror stalls that for hours without failing (the check on #224 has the numbers). #283, merged as d89b021, addedsetup-latex, which installs from a cache of the downloaded archives. This PR is the second of the two the maintainer chose on #224. It movesinstall-latexonto the same script,scripts/latex-packages.sh, and the same cache.setup-environmentcannot callsetup-latexitself:uses: quantecon/actions/setup-latex@v0would run the released copy, never this PR's, and./setup-latexresolves against the caller's workspace. So it runs the script's three steps and the twoactions/cachesteps directly, assetup-latexdoes.install-latex: 'true', standard modeapt-get update, then every package downloaded from the mirrorapt-get updateand no download.latex-cache-hit: 'true'apt-get update, then only what the restored archives lack downloaded.latex-cache-hit: 'false'apt-get update, that takes over 30 minutessetup-latex'sdownload-timeout-minutessets another limit--no-install-recommendscache-versionbumpedWho this reaches. No QuantEcon repository passes⚠️ marker, as the maintainer decided. It says plainly that a download past 30 minutes now fails where it used to finish slowly.
install-latex(code search, 2026-11-07).build-jupyter-cachepasses it for apdflatexbuild in standard mode, throughsetup-environment@v0, so it reaches that path only whenv0moves. Its three QuantEcon callers all run in a container: lecture-dp, test-lecture-theme-sphinx and the canary. So the entry is Changed, without theChanges
setup-environment/action.ymlif: container-mode == 'false' && install-latex == 'true': read the list (latex-packages.sh list, with nopackagesinput), prepare,actions/cache/restore@v6, install (withTIMEOUT_MINUTES: '30'and no input named), andactions/cache/save@v6. A new output,latex-cache-hit. Thecache-version,install-latexandlatex-requirements-filedescriptions say what they now do. The summary's LaTeX line says whether the packages came from an exact cache match, an earlier cache, or no cache.scripts/latex-packages.shlisttakesPACKAGES_INPUT=''for an action with only a file input, so its messages never name apackagesinput. The header names both callers.docs/user/actions/setup-environment.mdsetup-latex. "What fails the job" and Troubleshooting gain the bad-entry and timeout messages, and the missing and empty list messages as they now read. "The restored environment is broken" covers the LaTeX cache too.docs/user/actions/setup-latex.mdsetup-environment" saysinstall-latexnow installs the same way..github/workflows/test-actions.ymlenv-latex-seed: a saltedcache-version, so both caches miss:latex-cache-hitempty, andpdflatexworks.env-latex-hit: on the seed's image, behind the refusing stand-in,latex-cache-hit == 'true', no request through apt, andpdflatexworks; on another image, the fallback install instead, with a notice. Both are inharness-summary'sneeds:.latex-hit's stand-in setup moves into a script both jobs use.latex-timeout's stand-in now has to be listening before the job goes on..github/fixtures/setup-latex/refuse-mirrors.sh(new)apt-proxy.pyin refuse mode, and fails, with the stand-in's output, if it is not listening after 10 s. Then it points apt's http and https proxy at it, shows thatapt-get update's requests reach it, and clears its log.docs/dev/TESTING.mdsetup-environment's row covers the two new jobs.docs/dev/PLAN.mdCHANGELOG.md[Unreleased],### Changed, after #270's.Also fixed: a gap in #283's harness
Copilot found that the stand-in's readiness loop could fall through without the proxy ever listening, after which a hit job would blame the mirrors rather than the stand-in. #283 has the same loop inline, in
latex-hitandlatex-timeout. This PR closes the gap in both, as agreed with the organiser:latex-hitnow usesrefuse-mirrors.sh, which checks, andlatex-timeoutchecks too. Both changes are to the harness only (8701883).What I checked, and how
The new hit test fails on today's code. A throwaway branch from
mainranenv-latex-hit's shape:main'ssetup-environmentwithinstall-latex: 'true', behind the refusing stand-in (run 42349915064).apt-get updatewent through the stand-in, and the install failed with exit 100 on "Failed to fetch". The assertion failed: "the install made 160 requests through apt (above): it ran apt-get update or downloaded". The branch is deleted.The script itself is #283's, where
latex-seed,latex-hit,latex-fallbackandlatex-timeoutpass on real runners: an exact hit with no request through the stand-in, a fallback that downloaded 121 kB, and the limit stopping a trickling mirror at 60 s. This PR's own run shows the same throughsetup-environment.Callers. Code search of the org for
install-latexfinds only this repository's files, and forquantecon/actions/build-jupyter-cachefinds three workflows, each with acontainer:image.The local checks, with actionlint 1.7.12 and shellcheck 0.11.0. These are clean:
python3 scripts/generate-docs.py --check --check-examples --actionlint …,actionlint,python3 scripts/lint-shell.py, and shellcheck on the fixture scripts. Againstmain,CHANGELOG.mdgains two entries and loses no line, and everything from## [0.16.0]down is unchanged.What to watch after merge
Nothing at merge. No QuantEcon workflow uses
setup-environmentin standard mode withinstall-latex.At the staged release of v0.17.0, the canary should exercise this path. Add it to #283's throwaway workflow: two standard-runner jobs, a miss and then a hit, each running
[email protected]withinstall-latex: 'true'and the canary'slatex-requirements.txtandenvironment.yml, then abuild-lecturespdflatexbuild. In the second job's log, the summary should say "LaTeX: Installed from an exact cache match". The LaTeX steps should show noapt-get updategroup and noGet:line.When
v0moves to v0.17.0,build-jupyter-cache's standard-modepdflatexpath gets the cache too.Not in this PR
setup-environment: the maintainer chose a fixed 30 minutes.setup-latexhas the input.Closes #224.
🤖 Generated with Claude Code
https://claude.ai/code/session_01WT8bMXtFLfZrVgBA6ycXev