fix(ci): prune GOCACHE if it gets too big

This commit is contained in:
Łukasz Mierzwa
2020-04-07 16:17:43 +01:00
parent f017354915
commit e79ec02660
2 changed files with 16 additions and 0 deletions

View File

@@ -169,6 +169,8 @@ jobs:
- shasum -a 512 karma-*.tar.gz | tee sha512sum.txt
# verify that there are no uncommited changes
- git diff --exit-code
# prune GOCACHE if it gets too big
- ./scripts/prune-go-cache.sh
deploy:
provider: releases
api_key:

14
scripts/prune-go-cache.sh Executable file
View File

@@ -0,0 +1,14 @@
#!/usr/bin/env bash
set -o errexit
set -o pipefail
GOCACHE=$(go env GOCACHE)
SIZE=`du -sxm ${GOCACHE} | awk '{print $1}'`
echo "GOCACHE size: ${SIZE}MB"
if [ $SIZE -gt 3500 ]; then
echo "Pruning GOCACHE at ${GOCACHE}"
find "${GOCACHE}" -type f -delete
fi