diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 46b4707b..04d76887 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -17,7 +17,6 @@ permissions: env: PANTS_CONFIG_FILES: "pants.ci.toml" - jobs: test: name: Test @@ -48,5 +47,13 @@ jobs: - name: Run tests run: | pants test --use-coverage :: - - name: Run codecov - uses: codecov/codecov-action@v3 + delete-cache-if-too-big: + name: delete-cache + runs-on: ubuntu-latest + strategy: + fail-fast: false + steps: + - name: Delete cache if too big + run: | + delete_cache_if_too_big ~/.cache/nce 512 + delete_cache_if_too_big ~/.cache/pants/named_caches 1024 diff --git a/delete_cache_if_too_big.sh b/delete_cache_if_too_big.sh new file mode 100644 index 00000000..ffc5c611 --- /dev/null +++ b/delete_cache_if_too_big.sh @@ -0,0 +1,9 @@ +function delete_cache_if_too_big() { + path=$1 + limit_mb=$2 + size_mb=$(du -m -d0 "${path}" | cut -f 1) + if (( size_mb > limit_mb )); then + echo "${path} is too large (${size_mb}mb), nuking it." + rm -rf "${path}" + fi + } \ No newline at end of file