diff --git a/.github/actions/rust-ci-setup/action.yml b/.github/actions/rust-ci-setup/action.yml index 22de029b97..df80857be5 100644 --- a/.github/actions/rust-ci-setup/action.yml +++ b/.github/actions/rust-ci-setup/action.yml @@ -23,6 +23,26 @@ outputs: runs: using: composite steps: + # The shared target is 24 GB unpacked (warm run 41193606500 at f0f786d19, 2026-10-31: 24G + # after pruning 5.79 GB of test executables), restored beside its 5 GiB download, and a crate + # job builds its tests on top. Two runner images are in rotation while ubuntu-latest moves to + # 26.04 (from 2026-10-19). The 24.04 image's root disk ran out mid-setup and mid-build on + # 10-31 (#5638, #5649 twice, #5641: "No space left on device"); it has a separate scratch disk + # at /mnt. The 26.04 image has one disk: 145G, 87G free (measured on #5650's run). The build + # goes on whichever disk has more room, at ONE path, so the cache restores and saves the same + # way on both images. + - name: Build where the runner has room + shell: bash + run: | + sudo install -d -o "$(id -u)" -g "$(id -g)" /ci-target + root_free=$(df --output=avail -B1 / | tail -1) + if mountpoint -q /mnt && [ "$(df --output=avail -B1 /mnt | tail -1)" -gt "$root_free" ]; then + sudo install -d -o "$(id -u)" -g "$(id -g)" /mnt/ci-target + sudo mount --bind /mnt/ci-target /ci-target + fi + echo "CARGO_TARGET_DIR=/ci-target" >> "$GITHUB_ENV" + df -h / /ci-target + - name: Install Rust toolchain from rust-toolchain.toml shell: bash run: | @@ -95,7 +115,7 @@ runs: uses: actions/cache/restore@v4 with: path: | - target + /ci-target ~/.cargo/registry/index ~/.cargo/registry/cache ~/.cargo/git/db diff --git a/.github/workflows/rust-warm-cache.yml b/.github/workflows/rust-warm-cache.yml index 5d1be187b5..61ad9177ce 100644 --- a/.github/workflows/rust-warm-cache.yml +++ b/.github/workflows/rust-warm-cache.yml @@ -54,12 +54,13 @@ jobs: core_features=$(node -p 'require("./tools/scripts/ci-change-scope.cjs").TEST_FEATURES["continuum-core"]') cargo test --locked -p continuum-core --bin continuum --profile dev-fast --features "$core_features" --no-run --message-format=json >> warm.jsonl node tools/scripts/ci-cargo-freshness.cjs prune-test-executables warm.jsonl - du -sh target ~/.cargo/registry ~/.cargo/git + du -sh "$CARGO_TARGET_DIR" ~/.cargo/registry ~/.cargo/git + df -h / "$CARGO_TARGET_DIR" - name: Save the shared target cache uses: actions/cache/save@v4 with: path: | - target + /ci-target ~/.cargo/registry/index ~/.cargo/registry/cache ~/.cargo/git/db diff --git a/tools/scripts/ci-cargo-freshness.cjs b/tools/scripts/ci-cargo-freshness.cjs index b9734a878e..a54747e965 100644 --- a/tools/scripts/ci-cargo-freshness.cjs +++ b/tools/scripts/ci-cargo-freshness.cjs @@ -124,7 +124,8 @@ function settle({ root, prefix, matchedKey, cargoHome, crateDirs, log = console. return { settled: false }; } const work = plan(entries, { kind: kindOf(root), crateDirs }); - const count = settleTree(root, SETTLED, new Set(['.git', 'target'])); + // The build lives outside the tree (CARGO_TARGET_DIR=/ci-target, rust-ci-setup). + const count = settleTree(root, SETTLED, new Set(['.git'])); const touch = p => { const full = path.join(root, p); setTime(full, { isSymbolicLink: () => fs.lstatSync(full).isSymbolicLink() }, now); }; work.files.forEach(touch); work.dirs.forEach(touch); @@ -133,7 +134,7 @@ function settle({ root, prefix, matchedKey, cargoHome, crateDirs, log = console. for (const crate of work.crates) { walk(path.join(root, crate), (full, entry) => { if (!entry.isDirectory() && full.endsWith('.rs')) { setTime(full, entry, now); crateSources++; } - }, new Set(['target'])); + }); } log(`Cache commit ${commit}: settled ${count} workspace entries; ${entries.length} paths differ -> ` + `${work.files.length} files, ${work.trees.length} submodules, ${work.dirs.length} directories of deletions, `