Conversation
alnoki
added a commit
that referenced
this pull request
Jun 12, 2026
## Problem
The `Tests` CI 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**, before `make test` starts.
## 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.yml` triggered **only** `on: pull_request`, so the job never ran
on a push to `main` and the `main` cache scope — the only scope every PR
can read — was never populated. Every PR's caches lived on
`refs/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
no `restore-keys` fallback, so any `Cargo.lock` change cold-compiled all
deps.
## Fix
1. **Run the job on push to `main`** so a post-merge run saves both the
toolchain cache (`install-toolchain`, key
`toolchain-solana-<ver>-anchor-<rev>-<platform>`) and the cargo cache
into the `main` scope that every subsequent PR inherits — eliminating
the repeated ~6.5 min Anchor builds.
2. **Add `restore-keys` to 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.yml` needed —
its key is already stable/version-pinned; it just needed the `main`
scope populated, which fix #1 provides.
## Verification
After this merges to `main` and a `main` run completes:
1. On a throwaway PR, confirm the `install-toolchain` step logs a
**cache hit** for `toolchain-solana-...` (no `install-tools.sh` run) and
the cargo step hits or restores via `restore-keys`.
2. `gh cache list --json key,ref` shows entries with `ref:
refs/heads/main`.
3. Total Tests wall-clock drops by roughly the ~6.5 min toolchain build.
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.
Changes
lintandsemantic-prchecks on pull requests.pre-commitconfiguration withyamllint,markdownlint,mdformat,cspell,checkmake, and standard hygiene hooks, plus their per-tool configs undercfg/.Makefilewithlinttarget (and requiredall/clean/testphony targets) to run pre-commit locally against the same config used in CI.init-prandpr-title-descriptionClaude skills for PR workflow automation.