fix(ci): add intra-cache-key cleanup, switch tests to debug mode

Two root causes from pipeline 2480888929:

1. /cache volume bloat — kurditv hit 93G/96G (97% full). The before_script
   pruned old cache KEYS but never cleaned other job dirs within the SAME key.
   Old test-partition-1/, test-partition-2/, wasm-check/, … accumulated across
   pipelines alongside the new test-release/ dir, filling the volume.
   Fix: add a second find that removes every sibling dir in CACHE_KEY/ except
   the current job's dir. .test-base keeps only test-release/; wasm-check keeps
   only wasm-check/. Each pipeline run starts with a clean slate per job type.

2. Release builds exceeded 300m — vps3 was still compiling
   pezbridge-hub-zagros-runtime at minute 300 in --release mode.
   Clippy (debug) took 162m cold; release mode is 2-3x slower.
   Fix: remove --release from all cargo nextest run commands. RUSTFLAGS already
   includes -Cdebug-assertions=y so assertion coverage is identical. Debug
   artifacts are smaller (less disk pressure) and compile faster.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Kurdistan Tech MinistryandClaude Sonnet 4.6 committed 2026-04-27 11:03:43 +03:00
1 parent 0354c96a84
commit 1486a3c2c8
1 file changed
+16 -8
+16 -8
View File
@@ -375,11 +375,17 @@ cargo-audit:
# cargo fingerprinting handles different feature sets within the same dir.
- export CARGO_TARGET_DIR="/cache/cargo-target/${CACHE_KEY}/test-release"
- mkdir -p "$CARGO_TARGET_DIR"
# Remove dirs with outdated cache keys (e.g. old Cargo.lock)
- find /cache/cargo-target -mindepth 1 -maxdepth 1 -type d ! -name "${CACHE_KEY}" -exec rm -rf {} + 2>/dev/null || true
# Remove other job dirs within the SAME cache key — keeps only test-release.
# Previous per-job dirs (test-partition-1, test-no-try-runtime-2, …) accumulate
# and fill the /cache volume. One shared dir is all we need.
- find /cache/cargo-target/"${CACHE_KEY}" -mindepth 1 -maxdepth 1 -type d ! -name "test-release" -exec rm -rf {} + 2>/dev/null || true
- echo "CARGO_TARGET_DIR=$CARGO_TARGET_DIR (disk $(df -h /cache/cargo-target | tail -1 | awk '{print $3 "/" $2 " used, " $4 " free"}'))"
cache: []
# 300m: cold release build on VPS (jemalloc+rocksdb C compilation) can take 3h+.
# Warm cache (second run on same runner) completes in ~30m.
# 300m: cold debug build on VPS can still take 2-3h (first run after cache change).
# Warm cache completes in ~45m. Debug mode compiles 2-3x faster than --release
# while -Cdebug-assertions=y (set in RUSTFLAGS) keeps the same assertion coverage.
timeout: 300m
retry:
max: 1
@@ -398,7 +404,7 @@ test-partition-1:
- git config --global --add safe.directory '*'
- |
cargo nextest run \
--workspace --locked --release --no-fail-fast --cargo-quiet \
--workspace --locked --no-fail-fast --cargo-quiet \
--features try-runtime,experimental,ci-only-tests \
--partition count:1/3
artifacts:
@@ -414,7 +420,7 @@ test-partition-2:
- git config --global --add safe.directory '*'
- |
cargo nextest run \
--workspace --locked --release --no-fail-fast --cargo-quiet \
--workspace --locked --no-fail-fast --cargo-quiet \
--features try-runtime,experimental,ci-only-tests \
--partition count:2/3
artifacts:
@@ -430,7 +436,7 @@ test-partition-3:
- git config --global --add safe.directory '*'
- |
cargo nextest run \
--workspace --locked --release --no-fail-fast --cargo-quiet \
--workspace --locked --no-fail-fast --cargo-quiet \
--features try-runtime,experimental,ci-only-tests \
--partition count:3/3
# First partition also runs runtime-api tests
@@ -448,7 +454,7 @@ test-no-try-runtime-1:
- git config --global --add safe.directory '*'
- |
cargo nextest run \
--workspace --locked --release --no-fail-fast --cargo-quiet \
--workspace --locked --no-fail-fast --cargo-quiet \
--features experimental,ci-only-tests \
--partition count:1/2
@@ -458,7 +464,7 @@ test-no-try-runtime-2:
- git config --global --add safe.directory '*'
- |
cargo nextest run \
--workspace --locked --release --no-fail-fast --cargo-quiet \
--workspace --locked --no-fail-fast --cargo-quiet \
--features experimental,ci-only-tests \
--partition count:2/2
@@ -476,7 +482,9 @@ wasm-check:
- export CARGO_TARGET_DIR="/cache/cargo-target/${CACHE_KEY}/${CI_JOB_NAME}"
- mkdir -p "$CARGO_TARGET_DIR"
- find /cache/cargo-target -mindepth 1 -maxdepth 1 -type d ! -name "${CACHE_KEY}" -exec rm -rf {} + 2>/dev/null || true
- echo "CARGO_TARGET_DIR=$CARGO_TARGET_DIR"
# Keep only wasm-check dir; remove test-release and any other stale dirs
- find /cache/cargo-target/"${CACHE_KEY}" -mindepth 1 -maxdepth 1 -type d ! -name "${CI_JOB_NAME}" -exec rm -rf {} + 2>/dev/null || true
- echo "CARGO_TARGET_DIR=$CARGO_TARGET_DIR (disk $(df -h /cache/cargo-target | tail -1 | awk '{print $3 "/" $2 " used, " $4 " free"}'))"
cache: []
timeout: 2h
retry: