Skip to content

Commit cb84da6

Browse files
authored
Merge pull request #3306 from ProvableHQ/ci/proactive_cache_reset
[CI] Proactive cache reset
2 parents 5c9a180 + fef52e9 commit cb84da6

1 file changed

Lines changed: 73 additions & 39 deletions

File tree

.circleci/config.yml

Lines changed: 73 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ commands:
9090
parameters:
9191
cache_key:
9292
type: string
93-
default: v4.7.2-rust-1.88.0-snarkvm-cache
93+
default: v4.7.3-rust-1.88.0-snarkvm-cache
9494
steps:
9595
- run:
9696
name: Prepare environment variables and install dependencies
@@ -134,8 +134,8 @@ commands:
134134
clang libclang-dev llvm-dev llvm lld pkg-config xz-utils make libssl-dev
135135
- restore_cache:
136136
keys:
137-
- v4.7.2-rust-1.88.0-deps-{{ checksum "Cargo.lock" }}-
138-
- v4.7.2-rust-1.88.0-deps-
137+
- v4.7.3-rust-1.88.0-deps-{{ checksum "Cargo.lock" }}-
138+
- v4.7.3-rust-1.88.0-deps-
139139
- restore_cache:
140140
keys:
141141
- << parameters.cache_key >>
@@ -145,11 +145,11 @@ commands:
145145
parameters:
146146
cache_key:
147147
type: string
148-
default: v4.7.2-rust-1.88.0-snarkvm-cache
148+
default: v4.7.3-rust-1.88.0-snarkvm-cache
149149
steps:
150150
- run: set +e
151151
- save_cache:
152-
key: v4.7.2-rust-1.88.0-deps-{{ checksum "Cargo.lock" }}
152+
key: v4.7.3-rust-1.88.0-deps-{{ checksum "Cargo.lock" }}
153153
paths:
154154
- /home/circleci/.cache/sccache
155155
- /home/circleci/.cargo/registry
@@ -188,7 +188,7 @@ commands:
188188
condition: << parameters.use_cache >>
189189
steps:
190190
- setup_environment:
191-
cache_key: v4.7.2-rust-1.88.0-<< parameters.workspace_member >><< parameters.cache_key_suffix >>-cache
191+
cache_key: v4.7.3-rust-1.88.0-<< parameters.workspace_member >><< parameters.cache_key_suffix >>-cache
192192

193193
- run:
194194
name: Install debian packages (always)
@@ -301,7 +301,7 @@ commands:
301301
302302
WSM="<< parameters.workspace_member >>"
303303
304-
# Remove any --test target flags,they cause nextest build errors
304+
# Remove any --test target flags, they cause nextest build errors
305305
BUILD_FLAGS_SANITIZED="$(printf '%s' "$BUILD_FLAGS" \
306306
| sed -E "s/(^|[[:space:]])--test[[:space:]]+'[^']*'([[:space:]]|$)/ /g" \
307307
| sed -E 's/(^|[[:space:]])--test[[:space:]]+\"[^\"]*\"([[:space:]]|$)/ /g' \
@@ -387,10 +387,12 @@ commands:
387387
echo "==> test-threads override: ${TEST_THREADS:-<none>}"
388388
echo "==> jobs: ${JOBS}"
389389
390+
# Intercept compilation failure to catch sccache exit status 2
391+
FAILED=0
390392
# Use plain cargo test if --no-run was requested
391393
# Otherwise, run tests with cargo nextest
392394
if printf '%s' " $BUILD_FLAGS_SANITIZED " | grep -q ' --no-run '; then
393-
RUST_MIN_STACK=67108864 cargo test --package="<< parameters.workspace_member >>" $BUILD_FLAGS_SANITIZED | tee "$OUT"
395+
RUST_MIN_STACK=67108864 cargo test --package="<< parameters.workspace_member >>" $BUILD_FLAGS_SANITIZED 2>&1 | tee "$OUT" || FAILED=1
394396
: > "$CSV"; : > "$TOP"
395397
else
396398
rm -rf target
@@ -401,25 +403,57 @@ commands:
401403
--status-level fail --hide-progress-bar \
402404
--no-tests=pass \
403405
${FILTER_EXPR:+--filter-expr "$FILTER_EXPR"} \
404-
2>&1 | tee "$OUT"
405-
406-
if [ -f "$JUNIT" ]; then
407-
awk -v RS='<testcase ' '
408-
NR>1 {
409-
name=""; classname=""; time="";
410-
start=index($0,"classname=\""); if(start>0){ start+=11; rest=substr($0,start); end=index(rest,"\""); if(end>0) classname=substr(rest,1,end-1) }
411-
start=index($0,"name=\""); if(start>0){ start+=6; rest=substr($0,start); end=index(rest,"\""); if(end>0) name=substr(rest,1,end-1) }
412-
start=index($0,"time=\""); if(start>0){ start+=6; rest=substr($0,start); end=index(rest,"\""); if(end>0) time=substr(rest,1,end-1) }
413-
if(name!="" && time!=""){ full=(classname!=""?classname"::"name:name); printf "%s,%s\n", full, time }
414-
}
415-
' "$JUNIT" > "$CSV" || true
416-
417-
sort -t, -k2,2nr "$CSV" | head -n 30 > "$TOP" || true
406+
2>&1 | tee "$OUT" || FAILED=1
407+
fi
408+
409+
# Check if execution failed specifically due to sccache crash
410+
if [ "$FAILED" -ne 0 ]; then
411+
if grep -q "sccache" "$OUT" && grep -q "exit status: 2" "$OUT"; then
412+
echo "⚠️ Detected sccache compilation crash! Wiping local cache and retrying cleanly..."
413+
414+
"$CIRCLE_WORKING_DIRECTORY/.bin/sccache" --stop-server || true
415+
rm -rf /home/circleci/.cache/sccache
416+
rm -rf target
417+
rm -rf /home/circleci/.cargo/registry/index/*
418+
"$CIRCLE_WORKING_DIRECTORY/.bin/sccache" --zero-stats || true
419+
420+
echo "🔄 Retrying test execution..."
421+
if printf '%s' " $BUILD_FLAGS_SANITIZED " | grep -q ' --no-run '; then
422+
RUST_MIN_STACK=67108864 cargo test --package="<< parameters.workspace_member >>" $BUILD_FLAGS_SANITIZED 2>&1 | tee "$OUT"
423+
: > "$CSV"; : > "$TOP"
424+
else
425+
RUST_MIN_STACK=67108864 \
426+
cargo nextest run \
427+
-p "<< parameters.workspace_member >>" $BUILD_FLAGS_SANITIZED \
428+
--profile ci -j "${JOBS}" "${CFG_ARGS[@]}" \
429+
--status-level fail --hide-progress-bar \
430+
--no-tests=pass \
431+
${FILTER_EXPR:+--filter-expr "$FILTER_EXPR"} \
432+
2>&1 | tee "$OUT"
433+
fi
418434
else
419-
echo "WARN: $JUNIT not found; no timings extracted." >&2
420-
: > "$CSV"; : > "$TOP"
435+
echo "❌ Build failed due to legitimate code errors or test failure. Exiting."
436+
exit 1
421437
fi
422438
fi
439+
# =========================================================================
440+
441+
if [ -f "$JUNIT" ]; then
442+
awk -v RS='<testcase ' '
443+
NR>1 {
444+
name=""; classname=""; time="";
445+
start=index($0,"classname=\""); if(start>0){ start+=11; rest=substr($0,start); end=index(rest,"\""); if(end>0) classname=substr(rest,1,end-1) }
446+
start=index($0,"name=\""); if(start>0){ start+=6; rest=substr($0,start); end=index(rest,"\""); if(end>0) name=substr(rest,1,end-1) }
447+
start=index($0,"time=\""); if(start>0){ start+=6; rest=substr($0,start); end=index(rest,"\""); if(end>0) time=substr(rest,1,end-1) }
448+
if(name!="" && time!=""){ full=(classname!=""?classname"::"name:name); printf "%s,%s\n", full, time }
449+
}
450+
' "$JUNIT" > "$CSV" || true
451+
452+
sort -t, -k2,2nr "$CSV" | head -n 30 > "$TOP" || true
453+
else
454+
echo "WARN: $JUNIT not found; no timings extracted." >&2
455+
: > "$CSV"; : > "$TOP"
456+
fi
423457
424458
if [ "$USE_CACHE" = "true" ]; then
425459
echo "[sccache stats AFTER nextest]"
@@ -436,7 +470,7 @@ commands:
436470
condition: << parameters.use_cache >>
437471
steps:
438472
- clear_environment:
439-
cache_key: v4.7.2-rust-1.88.0-<< parameters.workspace_member >><< parameters.cache_key_suffix >>-cache
473+
cache_key: v4.7.3-rust-1.88.0-<< parameters.workspace_member >><< parameters.cache_key_suffix >>-cache
440474

441475
install_rust_nightly:
442476
description: "Install Rust nightly toolchain"
@@ -1059,7 +1093,7 @@ jobs:
10591093
steps:
10601094
- checkout
10611095
- setup_environment:
1062-
cache_key: v4.7.2-rust-1.88.0-snarkvm-wasm-cache
1096+
cache_key: v4.7.3-rust-1.88.0-snarkvm-wasm-cache
10631097
- run:
10641098
no_output_timeout: 30m
10651099
command: |
@@ -1080,7 +1114,7 @@ jobs:
10801114
# Run the tests
10811115
cd wasm && wasm-pack test --node
10821116
- clear_environment:
1083-
cache_key: v4.7.2-rust-1.88.0-snarkvm-wasm-cache
1117+
cache_key: v4.7.3-rust-1.88.0-snarkvm-wasm-cache
10841118

10851119
check-fmt:
10861120
executor: rust-docker
@@ -1089,21 +1123,21 @@ jobs:
10891123
- checkout
10901124
- install_rust_nightly
10911125
- setup_environment:
1092-
cache_key: v4.7.2-rust-1.88.0-snarkvm-fmt-cache
1126+
cache_key: v4.7.3-rust-1.88.0-snarkvm-fmt-cache
10931127
- run:
10941128
name: Check style
10951129
no_output_timeout: 35m
10961130
command: cargo +nightly fmt --all -- --check
10971131
- clear_environment:
1098-
cache_key: v4.7.2-rust-1.88.0-snarkvm-fmt-cache
1132+
cache_key: v4.7.3-rust-1.88.0-snarkvm-fmt-cache
10991133

11001134
check-unused-dependencies:
11011135
executor: rust-docker
11021136
resource_class: << pipeline.parameters.medium >>
11031137
steps:
11041138
- checkout
11051139
- setup_environment:
1106-
cache_key: v4.7.2-rust-1.88.0-machete-cache
1140+
cache_key: v4.7.3-rust-1.88.0-machete-cache
11071141
- run:
11081142
name: Check for unused dependencies
11091143
no_output_timeout: 10m
@@ -1114,23 +1148,23 @@ jobs:
11141148
fi
11151149
cargo machete
11161150
- clear_environment:
1117-
cache_key: v4.7.2-rust-1.88.0-machete-cache
1151+
cache_key: v4.7.3-rust-1.88.0-machete-cache
11181152

11191153
check-cargo-audit:
11201154
executor: rust-docker
11211155
resource_class: << pipeline.parameters.medium >>
11221156
steps:
11231157
- checkout
11241158
- setup_environment:
1125-
cache_key: v4.7.2-rust-1.88.0-cargo-audit-cache
1159+
cache_key: v4.7.3-rust-1.88.0-cargo-audit-cache
11261160
- run:
11271161
name: Check for security vulnerabilities
11281162
no_output_timeout: 10m
11291163
command: |
11301164
cargo install cargo-audit@0.22.0 --locked --force
11311165
cargo audit -D warnings
11321166
- clear_environment:
1133-
cache_key: v4.7.2-rust-1.88.0-cargo-audit-cache
1167+
cache_key: v4.7.3-rust-1.88.0-cargo-audit-cache
11341168

11351169
check-cargo-semver-checks:
11361170
executor: rust-docker
@@ -1139,22 +1173,22 @@ jobs:
11391173
- checkout:
11401174
method: full
11411175
- setup_environment:
1142-
cache_key: v4.7.2-rust-1.88.0-cargo-semver-checks-cache
1176+
cache_key: v4.7.3-rust-1.88.0-cargo-semver-checks-cache
11431177
- run:
11441178
name: Check for semver violations
11451179
no_output_timeout: 15m
11461180
command: |
11471181
bash ./.circleci/semver-checks.sh
11481182
- clear_environment:
1149-
cache_key: v4.7.2-rust-1.88.0-cargo-semver-checks-cache
1183+
cache_key: v4.7.3-rust-1.88.0-cargo-semver-checks-cache
11501184

11511185
check-clippy:
11521186
executor: rust-docker
11531187
resource_class: << pipeline.parameters.xlarge >>
11541188
steps:
11551189
- checkout
11561190
- setup_environment:
1157-
cache_key: v4.7.2-rust-1.88.0-snarkvm-clippy-cache
1191+
cache_key: v4.7.3-rust-1.88.0-snarkvm-clippy-cache
11581192
- run:
11591193
name: Check Clippy (default features)
11601194
timeout: 20m
@@ -1166,21 +1200,21 @@ jobs:
11661200
command: |
11671201
cargo clippy --workspace --all-targets --all-features -- -D warnings
11681202
- clear_environment:
1169-
cache_key: v4.7.2-rust-1.88.0-snarkvm-clippy-cache
1203+
cache_key: v4.7.3-rust-1.88.0-snarkvm-clippy-cache
11701204

11711205
check-all-targets:
11721206
executor: rust-docker
11731207
resource_class: << pipeline.parameters.small >>
11741208
steps:
11751209
- checkout
11761210
- setup_environment:
1177-
cache_key: v4.7.2-rust-1.88.0-snarkvm-all-targets-cache
1211+
cache_key: v4.7.3-rust-1.88.0-snarkvm-all-targets-cache
11781212
- run:
11791213
name: Check all targets
11801214
no_output_timeout: 35m
11811215
command: cargo check --release --workspace --all-targets
11821216
- clear_environment:
1183-
cache_key: v4.7.2-rust-1.88.0-snarkvm-all-targets-cache
1217+
cache_key: v4.7.3-rust-1.88.0-snarkvm-all-targets-cache
11841218

11851219
verify-windows:
11861220
executor:

0 commit comments

Comments
 (0)