feat: Add caching support for container mode builds
Nobody has claimed this yet.
- Dominant language
- Shell
- Stars
- 0
- Forks
- 1
- Avg merge
- 32m
- Merged PRs (30d)
- 3
Description
Speed up container-mode setup-environment by avoiding a fresh package install every run. Scope is now narrow: only the per-lecture environment-update delta install is uncached, and no consumer pays for it today.
The common stack is pre-baked on the Anaconda 2026.06 baseline (containers/quantecon/environment.yml:11; lean-image pins at containers/quantecon-build/environment.yml:20-29), reaching consumers via the image tag, not the v0.9.0 release. Undone is the literal ask: analyse packages common across the lecture repos and add them to quantecon-build. containers/quantecon-build/environment.yml:3 still routes every lecture-specific package (quantecon, wbgapi, jax) to the lecture repo's own environment file; that delta install is the whole remaining scope.
The default path is zero-cost: environment-update defaults to '' (setup-environment/action.yml:17) and container mode runs a no-op (setup-environment/action.yml:85-93), shipped in v0.5.0. No consumer passes it — QuantEcon/lecture-dp's ci.yml and cache.yml do not — and the #92 baseline below shows no delta install among the costs.
actions/cache can see /opt/conda — under container: every step runs inside the container, JS actions included — so isolation was never the obstacle. The real obstacles, hit by the #100 harness in standard mode: tar ownership/permissions on restore (setup-environment/action.yml:122-127), and restoring a cached env over the image's own. The workspace-copy workaround (into .cache/, back over site-packages) is out; the pip-download-cache and mounted-volume variants need re-deriving from these. Two shipped comments still assert the wrong rationale (Conda env outside the workspace mount, actions/cache on the host) and link back here.
Next steps
-
Pre-bake the common stack into the container images— done in #95 (v0.9.0) -
Profile current build times to establish a baseline— done for the container path in #92: warmlecture-dp~2.7 min, container pull 129s, HTML 22s, cache restore 3s - Correct that rationale (
setup-environment/action.yml:62-66,setup-environment/README.md:126) and the unmeasured ~30-60s figure (setup-environment/README.md:127), regardless of later measurement; can ride #107, which fixes the missing-nin the same step (setup-environment/action.yml:77) - Revisit only once a repo adopts an
environment-updatefile and there is a measured cost - If worth attacking, prefer baking the near-universal delta packages into the image over caching them
Keep open at low priority, per PLAN.md:115. Origin: PR #17, container-aware setup-environment. #107 (conda env update without -n, wrong env) lands before any work here; #92 has the measured preview-build baselines.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with setup-environment/action.yml:62-66, 77, and 122-127, plus setup-environment/README.md:126-127 and the #100 harness. Verify the container-mode delta-install path and cache behavior, then revisit only after a repository adopts an environment-update file and its cost is measured; any implementation should resolve the stated restore and image-environment concerns.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- github-actions, python
- Domain
- build-system, ci-cd
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100