forked from envoyproxy/envoy
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmac_ci_setup.sh
More file actions
executable file
·64 lines (54 loc) · 1.49 KB
/
mac_ci_setup.sh
File metadata and controls
executable file
·64 lines (54 loc) · 1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/usr/bin/env bash
# Installs the dependencies required for a macOS build via homebrew.
# Tools are not upgraded to new versions.
# See:
# https://github.com/actions/virtual-environments/blob/master/images/macos/macos-10.15-Readme.md for
# a list of pre-installed tools in the macOS image.
# https://github.com/actions/virtual-environments/issues/2322
if command -v 2to3 > /dev/null; then
rm -f "$(command -v 2to3)"
fi
export HOMEBREW_NO_AUTO_UPDATE=1
HOMEBREW_RETRY_ATTEMPTS=10
HOMEBREW_RETRY_INTERVAL=3
XCODE_DEFAULT_VERSION=16.1
XCODE_VERSION="${XCODE_VERSION:-${XCODE_DEFAULT_VERSION}}"
if [[ -n "$XCODE_VERSION" ]]; then
sudo xcode-select --switch "/Applications/Xcode_${XCODE_VERSION}.app"
fi
function is_installed {
brew ls --versions "$1" >/dev/null
}
function install {
echo "Installing $1"
if ! brew install "$1"; then
echo "Failed to install $1"
exit 1
fi
}
function retry () {
local returns=1 i=1 attempts
attempts="${1}"
interval="${2}"
shift 2
while ((i<=attempts)); do
if "$@"; then
returns=0
break
else
sleep "$interval";
((i++))
fi
done
return "$returns"
}
if ! retry "$HOMEBREW_RETRY_ATTEMPTS" "$HOMEBREW_RETRY_INTERVAL" brew update; then
# Do not exit early if update fails.
echo "Failed to update homebrew"
fi
DEPS="automake coreutils libtool wget"
for DEP in ${DEPS}
do
is_installed "${DEP}" || install "${DEP}"
done
retry 5 2 bazel version