From 717648f9f878226748ea19594e423ac52def7a7d Mon Sep 17 00:00:00 2001 From: Alexander Arlt Date: Mon, 22 Jan 2024 15:27:58 +0100 Subject: [PATCH] Fix dependency cache. --- .circleci/config.yml | 48 ++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 44 insertions(+), 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 8a771e69596f..fd50ef90f85a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -364,11 +364,51 @@ commands: install_dependencies_osx: steps: - # FIXME: We used to cache dependencies on macOS but now it takes longer than just installing - # them each time. See https://github.com/ethereum/solidity/issues/12925. + - restore_cache: + keys: + - b_osx-dependencies-{{ arch }}-{{ checksum ".circleci/osx_install_dependencies.sh" }}-flag - run: - name: Install build dependencies - command: .circleci/osx_install_dependencies.sh + name: Checking dependency flag + command: | + if test -f ~/b_osx-dependencies-flag + then + echo "Dependency flag exists: removing /usr/local and /opt/homebrew directories. These directories will be restored from cache." + sudo rm -rf /usr/local/* + # circleci is providing the circleci cli tools via some kind of symlink magic. + # so we just save the original symlinks and using them later. + mv /opt/homebrew/bin/circleci /tmp/circleci + mv /opt/homebrew/bin/circleci-agent /tmp/circleci-agent + sudo rm -rf /opt/homebrew + sudo mkdir -p /opt/homebrew/bin + sudo chmod 777 /opt/homebrew + sudo chmod 777 /opt/homebrew/bin + mv /tmp/circleci /opt/homebrew/bin/circleci + mv /tmp/circleci-agent /opt/homebrew/bin/circleci-agent + sudo chmod 777 /usr/local + else + echo "Dependency flag didn't exist: installing dependencies." + .circleci/osx_install_dependencies.sh + if test -f /usr/local/lib/libz3.a + then + echo "/usr/local/lib/libz3.a found: setting dependency flag." + touch ~/b_osx-dependencies-flag + else + echo "Dependencies not build." + fi + fi + - save_cache: + key: b_osx-dependencies-{{ arch }}-{{ checksum ".circleci/osx_install_dependencies.sh" }}-flag + paths: + - ~/b_osx-dependencies-flag + - restore_cache: + keys: + - b_osx-dependencies-{{ arch }}-{{ checksum ".circleci/osx_install_dependencies.sh" }} + - save_cache: + key: b_osx-dependencies-{{ arch }}-{{ checksum ".circleci/osx_install_dependencies.sh" }} + paths: + - /usr/local + - /opt/homebrew + defaults: