From 5534839ff7165639d73fdb33950990e3841e2a3d Mon Sep 17 00:00:00 2001 From: Alessandro Arzilli Date: Mon, 1 Mar 2021 17:23:05 +0100 Subject: [PATCH] TeamCity: select latest patch version of go for mac builds (#2363) Also adds a disabled tip builder for the next-version support branch. --- .teamcity/settings.kts | 1 + _scripts/latestver.py | 11 +++++++++++ _scripts/test_mac.sh | 18 +++++++++++++----- 3 files changed, 25 insertions(+), 5 deletions(-) create mode 100644 _scripts/latestver.py diff --git a/.teamcity/settings.kts b/.teamcity/settings.kts index 8e0e0b63..9e0224bb 100644 --- a/.teamcity/settings.kts +++ b/.teamcity/settings.kts @@ -49,6 +49,7 @@ val targets = arrayOf( "windows/amd64/tip", "mac/amd64/1.16", + "mac/amd64/tip" ) project { diff --git a/_scripts/latestver.py b/_scripts/latestver.py new file mode 100644 index 00000000..d4138136 --- /dev/null +++ b/_scripts/latestver.py @@ -0,0 +1,11 @@ +#!/usr/bin/python +import json +import urllib +import sys + +ver = sys.argv[1] +d = json.loads(urllib.urlopen('https://golang.org/dl/?mode=json&include=all').read()) +for x in d: + if x['version'][:len(ver)] == ver: + print x['version'] + exit(0) diff --git a/_scripts/test_mac.sh b/_scripts/test_mac.sh index 88419938..9ca17d89 100644 --- a/_scripts/test_mac.sh +++ b/_scripts/test_mac.sh @@ -8,22 +8,30 @@ ARCH=$2 TMPDIR=$3 if [ "$GOVERSION" = "gotip" ]; then - git clone https://go.googlesource.com/go $TMPDIR/go - export GOROOT_BOOTSTRAP=$GOROOT - cd $TMPDIR/go/src + exit 0 + bootstrapver=$(curl https://golang.org/VERSION?m=text) + curl -sSL "https://storage.googleapis.com/golang/$bootstrapver.darwin-$ARCH.tar.gz" | tar -xz + git clone https://go.googlesource.com/go $TMPDIR/go-tip + export GOROOT_BOOTSTRAP=$TMPDIR/go + export GOROOT=$TMPDIR/go-tip + cd $TMPDIR/go-tip/src ./make.bash cd - else + echo Finding latest patch version for $GOVERSION + GOVERSION=$(python _scripts/latestver.py $GOVERSION) + echo Go $GOVERSION on $ARCH cd $TMPDIR - curl -sSL "https://storage.googleapis.com/golang/$GOVERSION.darwin-$ARCH.tar.gz" | tar -vxz + curl -sSL "https://storage.googleapis.com/golang/$GOVERSION.darwin-$ARCH.tar.gz" | tar -xz cd - + export GOROOT="$TMPDIR/go" fi mkdir -p $TMPDIR/gopath -export GOROOT="$TMPDIR/go" export GOPATH="$TMPDIR/gopath" export GOARCH="$ARCH" export PATH="$GOROOT/bin:$PATH" +go version make test