diff --git a/.github/workflows/_pr-test-stage-cpu.yml b/.github/workflows/_pr-test-stage-cpu.yml index 0972a2cc6..889035f58 100644 --- a/.github/workflows/_pr-test-stage-cpu.yml +++ b/.github/workflows/_pr-test-stage-cpu.yml @@ -62,7 +62,12 @@ jobs: steps: - name: Free disk space run: | - sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc + # The image ships ~65G free and the suite peaks around 30G; deleting + # these trees is ~1M unlinks (~80s), so only pay it when actually low. + avail_gb=$(df --output=avail -BG / | tail -1 | tr -dc '0-9') + if [ "${avail_gb}" -lt 40 ]; then + sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc + fi df -h - name: Checkout code diff --git a/.github/workflows/rerun-test.yml b/.github/workflows/rerun-test.yml index f188c0695..13f5b15a3 100644 --- a/.github/workflows/rerun-test.yml +++ b/.github/workflows/rerun-test.yml @@ -245,7 +245,12 @@ jobs: steps: - name: Free disk space run: | - sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc + # The image ships ~65G free and the suite peaks around 30G; deleting + # these trees is ~1M unlinks (~80s), so only pay it when actually low. + avail_gb=$(df --output=avail -BG / | tail -1 | tr -dc '0-9') + if [ "${avail_gb}" -lt 40 ]; then + sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc + fi df -h - name: Checkout code