setup-environment: fix standard-mode conda caching + validation (#33)#78
Merged
Conversation
- C3: in standard (non-container) mode the conda cache was restored and then
setup-miniconda recreated the env unconditionally (environment-file set), so
the cache never saved time. Restructured to the documented setup-miniconda
caching recipe: setup-miniconda runs without environment-file, the env is
restored from cache (${CONDA}/envs), and `conda env update` runs only on a
cache miss. Dropped the deprecated use-only-tar-bz2; dropped miniconda-version
so the env lives at a stable ${CONDA}/envs path (kept current via
auto-update-conda).
- L19: install-latex with a missing requirements file now errors and exits
instead of warning and silently producing a broken env.
- L23: cache-version input documents it is standard-mode only (no effect in
container mode).
Standard mode is a fallback (templates are container-first); the cache hit
should be confirmed on a real CI run (second run should log a hit and skip
env creation).
Closes #33
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the setup-environment composite action to make standard (non-container) Conda caching effective, hardens LaTeX requirements handling, and documents the cache-version input’s scope.
Changes:
- Reworks standard-mode Conda setup to restore
${CONDA}/envsfrom cache and only update/create the env when the primary cache key doesn’t hit. - Fails fast when
install-latex: truebut the LaTeX requirements file is missing. - Documents that
cache-versiononly affects the standard-mode Conda cache (no effect in container mode) and records the behavior in the changelog.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| setup-environment/action.yml | Reorders standard-mode Conda setup and caching; adds cache-miss update step; makes missing LaTeX requirements an error; clarifies cache-version input description. |
| CHANGELOG.md | Adds an Unreleased entry describing the setup-environment caching/validation/doc changes. |
- Cache key now includes environment-name + python-version (changing either
no longer reuses a cache built for a different env/Python); restore-keys
tightened to the same name+python (dropped the too-broad conda-{os}- fallback).
- Validate environment.yml exists in standard mode (fail fast) so a missing
file can't be masked by a cache hit.
- Renamed the update step ('no exact cache hit' — it also runs on a restore-keys
partial match, not only a true miss) and added --prune so deps dropped from
environment.yml don't linger in an updated cached env.
- CHANGELOG wording corrected to match (no exact cache hit, not 'cache miss').
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
mmcky
added a commit
that referenced
this pull request
Jun 16, 2026
Pin third-party actions to full commit SHAs (with a `# vN` comment) so a hijacked upstream tag can't inject code into our workflows (cf. the tj-actions/changed-files compromise): - docker/login-action, docker/setup-buildx-action, docker/metadata-action, docker/build-push-action (build-containers.yml, test-container.yml) - softprops/action-gh-release (publish-gh-pages) - conda-incubator/setup-miniconda (setup-environment) First-party actions/* are left on major tags (GitHub-maintained, per GitHub's guidance). Dependabot's github-actions ecosystem keeps the SHA pins current. Note: conda-incubator/setup-miniconda is in setup-environment/action.yml, which open PR #78 (#33) also edits — whichever merges second needs a trivial rebase. Closes #39 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
mmcky
added a commit
that referenced
this pull request
Jun 16, 2026
Pin third-party actions to full commit SHAs (with a `# vN` comment) so a hijacked upstream tag can't inject code into our workflows (cf. the tj-actions/changed-files compromise): - docker/login-action, docker/setup-buildx-action, docker/metadata-action, docker/build-push-action (build-containers.yml, test-container.yml) - softprops/action-gh-release (publish-gh-pages) - conda-incubator/setup-miniconda (setup-environment) First-party actions/* are left on major tags (GitHub-maintained, per GitHub's guidance). Dependabot's github-actions ecosystem keeps the SHA pins current. Note: conda-incubator/setup-miniconda is in setup-environment/action.yml, which open PR #78 (#33) also edits — whichever merges second needs a trivial rebase. Closes #39 Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #33 (C3, L19, L23) — makes the non-container (standard-mode) Conda cache actually save time, plus two smaller hardening/doc fixes.
C3 — the cache was a no-op
Before, standard mode restored the Conda cache and then ran
setup-minicondawithenvironment-file:set, which recreates the env every run — so the cache never helped (the README's "~3-4 min cached" was aspirational).Restructured to the documented setup-miniconda caching recipe:
setup-minicondaruns withoutenvironment-file(installs conda + the named env shell, doesn't rebuild from the file);actions/cacherestores the env at${CONDA}/envs;conda env updateonly on a cache miss (cache-hit != 'true', which also covers prefix-matched restores when the env file changed).Also:
use-only-tar-bz2;miniconda-version: latestso the env lives at a stable${CONDA}/envspath (the runner's pre-installed conda, kept current byauto-update-conda) — this is what makes the cache path reliable.L19 — fail loudly on missing LaTeX requirements
install-latex: truewith a missing requirements file now errors and exits instead of warning + skipping (which produced an env that failed ~an hour later in the build).L23 —
cache-versiondocDocumented that
cache-versiononly affects the standard-mode Conda cache (no effect in container mode, which has no Conda cache).Standard mode is a fallback (the templates are container-first), and conda env caching is finicky and can't be verified locally. Worth confirming on a real CI run: the second run on an unchanged
environment.ymlshould log a cache hit and skip the "Create/update environment" step. If the${CONDA}/envspath turns out wrong on the hosted runner, the fix is a one-line path tweak.Closes #33
🤖 Generated with Claude Code