From 7569b26a7e373f87a23a9c147e443de05c0225c1 Mon Sep 17 00:00:00 2001 From: GraveYield Date: Sat, 16 May 2026 06:33:17 +0800 Subject: [PATCH] fix(ci): use cargo install instead of cargo-binstall for anchor-cli Symptom on every anchor-build run since PR #15: Run set -o pipefail /home/runner/work/_temp/...sh: line 2: anchor: command not found Error: Process completed with exit code 127. Root cause: cargo-binstall (cargo-bins/cargo-binstall@main) exited 0 without installing `anchor` on PATH. anchor-cli 0.32.1 has no binstall-compatible prebuilt release pattern that the action's heuristics recognise; --no-confirm promoted the silent-no-op into a clean exit rather than an error, so the next step (`anchor build`) ran with anchor missing and hit exit 127. Fix: install anchor-cli via `cargo install --locked --version 0.32.1 anchor-cli` and assert with `anchor --version`. Source compile is ~5-7 min on a cold cache but is cached by Swatinem/rust-cache@v2 already in this job, so steady-state CI time is unchanged. The explicit version check fails the install step itself on any future regression instead of deferring to the build step. No code changes. No toolchain changes. Single CI workflow edit. Co-Authored-By: Claude Opus 4.7 --- .github/workflows/ci.yml | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 08336ab..2dacf29 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -61,14 +61,24 @@ jobs: run: | sh -c "$(curl -sSfL https://release.anza.xyz/v${SOLANA_VERSION}/install)" echo "$HOME/.local/share/solana/install/active_release/bin" >> "$GITHUB_PATH" - # cargo-binstall fetches a prebuilt anchor-cli binary in ~10s instead - # of compiling from source (~5-7 min, which has been intermittently - # cancelled on ubuntu-latest runners during the dependency-fetch - # phase). Drops total anchor-build job time from ~10 min to ~2 min. - - name: Install cargo-binstall - uses: cargo-bins/cargo-binstall@main + # cargo-binstall was the original choice for speed but proved + # unreliable for anchor-cli 0.32.1: it exited 0 without installing + # `anchor` on PATH, leaving "anchor: command not found" at the + # build step (exit 127). Most likely cause: anchor-cli 0.32.1 has + # no binstall-compatible prebuilt release pattern that + # cargo-binstall@main recognises, and the silent-no-op exits 0 + # under --no-confirm rather than promoting to an error. + # + # `cargo install` from source takes ~5-7 min on a cold cache but is + # cached by Swatinem/rust-cache@v2 and reliably produces an + # `anchor` binary in ~/.cargo/bin (which dtolnay/rust-toolchain + # adds to GITHUB_PATH). The `anchor --version` line is an explicit + # post-install assertion so any future regression fails here + # rather than at the build step. - name: Install Anchor CLI - run: cargo binstall --no-confirm --version ${ANCHOR_VERSION} anchor-cli + run: | + cargo install --locked --version ${ANCHOR_VERSION} anchor-cli + anchor --version # Capture anchor build's full output to a file and upload it as a # workflow artifact when the job fails — needed because the actual # error message is otherwise only visible via the GitHub Actions