blob: 5cb9d1e3e1fd0854487c14f1486a9e44ecbf5bf5 [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 Dionne137daee2021-06-14 15:55:36 -04007if [[ -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
10fi
Louis Dionnecc7d0842020-10-06 14:13:55 -040011
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 Dionne87da9ed2020-12-11 14:06:24 -050016brew install sphinx-doc python3 ninja cmake clang-format buildkite/buildkite/buildkite-agent
Louis Dionnecc7d0842020-10-06 14:13:55 -040017
18CFG_DIR="$(brew --prefix)/etc/buildkite-agent"
19
Louis Dionne6a3ffe22021-02-02 14:59:35 -050020version="$(sw_vers -productVersion | sed -E 's/([0-9]+).([0-9]+).[0-9]+/\1.\2/')"
21
Louis Dionnecc7d0842020-10-06 14:13:55 -040022# Setup the tags of the agent
Louis Dionne6a3ffe22021-02-02 14:59:35 -050023echo 'tags="queue=libcxx-builders-macos,queue=libcxx-builders-macos${version}"' >> "${CFG_DIR}/buildkite-agent.cfg"
Louis Dionnecc7d0842020-10-06 14:13:55 -040024
25# Setup the BuildKite Agent token
26sed -i '' "s/xxx/${BUILDKITE_AGENT_TOKEN}/g" "${CFG_DIR}/buildkite-agent.cfg"