From e79ec0266089c2e0a7ec2be8f1e876833d62b24c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Mierzwa?= Date: Tue, 7 Apr 2020 16:17:43 +0100 Subject: [PATCH] fix(ci): prune GOCACHE if it gets too big --- .travis.yml | 2 ++ scripts/prune-go-cache.sh | 14 ++++++++++++++ 2 files changed, 16 insertions(+) create mode 100755 scripts/prune-go-cache.sh 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