Skip to content

Commit 2b359f1

Browse files
ci: Enable simple cache for brewing valgrind on macOS
1 parent 8c02e46 commit 2b359f1

File tree

1 file changed

+25
-5
lines changed

1 file changed

+25
-5
lines changed

.cirrus.yml

+25-5
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,9 @@ task:
115115
name: "x86_64: macOS Catalina"
116116
macos_instance:
117117
image: catalina-base
118+
env:
119+
HOMEBREW_NO_AUTO_UPDATE: 1
120+
HOMEBREW_NO_INSTALL_CLEANUP: 1
118121
matrix:
119122
<< : *ENV_MATRIX
120123
matrix:
@@ -135,13 +138,30 @@ task:
135138
## - softwareupdate -i "$PROD" --verbose
136139
## - rm /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress
137140
##
138-
brew_script:
139-
# TODO cache the binaries
140-
- export HOMEBREW_NO_AUTO_UPDATE=1
141-
- export HOMEBREW_NO_INSTALL_CLEANUP=1
141+
brew_valgrind_pre_script:
142142
- brew config
143143
- brew tap --shallow LouisBrunner/valgrind
144-
- brew install --HEAD LouisBrunner/valgrind/valgrind
144+
# Fetch valgrind source but don't build it yet.
145+
- brew fetch --HEAD LouisBrunner/valgrind/valgrind
146+
brew_valgrind_cache:
147+
# This is $(brew --cellar valgrind) but command substition does not work here.
148+
folder: /usr/local/Cellar/valgrind
149+
# Rebuild cache if ...
150+
fingerprint_script:
151+
# ... macOS version changes:
152+
- sw_vers
153+
# ... brew changes:
154+
- brew config
155+
# ... valgrind changes:
156+
- git -C "$(brew --cache)/valgrind--git" rev-parse HEAD
157+
populate_script:
158+
# If there's no hit in the cache, build and install valgrind.
159+
- brew install --HEAD LouisBrunner/valgrind/valgrind
160+
brew_valgrind_post_script:
161+
# If we have restored valgrind from the cache, tell brew to create symlink to the PATH.
162+
# If we haven't restored from cached (and just run brew install), this is a no-op.
163+
- brew link valgrind
164+
brew_script:
145165
- brew install automake libtool gmp gcc@9
146166
test_script:
147167
- ./ci/cirrus.sh

0 commit comments

Comments
 (0)