diff --git a/.github/workflows/compiler_macos_build_and_test.yml b/.github/workflows/compiler_macos_build_and_test.yml index d58b53afd..c26732603 100644 --- a/.github/workflows/compiler_macos_build_and_test.yml +++ b/.github/workflows/compiler_macos_build_and_test.yml @@ -89,6 +89,10 @@ jobs: - name: Test run: | set -e + export KEY_CACHE_DIRECTORY=$(mktemp -d)/KeySetCache + echo "KEY_CACHE_DIRECTORY=$KEY_CACHE_DIRECTORY" >> "${GITHUB_ENV}" + mkdir $KEY_CACHE_DIRECTORY + cd compilers/concrete-compiler/compiler echo "Debug: ccache statistics (prior to the tests):" ccache -s @@ -97,3 +101,8 @@ jobs: make MINIMAL_TESTS=${{ env.MINIMAL_TESTS }} Python3_EXECUTABLE=$(which python3.10) run-tests echo "Debug: ccache statistics (after the tests):" ccache -s + + - name: Cleanup host + if: success() || failure() + run: | + rm -rf $KEY_CACHE_DIRECTORY diff --git a/compilers/concrete-compiler/compiler/tests/tests_tools/keySetCache.h b/compilers/concrete-compiler/compiler/tests/tests_tools/keySetCache.h index bafe2b382..71dce9b02 100644 --- a/compilers/concrete-compiler/compiler/tests/tests_tools/keySetCache.h +++ b/compilers/concrete-compiler/compiler/tests/tests_tools/keySetCache.h @@ -14,8 +14,13 @@ static inline std::optional getTestKeySetCache() { llvm::SmallString<0> cachePath; - llvm::sys::path::system_temp_directory(true, cachePath); - llvm::sys::path::append(cachePath, CACHE_PATH); + + if (auto envCachepath = std::getenv("KEY_CACHE_DIRECTORY")) { + cachePath.append(envCachepath); + } else { + llvm::sys::path::system_temp_directory(true, cachePath); + llvm::sys::path::append(cachePath, CACHE_PATH); + } auto cachePathStr = std::string(cachePath);