neovim/ci/before_cache.sh
Daniel Hahler 208f56d3b9
ci: Travis: improve/revisit caching (#10358)
- use CACHE_NVIM_DEPS_DIR

- do not cache pip
  This is handled through http caches in general/better, and it is not
  used much anyway.

- do not cache DEPS_DOWNLOAD_DIR
  Built deps are cached, downloads are not needed then.

- display ccache stats before clearing

- do not cache ccache stats

- improve output of `du` (do not list pages of output for "/home/travis/.cache/go-build")
2019-07-30 23:21:12 +02:00

28 lines
872 B
Bash
Executable File

#!/usr/bin/env bash
set -e
set -o pipefail
CI_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "${CI_DIR}/common/build.sh"
source "${CI_DIR}/common/suite.sh"
echo "before_cache.sh: cache size"
du -chd 1 "${HOME}/.cache" | sort -rh | head -20
echo "before_cache.sh: ccache stats"
ccache -s 2>/dev/null || true
# Do not keep ccache stats (uploaded to cache otherwise; reset initially anyway).
find "${HOME}/.ccache" -name stats -delete
# Update the third-party dependency cache only if the build was successful.
if ended_successfully; then
# Do not cache downloads. They should not be needed with up-to-date deps.
rm -rf "${DEPS_BUILD_DIR}/build/downloads"
rm -rf "${CACHE_NVIM_DEPS_DIR}"
mv "${DEPS_BUILD_DIR}" "${CACHE_NVIM_DEPS_DIR}"
touch "${CACHE_MARKER}"
echo "Updated third-party dependencies (timestamp: $(_stat "${CACHE_MARKER}"))."
fi