Make macos ci homebrew dep-caching fast (#19632)
* try out /usr/local for homebrew caching * TEMP: disable non-macos jobs * TEMP: disable more * sizes * temp: nothing change * more * try -1 * quotes * delete existing downloads * fix ~ expansion * nothing * try caching cellar * move to yaml * nothing * nothing * asdf * nothing * fixed cache key * nothing * stay in home dir * keep zstd * brew link * fix cleaning? * brew link in yaml * fix zstd exclusion * capnp * revert mac_setup * finish up * donealbatross
parent
0c4e2fadc8
commit
cbc25cc0f1
|
@ -54,6 +54,12 @@ jobs:
|
|||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: true
|
||||
- name: Determine pre-existing Homebrew packages
|
||||
if: steps.dependency-cache.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
echo 'EXISTING_CELLAR<<EOF' >> $GITHUB_ENV
|
||||
ls -1 /usr/local/Cellar >> $GITHUB_ENV
|
||||
echo 'EOF' >> $GITHUB_ENV
|
||||
- name: Cache dependencies
|
||||
id: dependency-cache
|
||||
uses: actions/cache@v2
|
||||
|
@ -62,14 +68,36 @@ jobs:
|
|||
~/.pyenv
|
||||
~/Library/Caches/pip
|
||||
~/Library/Caches/pipenv
|
||||
~/Library/Caches/Homebrew
|
||||
key: ${{ hashFiles('tools/mac_setup.sh') }}
|
||||
/usr/local/Cellar
|
||||
~/github_brew_cache_entries.txt
|
||||
key: macos-deps-${{ hashFiles('tools/mac_setup.sh') }}
|
||||
restore-keys: macos-deps-
|
||||
- name: Brew link restored dependencies
|
||||
if: steps.dependency-cache.outputs.cache-hit == 'true'
|
||||
run: |
|
||||
while read package; do
|
||||
brew link --force "$package" # `--force` for keg-only packages
|
||||
done < ~/github_brew_cache_entries.txt
|
||||
- name: Install dependencies
|
||||
run: ./tools/mac_setup.sh
|
||||
- name: Build openpilot
|
||||
run: eval "$(pyenv init -)" && scons -j$(nproc)
|
||||
- name: Brew cleanup
|
||||
run: brew cleanup || true # keeps our cache small
|
||||
- name: Remove pre-existing Homebrew packages for caching
|
||||
if: steps.dependency-cache.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
new_cellar=$(ls -1 /usr/local/Cellar)
|
||||
comm -12 <(echo "$EXISTING_CELLAR") <(echo "$new_cellar") | while read dir; do
|
||||
if [[ $dir != "zstd" ]]; then # caching step needs zstd
|
||||
echo "Removing /usr/local/Cellar/$dir"
|
||||
rm -rf "/usr/local/Cellar/$dir"
|
||||
fi
|
||||
done
|
||||
|
||||
printf "\n\nNewly installed packages:\n"
|
||||
comm -13 <(echo "$EXISTING_CELLAR") <(echo "$new_cellar") | tee ~/github_brew_cache_entries.txt
|
||||
|
||||
printf "\n\nThe following will be cached:\n"
|
||||
(du -shc /usr/local/Cellar/* | sort -h) || true
|
||||
|
||||
build_webcam:
|
||||
name: build webcam
|
||||
|
|
|
@ -15,7 +15,7 @@ brew install capnp \
|
|||
libusb \
|
||||
libtool \
|
||||
llvm \
|
||||
openssl \
|
||||
openssl \
|
||||
pyenv \
|
||||
qt5 \
|
||||
zeromq
|
||||
|
|
Loading…
Reference in New Issue