Skip to content

Fix broken rust cache#1477

Merged
ludfjig merged 1 commit into
hyperlight-dev:mainfrom
ludfjig:fix_cache
May 28, 2026
Merged

Fix broken rust cache#1477
ludfjig merged 1 commit into
hyperlight-dev:mainfrom
ludfjig:fix_cache

Conversation

@ludfjig
Copy link
Copy Markdown
Contributor

@ludfjig ludfjig commented May 27, 2026

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.

Signed-off-by: Ludvig Liljenberg <4257730+ludfjig@users.noreply.github.com>
@ludfjig ludfjig added kind/enhancement For PRs adding features, improving functionality, docs, tests, etc. area/infrastructure Concerns infrastructure rather than core functionality github_actions Pull requests that update GitHub Actions code labels May 27, 2026
@ludfjig ludfjig marked this pull request as ready for review May 27, 2026 21:18
Copilot AI review requested due to automatic review settings May 27, 2026 21:18
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.yml to prime guests, code-checks, and host caches on main pushes across all hypervisors/configs.
  • Add save-if: github.ref == 'refs/heads/main' to dep_build_guests.yml, dep_code_checks.yml, and dep_build_test.yml so PR runs only read from the cache.
  • Add inputs.hypervisor to the shared cache key in dep_build_test.yml, dep_run_examples.yml, and dep_benchmarks.yml so 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.

Comment thread .github/workflows/dep_benchmarks.yml
@ludfjig ludfjig merged commit 8b74e7a into hyperlight-dev:main May 28, 2026
42 of 43 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/infrastructure Concerns infrastructure rather than core functionality github_actions Pull requests that update GitHub Actions code kind/enhancement For PRs adding features, improving functionality, docs, tests, etc.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants