From 9482a0afdfb129cd0782fe4e168af5eba4ceb4a0 Mon Sep 17 00:00:00 2001 From: Ashcon Partovi Date: Wed, 14 Aug 2024 14:02:29 -0700 Subject: [PATCH] Fix CI cache not working on macOS & Linux --- .buildkite/scripts/env.sh | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/.buildkite/scripts/env.sh b/.buildkite/scripts/env.sh index 1ff527be25..ff734240d2 100755 --- a/.buildkite/scripts/env.sh +++ b/.buildkite/scripts/env.sh @@ -129,19 +129,17 @@ function export_environment() { else export USE_DEBUG_JSC="OFF" fi - if { [ "$BUILDKITE_CLEAN_CHECKOUT" == "true" ] || [ "$BUILDKITE_BRANCH" == "main" ]; }; then + if [ "$BUILDKITE_CLEAN_CHECKOUT" == "true" ] || [ "$BUILDKITE_BRANCH" == "main" ]; then # Attempt to delete the old directory rm -rf "$CCACHE_DIR" "$SCCACHE_DIR" "$ZIG_LOCAL_CACHE_DIR" "$ZIG_GLOBAL_CACHE_DIR" "$BUN_DEPS_CACHE_DIR" # Make sure to use a new temporary directory - local tempdir_to_use=$(mktemp -d 2>/dev/null || mktemp -d -t 'new') - - CCACHE_DIR="$tempdir_to_use/ccache" - SCCACHE_DIR="$tempdir_to_use/sccache" - ZIG_LOCAL_CACHE_DIR="$tempdir_to_use/zig-local" - ZIG_GLOBAL_CACHE_DIR="$tempdir_to_use/zig-global" - BUN_DEPS_CACHE_DIR="$tempdir_to_use/bun-deps" - - mkdir -p "$BUN_DEPS_CACHE_DIR $CCACHE_DIR $SCCACHE_DIR $ZIG_LOCAL_CACHE_DIR $ZIG_GLOBAL_CACHE_DIR" + local tmpdir=$(mktemp -d 2>/dev/null || mktemp -d -t 'new') + CCACHE_DIR="$tmpdir/ccache" + SCCACHE_DIR="$tmpdir/sccache" + ZIG_LOCAL_CACHE_DIR="$tmpdir/zig-local" + ZIG_GLOBAL_CACHE_DIR="$tmpdir/zig-global" + BUN_DEPS_CACHE_DIR="$tmpdir/bun-deps" + mkdir -p $BUN_DEPS_CACHE_DIR $CCACHE_DIR $SCCACHE_DIR $ZIG_LOCAL_CACHE_DIR $ZIG_GLOBAL_CACHE_DIR export CCACHE_RECACHE="1" fi }