build: run tests natively on ARM, Mac, and Windows in CI (#111)

This commit is contained in:
Daniel Moran
2021-06-14 10:36:35 -04:00
committed by GitHub
parent 0acb80b044
commit 581daaa5ba
5 changed files with 177 additions and 26 deletions

55
scripts/ci/install-go.sh Executable file
View File

@ -0,0 +1,55 @@
#!/usr/bin/env bash
set -eo pipefail
declare -r GO_VERSION=1.16.5
function install_go_linux () {
ARCHIVE=go${GO_VERSION}.linux-$(dpkg --print-architecture).tar.gz
wget https://golang.org/dl/${ARCHIVE}
tar -C $1 -xzf ${ARCHIVE}
rm ${ARCHIVE}
}
function install_go_mac () {
ARCHIVE=go${GO_VERSION}.darwin-amd64.tar.gz
wget https://golang.org/dl/${ARCHIVE}
tar -C $1 -xzf ${ARCHIVE}
rm ${ARCHIVE}
}
function install_go_windows () {
ARCHIVE=go${GO_VERSION}.windows-amd64.zip
wget https://golang.org/dl/${ARCHIVE}
unzip -qq -d $1 ${ARCHIVE}
rm ${ARCHIVE}
}
function main () {
if [[ $# != 1 ]]; then
>&2 echo Usage: $0 '<install-dir>'
exit 1
fi
local -r install_dir=$1
rm -rf "$install_dir"
mkdir -p "$install_dir"
case $(uname) in
Linux)
install_go_linux "$install_dir"
;;
Darwin)
install_go_mac "$install_dir"
;;
MSYS_NT*)
install_go_windows "$install_dir"
;;
*)
>&2 echo Error: unknown OS $(uname)
exit 1
;;
esac
"${install_dir}/go/bin/go" version
}
main ${@}

39
scripts/ci/setup-system.sh Executable file
View File

@ -0,0 +1,39 @@
#!/usr/bin/env bash
set -eo pipefail
function setup_linux () {
sudo apt-get update
sudo apt-get install -y --no-install-recommends make
}
function setup_mac () {
# Python and TCL both come pre-installed on Circle's mac executors, and both depend on wget in some way.
# Homebrew will auto-upgrade both of them when wget is installed/upgraded, triggering a chain of upgrades.
# Uninstall them both before adding wget to avoid burning time in CI for things we don't need.
brew remove --force python@3.9 tcl-tk
HOMEBREW_NO_AUTO_UPDATE=1 brew install wget
}
function setup_windows () {
choco install make mingw wget
}
function main () {
case $(uname) in
Linux)
setup_linux
;;
Darwin)
setup_mac
;;
MSYS_NT*)
setup_windows
;;
*)
>&2 echo Error: unknown OS $(uname)
exit 1
;;
esac
}
main ${@}