Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
The Tests job triggers only on pull_request, so it never runs on push to main and never populates the main cache scope — the only scope every PR can read. Each PR's toolchain/cargo caches live on its own refs/pull/<N>/merge ref, invisible to other PRs, so every new PR misses and rebuilds anchor-cli from source (~6.5 min). Add a push trigger on main so a post-merge run saves the toolchain and cargo caches into the main scope that all subsequent PRs inherit. Also add restore-keys to the cargo cache so a Cargo.lock change restores the nearest prior cache and compiles incrementally instead of cold.
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.
Problem
The
TestsCI job (.github/workflows/test.yml) spends ~6.5 min of its ~11 min on essentially every PR's first run installing Solana and building anchor-cli from source, beforemake teststarts.Root cause
A workflow run can only restore caches created on its own ref or on the repo's default branch (
main) — never on a different PR's ref.test.ymltriggered onlyon: pull_request, so the job never ran on a push tomainand themaincache scope — the only scope every PR can read — was never populated. Every PR's caches lived onrefs/pull/<N>/merge, invisible to other PRs, so each new PR missed and rebuilt the toolchain.Secondary: the cargo cache key embedded
hashFiles('Cargo.lock')with norestore-keysfallback, so anyCargo.lockchange cold-compiled all deps.Fix
mainso a post-merge run saves both the toolchain cache (install-toolchain, keytoolchain-solana-<ver>-anchor-<rev>-<platform>) and the cargo cache into themainscope that every subsequent PR inherits — eliminating the repeated ~6.5 min Anchor builds.restore-keysto the cargo cache so a dep bump restores the nearest prior cache and compiles incrementally instead of cold.No new cache step or change to
install-toolchain/action.ymlneeded — its key is already stable/version-pinned; it just needed themainscope populated, which fix #1 provides.Verification
After this merges to
mainand amainrun completes:install-toolchainstep logs a cache hit fortoolchain-solana-...(noinstall-tools.shrun) and the cargo step hits or restores viarestore-keys.gh cache list --json key,refshows entries withref: refs/heads/main.