perf(ci): cache uv + .venv to skip rebuild on every run - #22221
Closed
wesleysimplicio wants to merge 2 commits into
Closed
wesleysimplicio wants to merge 2 commits into
wesleysimplicio wants to merge 2 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds GitHub Actions caching to the CI workflow to speed up the test and e2e jobs by reusing the uv download/cache directory and the local .venv between runs, keyed by OS + Python version + dependency file hashes.
Changes:
- Add an
actions/cache@v4step intestto cache~/.cache/uvand.venv. - Add the same cache step in
e2ewith the same key/restore-keys strategy.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+37
to
+38
| - name: Cache uv + .venv | ||
| uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4 |
Comment on lines
+41
to
+45
| ~/.cache/uv | ||
| .venv | ||
| key: ${{ runner.os }}-py3.11-uv-${{ hashFiles('pyproject.toml', 'uv.lock') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-py3.11-uv- |
Comment on lines
+76
to
+77
| - name: Cache uv + .venv | ||
| uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4 |
Comment on lines
+80
to
+84
| ~/.cache/uv | ||
| .venv | ||
| key: ${{ runner.os }}-py3.11-uv-${{ hashFiles('pyproject.toml', 'uv.lock') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-py3.11-uv- |
Previously a single cache step combined ~/.cache/uv and .venv with broad restore-keys. The cache step had no id and the install step always ran, making the cache effectively unused. Worse, restore-keys on .venv could restore an environment built for a different dependency set. Split into two caches: broad restore-keys for ~/.cache/uv (always safe), and strict-key-only for .venv (no restore-keys). Gate the install step on the .venv cache-hit so cached envs skip reinstall.
Collaborator
|
closed in favor of #42838 |
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.
What does this PR do?
tests.ymlrebuilds the venv on every CI run. Addingactions/cache@v4keyed onhashFiles('pyproject.toml', 'uv.lock')lets cache hits skip the install entirely.Root cause
The detailed rationale from the original PR body is preserved below. This template update keeps the review structure consistent with #29640.
Fix
Why this shape
This shape mirrors #29640 so reviewers can quickly compare scope, root cause, fix, tests, and related context without having to decode a custom PR description.
Tests
Original body
Related PRs / issues
Original body
Summary
tests.ymlrebuilds the venv on every CI run. Addingactions/cache@v4keyed onhashFiles('pyproject.toml', 'uv.lock')lets cache hits skip the install entirely.What Changed
Fluxo
A mudança continua seguindo o fluxo original descrito na seção preservada abaixo, sem ampliar o escopo funcional deste PR.
Visão
A padronização melhora a revisão, reduz ruído e evita deriva de formatação entre PRs abertos.
Test Plan
Original body
Summary
tests.ymlrebuilds the venv on every CI run. Addingactions/cache@v4keyed onhashFiles('pyproject.toml', 'uv.lock')lets cache hits skip the install entirely.Closes #22004
Change
Adds the same Cache step in both
test:ande2e:jobs (afterInstall uv, beforeSet up Python):~/.cache/uvand.venv${{ runner.os }}-py3.11-uv-${{ hashFiles('pyproject.toml', 'uv.lock') }}Validation
actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57= v4)Generated by Hermes Turbo
Generated by Hermes Turbo