blob: 9b9b2df7b88c59876433bd15a9da9ac0005285c3 [file] [log] [blame]
#!/bin/bash
#
# This script sets up a Kokoro MacOS worker for running Protobuf tests
set -eux
export HOMEBREW_PREFIX=$(brew --prefix)
##
# Remove any pre-existing protobuf installation.
brew uninstall protobuf
##
# Select Xcode version
##
# Select Xcode version
export DEVELOPER_DIR=/Applications/Xcode_14.app/Contents/Developer
sudo xcode-select -s "${DEVELOPER_DIR}"
##
# Select C/C++ compilers
export CC=gcc
export CXX=g++
##
# Install Python 2 by default
eval "$(pyenv init -)"
pyenv install -v -s 2.7.18 && pyenv global 2.7.18
##
# Install Tox
if [[ "${KOKORO_INSTALL_TOX:-}" == "yes" ]] ; then
pyenv install -v -s 3.7.13
pyenv global 3.7.13
sudo python -m pip install --upgrade pip tox tox-pyenv
fi
##
# Setup RVM
if [[ "${KOKORO_INSTALL_RVM:-}" == "yes" ]] ; then
git config --global --add safe.directory $HOMEBREW_PREFIX/Library/Taps/homebrew/homebrew-cask
git config --global --add safe.directory $HOMEBREW_PREFIX/Library/Taps/homebrew/homebrew-core
git config --global --add safe.directory $HOMEBREW_PREFIX/Library/Taps/homebrew/homebrew-services
sudo chown -R $(whoami) $HOME/.rvm/
fi