ci: unify toolchain setup into one composite action - #649
Conversation
One .github/actions/setup action with install-* toggles and version inputs (pnpm/Node, Solana, Anchor, just, sbpf) plus built-in caching, called by every build workflow. Replaces the vendored setup-anchor action and all remote heyAyushh/setup-solana references — that action checks out its own default branch at runtime for its scripts, so even a SHA pin executed unpinned code. Solana installs straight from release.anza.xyz; "stable"/"beta" resolve through the vendored channel-info.sh. Also fixes an upstream bug inherited by the old action: when a channel has no tag, its empty field shifted the other tag into the wrong slot on read, so "stable" could resolve to nothing and 404 (true today — beta currently has no tag). The script now emits "none" placeholders and the action errors explicitly on a tagless channel.
|
Superseded by a single combined PR. |
Greptile SummaryThe PR centralizes CI toolchain installation and caching in one repository-local composite action.
Confidence Score: 4/5The PR is safe to merge, with non-blocking improvements available for cache-order documentation and action-reference pinning. The Solana cache is restored after cleanup and uncached runs install the requested toolchain; the remaining concerns are maintainability of that ordering and the mutable setup-node tag. .github/actions/setup/action.yml
|
| Filename | Overview |
|---|---|
| .github/actions/setup/action.yml | Defines the consolidated toolchain setup and caching flow, with non-blocking concerns around cache-order clarity and mutable setup-node references. |
| .github/actions/setup/scripts/channel-info.sh | Resolves stable and beta Agave tags while preserving empty channel fields with explicit placeholders. |
| .github/actions/setup/scripts/semver.sh | Supplies semantic-version comparison helpers used by channel resolution. |
| .github/workflows/solana-asm.yml | Migrates ASM builds to the composite action and pins compatible stable Solana and sbpf versions. |
| .github/workflows/solana-native.yml | Migrates stable and scheduled beta native builds to the shared setup action. |
| .github/workflows/solana-pinocchio.yml | Migrates stable and scheduled beta Pinocchio builds to the shared setup action. |
| .github/workflows/anchor.yml | Replaces the vendored Anchor setup action with the consolidated setup action. |
| .github/workflows/just.yml | Consolidates per-project Node, Cargo, Solana, and just setup configuration. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart LR
W[Build workflows] --> S[Local setup action]
S --> N[pnpm and Node]
S --> C[Cargo cache]
S --> R[Resolve Solana release]
R --> X[Clean existing installation]
X --> K[Restore Solana cache]
K --> I{Cache hit?}
I -->|No| D[Install from release.anza.xyz]
I -->|Yes| V[Verify version]
D --> V
S --> A[Optional Anchor]
S --> J[Optional just]
S --> B[Optional sbpf]
Reviews (1): Last reviewed commit: "ci: unify toolchain setup into one compo..." | Re-trigger Greptile
| - name: Clean existing Solana installation | ||
| if: inputs.install-solana == 'true' | ||
| shell: bash | ||
| run: | | ||
| rm -rf ~/.cache/solana | ||
| rm -rf ~/.local/share/solana | ||
| rm -rf ~/.solana | ||
| rm -rf ~/.config/solana | ||
| rm -rf ~/.cargo/bin/cargo-build-sbf | ||
| rm -rf ~/.cargo/bin/cargo-test-sbf |
There was a problem hiding this comment.
Clarify cache cleanup ordering
The cleanup intentionally runs before cache restoration, so cached installations remain available and installation is skipped safely on hits. Documenting this ordering next to the cleanup prevents future refactors from moving it after restoration and deleting the toolchain.
Knowledge Base Used: Repo Tooling: Building, Testing, and CI'ing the Program Examples Monorepo
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
|
|
||
| - name: Setup Node.js | ||
| if: inputs.install-pnpm == 'true' && inputs.node-version-file == '' | ||
| uses: actions/setup-node@v5 |
There was a problem hiding this comment.
Mutable setup action reference
The consolidated action invokes actions/setup-node@v5 through a mutable tag, allowing a moved tag to change the code executed across every migrated build workflow. Pin both setup-node invocations to a full commit SHA, consistent with the other external actions in this file.
…#650) ## Summary Combined CI overhaul (supersedes the closed stack #643–#647, #649). Six commits, reviewable one by one: - **Hardening** — fix the matrix stride bug (jobs sliced with hardcoded `MIN_PROJECTS_PER_JOB` while the matrix was sized with the computed `projects_per_job`, silently skipping projects past 256 dirs of one type); cancel superseded PR runs; `timeout-minutes` on every job; top-level `permissions: contents: read`; third-party actions pinned to commit SHAs. - **Beta → nightly** — Solana beta legs ran double the build on every PR while `continue-on-error` made them unfailable. They now run only on the nightly schedule, skip the test leg when beta setup fails, and report passed/failed/skipped explicitly in the job summary. - **Typecheck** — nothing in CI ran `tsc` (Biome only lints; ts-mocha/tsx transpile without checking). Every build workflow now runs `tsc --noEmit` per project — after `anchor build` for anchor so generated `target/types`/`target/idl` resolve. 79 of ~100 projects failed the initial audit; all CI-covered projects were repaired (tsconfig hygiene, `@types/node`, TS 4→5 bumps, lockfile regens) including real bugs: `counter/native` called `createIncrementInstruction` with two args, `close-account/native` was missing its `borsh` dependency. - **Caching** — pnpm store, shared cargo-registry cache, Solana toolchain cache, sbpf binary keyed on its pinned rev. - **Repo checks** — workspace-membership ratchet: crates outside the root Cargo workspace escape fmt/clippy; `.github/.workspace-ignore` seeds the 53 current gaps and CI fails on new ones. Dependabot now covers npm (grouped, biweekly, patch-only). `typescript.yml` renamed to Lint. - **Unified setup action** — single `.github/actions/setup` with `install-*` toggles + version inputs (pnpm/Node, Solana, Anchor, just, sbpf) and built-in caching, called by every build workflow. Absorbs the vendored setup-anchor and removes all remote `heyAyushh/setup-solana` references — that action checks out its own default branch at runtime, so even SHA-pinned it executed unpinned code. Also fixes an inherited bug that is live today: with no beta tag, `channel-info.sh`'s positional output shifts stable into the beta slot and "stable" resolves to nothing.
One .github/actions/setup action with install-* toggles and version
inputs (pnpm/Node, Solana, Anchor, just, sbpf) plus built-in caching,
called by every build workflow. Replaces the vendored setup-anchor
action and all remote heyAyushh/setup-solana references — that action
checks out its own default branch at runtime for its scripts, so even
a SHA pin executed unpinned code. Solana installs straight from
release.anza.xyz; "stable"/"beta" resolve through the vendored
channel-info.sh.
Also fixes an upstream bug inherited by the old action: when a channel
has no tag, its empty field shifted the other tag into the wrong slot
on read, so "stable" could resolve to nothing and 404 (true today —
beta currently has no tag). The script now emits "none" placeholders
and the action errors explicitly on a tagless channel.
Stack created with GitHub Stacks CLI • Give Feedback 💬