Skip to content

Commit

Permalink
Trying to nuke cache
Browse files Browse the repository at this point in the history
  • Loading branch information
sureshjoshi committed Jun 7, 2024
1 parent b833225 commit 405b491
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions .github/workflows/pants.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,22 +33,22 @@ jobs:
gha-cache-key: cache4-py${{ matrix.python_version }}
named-caches-hash: ${{ hashFiles('build-support/lockfiles/*.lock') }}

# - shell: bash
# # https://www.pantsbuild.org/2.20/docs/using-pants/using-pants-in-ci#directories-to-cache
# run: |
# function nuke_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."
# nuke_prefix="$(dirname "${path}")/$(basename "${path}").nuke"
# nuke_path=$(mktemp -d "${nuke_prefix}.XXXXXX")
# mv "${path}" "${nuke_path}/"
# rm -rf "${nuke_prefix}.*"
# fi
# }
# nuke_if_too_big ${{ inputs.named-caches-location }} 1
- shell: bash
# https://www.pantsbuild.org/2.20/docs/using-pants/using-pants-in-ci#directories-to-cache
run: |
function nuke_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."
nuke_prefix="$(dirname "${path}")/$(basename "${path}").nuke"
nuke_path=$(mktemp -d "${nuke_prefix}.XXXXXX")
mv "${path}" "${nuke_path}/"
rm -rf "${nuke_prefix}.*"
fi
}
nuke_if_too_big ${{ inputs.named-caches-location }} 1
- name: Bootstrap Pants
run: |
Expand Down

0 comments on commit 405b491

Please sign in to comment.