CI: cache Poetry tool venv and project venv across jobs - #1560
Open
mithr4ndir wants to merge 1 commit into
Open
Conversation
Adds actions/cache@v4 to all four CI jobs in lightkurve-tests.yml, keyed on runner OS, Python version, and the pyproject.toml hash. Both the Poetry tool venv (./poetry) and the project venv (./.venv) are cached so reruns reuse resolved dependencies. POETRY_VIRTUALENVS_IN_PROJECT=true is set at the job level so Poetry installs project dependencies into ./.venv at the project root, making the cache path uniform across Linux, macOS, and Windows. The Install dependencies step now skips recreating ./poetry when a working tool venv was restored from cache. Refs lightkurve#1553. Co-Authored-By: Claude Opus 4.7 (1M context) <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.
Adds
actions/cache@v4to all four CI jobs (pytest-linux, pytest-windows,pytest-osx, flake8-linter) to cache both the Poetry tool venv (
./poetry)and the in-project dependency venv (
./.venv) between runs.What changed
POETRY_VIRTUALENVS_IN_PROJECT: "true"added as a job-level env var soPoetry always places
.venvat the project root, making the cache pathuniform across all runners.
mkdir poetry+ unconditional venv setup is replaced with aconditional that skips recreating the tool venv when a cached one is
restored.
poetry install --with devstill runs on every job to verifythe lockfile is satisfied.
poetry-<OS>-py<python-version>-<sha256(pyproject.toml)>poetry-<OS>-py<python-version>-(partial match seeds thevenv, poetry install updates only what changed)
Why
On a cache miss the install step runs roughly 2 minutes on GitHub runners
(resolving and downloading ~280 MB of packages). On a cache hit it drops to
a fast lockfile verify pass. With 8 job instances per push this compounds
across the matrix.
Testing
Verified locally using
actwith its built-in cache server across Python3.10, 3.11, 3.12, and 3.13:
cache-hit=true, install reports "No dependencies to installor update", cache not re-saved on primary key match
Refs #1553.