Fix broken rust cache#1477
Merged
Merged
Conversation
Signed-off-by: Ludvig Liljenberg <4257730+ludfjig@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes broken Rust dependency caching for PR builds. Caches saved off non-main refs are not restorable from PRs, so no workflow was effectively seeding the cache. The PR introduces a dedicated PrimeCaches.yml workflow that runs on push to main to populate all Swatinem/rust-cache shared keys used by PR workflows, makes PR reusable workflows read-only via save-if: github.ref == 'refs/heads/main', and qualifies the build-test cache key by hypervisor so KVM (Ubuntu) and mshv3 (Azure Linux 3) get distinct caches.
Changes:
- Add
PrimeCaches.ymlto prime guests, code-checks, and host caches on main pushes across all hypervisors/configs. - Add
save-if: github.ref == 'refs/heads/main'todep_build_guests.yml,dep_code_checks.yml, anddep_build_test.ymlso PR runs only read from the cache. - Add
inputs.hypervisorto the shared cache key indep_build_test.yml,dep_run_examples.yml, anddep_benchmarks.ymlso Ubuntu-based KVM runners and Azure Linux 3 mshv3 runners don't share the same Linux cache entry.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
.github/workflows/PrimeCaches.yml |
New workflow that builds guests, code-checks, and host on main to populate every shared rust-cache key used by PR jobs. |
.github/workflows/dep_build_guests.yml |
Adds save-if: refs/heads/main so PR runs are read-only against the guests cache. |
.github/workflows/dep_code_checks.yml |
Adds save-if: refs/heads/main for both Linux and Windows code-checks caches. |
.github/workflows/dep_build_test.yml |
Adds hypervisor to the cache key and save-if: refs/heads/main, separating kvm/mshv3 caches. |
.github/workflows/dep_run_examples.yml |
Aligns the cache key with the new hypervisor-qualified scheme. |
.github/workflows/dep_benchmarks.yml |
Aligns the release cache key with the new hypervisor-qualified scheme. |
jsturtevant
reviewed
May 28, 2026
jsturtevant
approved these changes
May 28, 2026
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.
Our existing caching is broken because the cache is written from pr branches, but cannot be consumed by other branches
https://docs.github.com/en/actions/reference/workflows-and-actions/dependency-caching#restrictions-for-accessing-a-cache.
This PR adds a workflow on default branch (main) to prime the caches (to make it available to all branches), and makes PRs branches read-only for the caches. Also splits cache on kvm (ubuntu) and mshv (azl3) since I believe this is necessary.