iw6-mod/deps/protobuf/kokoro/macos/prepare_build_macos_rc

53 lines
1.3 KiB
Plaintext
Raw Normal View History

2024-02-27 01:34:37 -05:00
#!/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 needs to be directed towards its dependencies.
CFLAGS="-I$(brew --prefix zlib)/include" \
LDFLAGS="-L$(brew --prefix zlib)/lib" \
pyenv install -v -s 3.7.13
pyenv global 3.7.13
sudo python -m pip install --upgrade pip 'tox==3.27.1' 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