diff --git a/.github/workflows/anchor.yml b/.github/workflows/anchor.yml index 84a00422..829932cf 100644 --- a/.github/workflows/anchor.yml +++ b/.github/workflows/anchor.yml @@ -169,12 +169,44 @@ jobs: restore-keys: | cargo-${{ runner.os }}- - uses: pnpm/action-setup@v4 - - uses: heyAyushh/setup-anchor@v4.999 + # Replaces heyAyushh/setup-anchor@v4.999. That action's version-detection step + # runs `anchor --version | awk '{print $2}'` and writes the result straight to + # $GITHUB_OUTPUT. `anchor --version` now prints more than one line, so the value + # becomes multi-line and the step dies with "Invalid format", aborting the whole + # job before any project is built. These steps install the same toolchain (Solana + # via the Anza installer, Anchor via avm) and read the version from the first line + # only. The other workflows that use setup-anchor (native, quasar, pinocchio, + # solana-asm) hit the same latent bug once their matrices run; migrate them the + # same way once this is confirmed green. + - uses: actions/setup-node@v4 with: + node-version: lts/* + - name: Install Solana CLI + run: | + sh -c "$(curl -sSfL https://release.anza.xyz/v3.1.14/install)" + echo "$HOME/.local/share/solana/install/active_release/bin" >> "$GITHUB_PATH" + - name: Cache Anchor toolchain + uses: actions/cache@v4 + with: + path: | + ~/.cargo/bin/anchor + ~/.cargo/bin/avm + ~/.avm # Pinned to match the anchor-lang/anchor-spl crate version the programs depend on. - anchor-version: 1.1.2 - # setup-anchor resolves tags like stable by querying GitHub API for latest release which can fail with 429 errors - solana-cli-version: 3.1.14 + key: anchor-toolchain-${{ runner.os }}-1.1.2 + - name: Install Anchor 1.1.2 + run: | + export PATH="$HOME/.cargo/bin:$HOME/.avm/bin:$PATH" + # `anchor --version` can emit more than one line; read the first line only so + # a multi-line value never reaches downstream parsing. + current="$(anchor --version 2>/dev/null | head -n1 | awk '{print $2}' || true)" + if [ "$current" != "1.1.2" ]; then + cargo install --git https://github.com/coral-xyz/anchor avm --force + avm install 1.1.2 + avm use 1.1.2 + fi + echo "$HOME/.cargo/bin" >> "$GITHUB_PATH" + echo "$HOME/.avm/bin" >> "$GITHUB_PATH" - name: Install Surfpool run: curl -sL https://run.surfpool.run/ | bash - name: Display Versions