diff --git a/.travis.yml b/.travis.yml index 21f487c41..7aa360c28 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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: diff --git a/scripts/prune-go-cache.sh b/scripts/prune-go-cache.sh new file mode 100755 index 000000000..fb7aaba26 --- /dev/null +++ b/scripts/prune-go-cache.sh @@ -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