|
17 | 17 | MIN_PROJECTS_FOR_MATRIX: 4 |
18 | 18 | # See https://github.blog/changelog/2025-09-19-deprecation-of-node-20-on-github-actions-runners/ |
19 | 19 | FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true |
| 20 | + # Harden cargo against transient crates.io index fetch failures that flake |
| 21 | + # cargo build-sbf ("failed to get <crate> as a dependency"). |
| 22 | + CARGO_NET_RETRY: "10" |
| 23 | + CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse |
20 | 24 |
|
21 | 25 | jobs: |
22 | 26 | changes: |
@@ -109,7 +113,7 @@ jobs: |
109 | 113 | - uses: pnpm/action-setup@v4 |
110 | 114 | - uses: heyAyushh/setup-anchor@v4.999 |
111 | 115 | with: |
112 | | - anchor-version: 0.32.1 |
| 116 | + anchor-version: 1.0.2 |
113 | 117 | solana-cli-version: stable |
114 | 118 | - name: Display Versions |
115 | 119 | run: | |
@@ -137,16 +141,31 @@ jobs: |
137 | 141 | fi |
138 | 142 |
|
139 | 143 | # Run anchor build |
140 | | - if ! anchor build; then |
| 144 | + # --ignore-keys: most examples don't commit program keypairs, so CI |
| 145 | + # generates ephemeral ones that won't match the source declare_id! |
| 146 | + # Retry to ride out transient crates.io index fetch failures. |
| 147 | + build_ok=false |
| 148 | + for attempt in 1 2 3; do |
| 149 | + if anchor build --ignore-keys; then |
| 150 | + build_ok=true |
| 151 | + break |
| 152 | + fi |
| 153 | + echo "anchor build attempt $attempt failed for $project; retrying" |
| 154 | + done |
| 155 | + if [ "$build_ok" != "true" ]; then |
141 | 156 | echo "::error::anchor build failed for $project" |
142 | 157 | echo "$project: anchor build failed" >> $GITHUB_WORKSPACE/failed_projects.txt |
143 | 158 | rm -rf target |
144 | 159 | cd - > /dev/null |
145 | 160 | return 1 |
146 | 161 | fi |
147 | 162 |
|
| 163 | + # Align declare_id! and Anchor.toml with the ephemeral keypair |
| 164 | + anchor keys sync |
| 165 | +
|
148 | 166 | # Run anchor test |
149 | | - if ! anchor test; then |
| 167 | + # --validator legacy: surfpool (the Anchor 1.0 default) isn't installed in CI |
| 168 | + if ! anchor test --validator legacy; then |
150 | 169 | echo "::error::anchor test failed for $project" |
151 | 170 | echo "$project: anchor test failed" >> $GITHUB_WORKSPACE/failed_projects.txt |
152 | 171 | rm -rf target node_modules |
|
0 commit comments