Skip to content

Commit ac702da

Browse files
Enable simple cache for brewing valgrind on macOS
1 parent 2b8fbe5 commit ac702da

File tree

1 file changed

+25
-5
lines changed

1 file changed

+25
-5
lines changed

.cirrus.yml

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,9 @@ task:
123123
name: "x86_64: macOS Catalina"
124124
macos_instance:
125125
image: catalina-base
126+
env:
127+
HOMEBREW_NO_AUTO_UPDATE: 1
128+
HOMEBREW_NO_INSTALL_CLEANUP: 1
126129
matrix:
127130
<< : *ENV_MATRIX
128131
matrix:
@@ -143,13 +146,30 @@ task:
143146
## - softwareupdate -i "$PROD" --verbose
144147
## - rm /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress
145148
##
146-
brew_script:
147-
# TODO cache the binaries
148-
- export HOMEBREW_NO_AUTO_UPDATE=1
149-
- export HOMEBREW_NO_INSTALL_CLEANUP=1
149+
brew_valgrind_pre_script:
150150
- brew config
151151
- brew tap --shallow LouisBrunner/valgrind
152-
- brew install --HEAD LouisBrunner/valgrind/valgrind
152+
# Fetch valgrind source but don't build it yet.
153+
- brew fetch --HEAD LouisBrunner/valgrind/valgrind
154+
brew_valgrind_cache:
155+
# This is $(brew --cellar valgrind) but command substition does not work here.
156+
folder: /usr/local/Cellar/valgrind
157+
# Rebuild cache if ...
158+
fingerprint_script:
159+
# ... macOS version changes:
160+
- sw_vers
161+
# ... brew changes:
162+
- brew config
163+
# ... valgrind changes:
164+
- git -C "$(brew --cache)/valgrind--git" rev-parse HEAD
165+
populate_script:
166+
# If there's no hit in the cache, build and install valgrind.
167+
- brew install --HEAD LouisBrunner/valgrind/valgrind
168+
brew_valgrind_post_script:
169+
# If we have restored valgrind from the cache, tell brew to create symlink to the PATH.
170+
# If we haven't restored from cached (and just run brew install), this is a no-op.
171+
- brew link valgrind
172+
brew_script:
153173
- brew install automake libtool gmp gcc@9
154174
test_script:
155175
- ./ci/cirrus.sh

0 commit comments

Comments
 (0)