From 0b8e1e9cf4db53ef4e05eeb40d9986a5a074c8a2 Mon Sep 17 00:00:00 2001 From: vivekgsharma Date: Tue, 19 May 2026 15:46:36 +0700 Subject: [PATCH] ci: prune macOS coverage artifacts --- .github/workflows/tests-rs-workspace.yml | 33 +++++++++++++++++++----- 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/.github/workflows/tests-rs-workspace.yml b/.github/workflows/tests-rs-workspace.yml index da12883086..27e9d99906 100644 --- a/.github/workflows/tests-rs-workspace.yml +++ b/.github/workflows/tests-rs-workspace.yml @@ -21,14 +21,27 @@ jobs: with: clean: false - - name: Clean target if too large + - name: Prune macOS runner disk before tests run: | - SIZE=$(du -sm target 2>/dev/null | cut -f1 || true) + for path in ../target-backup-before-*-clean-* target/llvm-cov-target; do + if [ -e "$path" ]; then + echo "Removing stale runner artifact: $path" + rm -rf "$path" + fi + done + + TARGET_MAX_MB=120000 + MIN_FREE_MB=60000 + SIZE=$(du -sm target 2>/dev/null | awk '{print $1}' || echo 0) + FREE=$(df -m . | awk 'NR == 2 {print $4}') SIZE=${SIZE:-0} + FREE=${FREE:-0} + echo "target/ size: ${SIZE}MB" - if [ "$SIZE" -gt 200000 ]; then - echo "target/ exceeds 200GB — cleaning" - cargo clean + echo "available disk: ${FREE}MB" + if [ "$SIZE" -gt "$TARGET_MAX_MB" ] || [ "$FREE" -lt "$MIN_FREE_MB" ]; then + echo "target/ exceeds ${TARGET_MAX_MB}MB or disk is below ${MIN_FREE_MB}MB free; removing target/" + rm -rf target fi - name: Install build dependencies @@ -212,6 +225,15 @@ jobs: token: ${{ secrets.CODECOV_TOKEN }} fail_ci_if_error: false + - name: Remove cargo-llvm-cov build artifacts + if: always() + run: | + if [ -d target/llvm-cov-target ]; then + du -sh target/llvm-cov-target || true + rm -rf target/llvm-cov-target + fi + du -sh target 2>/dev/null || true + - name: Run doctests if: ${{ inputs.doctests-changed }} run: | @@ -530,4 +552,3 @@ jobs: fi done echo "No immutable/append_only structure violations found" -