blob: d2c7f9dc2c08332b53241b63c137ee957570106b [file] [log] [blame]
Louis Dionnecc7d0842020-10-06 14:13:55 -04001#!/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 Dionneaf413c52021-07-12 15:44:28 -04007set -e
8
Louis Dionne137daee2021-06-14 15:55:36 -04009if [[ -z "${BUILDKITE_AGENT_TOKEN}" ]]; then
10 echo "The BUILDKITE_AGENT_TOKEN environment variable must be set to a BuildKite Agent token when calling this script."
11 exit 1
12fi
Louis Dionnecc7d0842020-10-06 14:13:55 -040013
14# Install Homebrew
15/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
16
17# Install the required tools to run CI
Louis Dionne87da9ed2020-12-11 14:06:24 -050018brew install sphinx-doc python3 ninja cmake clang-format buildkite/buildkite/buildkite-agent
Louis Dionnecc7d0842020-10-06 14:13:55 -040019
20CFG_DIR="$(brew --prefix)/etc/buildkite-agent"
21
Louis Dionne6a3ffe22021-02-02 14:59:35 -050022version="$(sw_vers -productVersion | sed -E 's/([0-9]+).([0-9]+).[0-9]+/\1.\2/')"
Louis Dionne60523a12021-07-12 15:34:17 -040023arch="$(uname -m)"
Louis Dionne6a3ffe22021-02-02 14:59:35 -050024
Louis Dionnecc7d0842020-10-06 14:13:55 -040025# Setup the tags of the agent
Louis Dionne60523a12021-07-12 15:34:17 -040026echo "tags=\"queue=libcxx-builders,arch=${arch},os=macos${version}\"" >> "${CFG_DIR}/buildkite-agent.cfg"
Louis Dionnecc7d0842020-10-06 14:13:55 -040027
28# Setup the BuildKite Agent token
29sed -i '' "s/xxx/${BUILDKITE_AGENT_TOKEN}/g" "${CFG_DIR}/buildkite-agent.cfg"