From c38bce737f532cec1d863d3e15bed4a8addbffd1 Mon Sep 17 00:00:00 2001 From: Matthew Pickering Date: Tue, 6 Jul 2021 14:31:21 +0100 Subject: ci: Copy the cache from inside the nix-shell where $HOME is different on darwin Hopefully fixes the flaky CI failures we have seen recently. Co-authored-by: Moritz Angerman --- .gitlab/ci.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to '.gitlab') diff --git a/.gitlab/ci.sh b/.gitlab/ci.sh index 5d898f31da..6a8ac0f602 100755 --- a/.gitlab/ci.sh +++ b/.gitlab/ci.sh @@ -199,7 +199,7 @@ function set_toolchain_paths() { # Extract GHC toolchain function setup() { if [ -d "${CABAL_CACHE}" ]; then - info "Extracting cabal cache..." + info "Extracting cabal cache from ${CABAL_CACHE} to $cabal_dir..." mkdir -p "$cabal_dir" cp -Rf "${CABAL_CACHE}"/* "$cabal_dir" fi @@ -483,6 +483,11 @@ function run_perf_test() { OUT=out/Cabal-O2 cabal_test -O2 } +function save_cache () { + info "Storing cabal cache from $cabal_dir to ${CABAL_CACHE}..." + cp -Rf "$cabal_dir" "${CABAL_CACHE}" +} + function clean() { rm -R tmp run "$MAKE" --quiet clean || true @@ -522,6 +527,10 @@ case "$(uname)" in *) cabal_dir="$HOME/.cabal"; exe="" ;; esac +echo "Cabal_dir is $cabal_dir" +echo "$(uname -m)" +echo "${CABAL_CACHE}" + # Platform-specific environment initialization MAKE="make" TAR="tar" @@ -590,6 +599,7 @@ case $1 in perf_test) run_perf_test ;; cabal_test) cabal_test ;; clean) clean ;; + save-cache) save_cache ;; shell) shell "$@" ;; *) fail "unknown mode $1" ;; esac -- cgit v1.2.1