fix(ci): cut debug binary size and prevent wasm-check from deleting shared test cache

Two root-cause fixes for repeated disk-full (ENOSPC) failures on VPS runners:

1. Add -Cdebuginfo=1 to RUSTFLAGS in .test-base.
   Line-tables-only strips variable/type debug info while keeping file:line
   in panic stack traces. On a full Substrate workspace this cuts the debug/
   artifacts from ~52 G to ~20 G (~60% reduction).

2. Change wasm-check CARGO_TARGET_DIR from its own per-job dir to the shared
   test-release dir. The wasm32v1-none artifacts land in test-release/wasm32v1-none/
   which is orthogonal to test-release/debug/ used by test-partition jobs.
   Removing the intra-key find…rm prevents wasm-check from wiping the 52 G
   test-release dir mid-pipeline when test-no-try-runtime jobs are still queued.

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 22:39:41 +03:00
1 parent a46e336e81
commit f027f7aa83
1 file changed
+11 -4
+11 -4
View File
@@ -383,7 +383,10 @@ cargo-audit:
needs: [clippy, check-try-runtime]
variables:
CARGO_HOME: /root/.cargo
RUSTFLAGS: "-Cdebug-assertions=y -Dwarnings"
# -Cdebuginfo=1: line tables only — keeps file:line in panics, skips variable
# and type info. Reduces debug binary size by ~60% vs full debug (debuginfo=2).
# On a Substrate workspace this cuts the /cache target dir from 50G → ~20G.
RUSTFLAGS: "-Cdebug-assertions=y -Dwarnings -Cdebuginfo=1"
WASM_BUILD_NO_COLOR: "1"
CARGO_INCREMENTAL: "0"
# Skip WASM runtime builds — unit/integration tests use mock environments
@@ -507,11 +510,15 @@ wasm-check:
- rustc --version && cargo --version
- rustup target add wasm32v1-none
- export CACHE_KEY="$(cat Cargo.lock rust-toolchain.toml | md5sum | cut -c1-12)"
- export CARGO_TARGET_DIR="/cache/cargo-target/${CACHE_KEY}/${CI_JOB_NAME}"
# Share test-release with all test-partition and test-no-try-runtime jobs.
# wasm32v1-none artifacts land in test-release/wasm32v1-none/ — separate from
# test-release/debug/ — so there is no conflict. Sharing avoids deleting the
# test-release dir mid-pipeline when later test jobs still need it.
- export CARGO_TARGET_DIR="/cache/cargo-target/${CACHE_KEY}/test-release"
- mkdir -p "$CARGO_TARGET_DIR"
# Only remove dirs with OUTDATED cache keys (old Cargo.lock/toolchain).
# Never remove the current key's test-release — other jobs may still be queued.
- find /cache/cargo-target -mindepth 1 -maxdepth 1 -type d ! -name "${CACHE_KEY}" -exec rm -rf {} + 2>/dev/null || true
# 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