Louis Dionne | cc7d084 | 2020-10-06 14:13:55 -0400 | [diff] [blame] | 1 | #!/usr/bin/env bash |
| 2 | |
| 3 | # This simple script can be used to set up a CI node running MacOS. |
| 4 | # An additional requirement that is *not* handled by this script is the |
| 5 | # installation of Xcode, which requires manual intervention. |
| 6 | |
Louis Dionne | 137daee | 2021-06-14 15:55:36 -0400 | [diff] [blame^] | 7 | if [[ -z "${BUILDKITE_AGENT_TOKEN}" ]]; then |
| 8 | echo "The BUILDKITE_AGENT_TOKEN environment variable must be set to a BuildKite Agent token when calling this script." |
| 9 | exit 1 |
| 10 | fi |
Louis Dionne | cc7d084 | 2020-10-06 14:13:55 -0400 | [diff] [blame] | 11 | |
| 12 | # Install Homebrew |
| 13 | /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)" |
| 14 | |
| 15 | # Install the required tools to run CI |
Louis Dionne | 87da9ed | 2020-12-11 14:06:24 -0500 | [diff] [blame] | 16 | brew install sphinx-doc python3 ninja cmake clang-format buildkite/buildkite/buildkite-agent |
Louis Dionne | cc7d084 | 2020-10-06 14:13:55 -0400 | [diff] [blame] | 17 | |
| 18 | CFG_DIR="$(brew --prefix)/etc/buildkite-agent" |
| 19 | |
Louis Dionne | 6a3ffe2 | 2021-02-02 14:59:35 -0500 | [diff] [blame] | 20 | version="$(sw_vers -productVersion | sed -E 's/([0-9]+).([0-9]+).[0-9]+/\1.\2/')" |
| 21 | |
Louis Dionne | cc7d084 | 2020-10-06 14:13:55 -0400 | [diff] [blame] | 22 | # Setup the tags of the agent |
Louis Dionne | 6a3ffe2 | 2021-02-02 14:59:35 -0500 | [diff] [blame] | 23 | echo 'tags="queue=libcxx-builders-macos,queue=libcxx-builders-macos${version}"' >> "${CFG_DIR}/buildkite-agent.cfg" |
Louis Dionne | cc7d084 | 2020-10-06 14:13:55 -0400 | [diff] [blame] | 24 | |
| 25 | # Setup the BuildKite Agent token |
| 26 | sed -i '' "s/xxx/${BUILDKITE_AGENT_TOKEN}/g" "${CFG_DIR}/buildkite-agent.cfg" |