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")
This commit is contained in:
Daniel Hahler
2019-07-30 23:21:12 +02:00
committed by GitHub
parent 6e01ed6a4c
commit 208f56d3b9
4 changed files with 15 additions and 21 deletions

View File

@@ -10,8 +10,6 @@ env:
- BUILD_DIR="$TRAVIS_BUILD_DIR/build" - BUILD_DIR="$TRAVIS_BUILD_DIR/build"
# Build directory for third-party dependencies. # Build directory for third-party dependencies.
- DEPS_BUILD_DIR="$HOME/nvim-deps" - DEPS_BUILD_DIR="$HOME/nvim-deps"
# Directory where third-party dependency sources are downloaded to.
- DEPS_DOWNLOAD_DIR="$TRAVIS_BUILD_DIR/deps-downloads"
# Install directory for Neovim. # Install directory for Neovim.
- INSTALL_PREFIX="$HOME/nvim-install" - INSTALL_PREFIX="$HOME/nvim-install"
# Log directory for Clang sanitizers and Valgrind. # Log directory for Clang sanitizers and Valgrind.
@@ -25,7 +23,7 @@ env:
-DBUSTED_OUTPUT_TYPE=nvim -DBUSTED_OUTPUT_TYPE=nvim
-DDEPS_PREFIX=$DEPS_BUILD_DIR/usr -DDEPS_PREFIX=$DEPS_BUILD_DIR/usr
-DMIN_LOG_LEVEL=3" -DMIN_LOG_LEVEL=3"
- DEPS_CMAKE_FLAGS="-DDEPS_DOWNLOAD_DIR:PATH=$DEPS_DOWNLOAD_DIR -DUSE_BUNDLED_GPERF=OFF" - DEPS_CMAKE_FLAGS="-DUSE_BUNDLED_GPERF=OFF"
# Additional CMake flags for 32-bit builds. # Additional CMake flags for 32-bit builds.
- CMAKE_FLAGS_32BIT="-DCMAKE_SYSTEM_LIBRARY_PATH=/lib32:/usr/lib32:/usr/local/lib32 - CMAKE_FLAGS_32BIT="-DCMAKE_SYSTEM_LIBRARY_PATH=/lib32:/usr/lib32:/usr/local/lib32
-DCMAKE_IGNORE_PATH=/lib:/usr/lib:/usr/local/lib -DCMAKE_IGNORE_PATH=/lib:/usr/lib:/usr/local/lib
@@ -36,8 +34,9 @@ env:
- UBSAN_OPTIONS="print_stacktrace=1 log_path=$LOG_DIR/ubsan" - UBSAN_OPTIONS="print_stacktrace=1 log_path=$LOG_DIR/ubsan"
# Environment variables for Valgrind. # Environment variables for Valgrind.
- VALGRIND_LOG="$LOG_DIR/valgrind-%p.log" - VALGRIND_LOG="$LOG_DIR/valgrind-%p.log"
- CACHE_NVIM_DEPS_DIR="$HOME/.cache/nvim-deps"
# If this file exists, the cache is valid (compile was successful). # If this file exists, the cache is valid (compile was successful).
- CACHE_MARKER="$HOME/.cache/nvim-deps/.travis_cache_marker" - CACHE_MARKER="$CACHE_NVIM_DEPS_DIR/.travis_cache_marker"
# default target name for functional tests # default target name for functional tests
- FUNCTIONALTEST=functionaltest - FUNCTIONALTEST=functionaltest
- CI_TARGET=tests - CI_TARGET=tests
@@ -52,7 +51,7 @@ anchors:
envs: &common-job-env envs: &common-job-env
# Do not fall back to cache for "master" for PR on "release" branch: # Do not fall back to cache for "master" for PR on "release" branch:
# adds the target branch to the cache key. # adds the target branch to the cache key.
FOR_TRAVIS_CACHE=$TRAVIS_BRANCH FOR_TRAVIS_CACHE=v1-$TRAVIS_BRANCH
addons: addons:
apt: apt:
@@ -165,9 +164,7 @@ cache:
apt: true apt: true
ccache: true ccache: true
directories: directories:
- "$HOME/.cache/pip" - "$CACHE_NVIM_DEPS_DIR"
- "$HOME/.cache/nvim-deps"
- "$HOME/.cache/nvim-deps-downloads"
notifications: notifications:
webhooks: webhooks:

View File

@@ -7,23 +7,20 @@ CI_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "${CI_DIR}/common/build.sh" source "${CI_DIR}/common/build.sh"
source "${CI_DIR}/common/suite.sh" source "${CI_DIR}/common/suite.sh"
# Don't cache pip's log and selfcheck.
rm -rf "${HOME}/.cache/pip/log"
rm -f "${HOME}/.cache/pip/selfcheck.json"
echo "before_cache.sh: cache size" echo "before_cache.sh: cache size"
du -d 2 "${HOME}/.cache" | sort -n du -chd 1 "${HOME}/.cache" | sort -rh | head -20
echo "before_cache.sh: ccache stats" echo "before_cache.sh: ccache stats"
ccache -s 2>/dev/null || true 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. # Update the third-party dependency cache only if the build was successful.
if ended_successfully; then if ended_successfully; then
rm -rf "${HOME}/.cache/nvim-deps" # Do not cache downloads. They should not be needed with up-to-date deps.
mv "${DEPS_BUILD_DIR}" "${HOME}/.cache/nvim-deps" rm -rf "${DEPS_BUILD_DIR}/build/downloads"
rm -rf "${CACHE_NVIM_DEPS_DIR}"
rm -rf "${HOME}/.cache/nvim-deps-downloads" mv "${DEPS_BUILD_DIR}" "${CACHE_NVIM_DEPS_DIR}"
mv "${DEPS_DOWNLOAD_DIR}" "${HOME}/.cache/nvim-deps-downloads"
touch "${CACHE_MARKER}" touch "${CACHE_MARKER}"
echo "Updated third-party dependencies (timestamp: $(_stat "${CACHE_MARKER}"))." echo "Updated third-party dependencies (timestamp: $(_stat "${CACHE_MARKER}"))."

View File

@@ -20,6 +20,8 @@ if [[ -n "${LLVM_SYMBOLIZER}" ]] && [[ ! $(type -P "${LLVM_SYMBOLIZER}") ]]; the
exit 1 exit 1
fi fi
echo "before_script.sh: ccache stats (will be cleared)"
ccache -s
# Reset ccache stats for real results in before_cache. # Reset ccache stats for real results in before_cache.
ccache --zero-stats ccache --zero-stats

View File

@@ -27,15 +27,13 @@ build_deps() {
fi fi
mkdir -p "${DEPS_BUILD_DIR}" mkdir -p "${DEPS_BUILD_DIR}"
mkdir -p "${DEPS_DOWNLOAD_DIR}"
# Use cached dependencies if $CACHE_MARKER exists. # Use cached dependencies if $CACHE_MARKER exists.
if test "${CACHE_ENABLE}" = "false" ; then if test "${CACHE_ENABLE}" = "false" ; then
export CCACHE_RECACHE=1 export CCACHE_RECACHE=1
elif test -f "${CACHE_MARKER}" ; then elif test -f "${CACHE_MARKER}" ; then
echo "Using third-party dependencies from Travis cache (last update: $(_stat "${CACHE_MARKER}"))." echo "Using third-party dependencies from Travis cache (last update: $(_stat "${CACHE_MARKER}"))."
cp -a "${HOME}/.cache/nvim-deps"/. "${DEPS_BUILD_DIR}" cp -a "${CACHE_NVIM_DEPS_DIR}"/. "${DEPS_BUILD_DIR}"
cp -a "${HOME}/.cache/nvim-deps-downloads"/. "${DEPS_DOWNLOAD_DIR}"
fi fi
# Even if we're using cached dependencies, run CMake and make to # Even if we're using cached dependencies, run CMake and make to