From 972c3aa82b25018f68b12c1ccacfbea2604af30a Mon Sep 17 00:00:00 2001 From: rayanimesh Date: Tue, 10 Mar 2020 19:13:47 +0530 Subject: [PATCH 1/2] travis: Add compile check for all supported platforms --- .travis.yml | 1 + .travis/complie_check.sh | 10 ++++++++++ AUTHORS | 1 + 3 files changed, 12 insertions(+) create mode 100755 .travis/complie_check.sh diff --git a/.travis.yml b/.travis.yml index 56fcf25f2..40c230105 100644 --- a/.travis.yml +++ b/.travis.yml @@ -125,5 +125,6 @@ script: - go test -v -covermode=count -coverprofile=coverage.out - go vet ./... - .travis/gofmt.sh + - .travis/complie_check.sh after_script: - $HOME/gopath/bin/goveralls -coverprofile=coverage.out -service=travis-ci diff --git a/.travis/complie_check.sh b/.travis/complie_check.sh new file mode 100755 index 000000000..d93763db4 --- /dev/null +++ b/.travis/complie_check.sh @@ -0,0 +1,10 @@ +#!/bin/bash +set -e +dist_list=$(go tool dist list) + +for dist in ${dist_list}; do + GOOS=$(echo ${dist} | cut -d "/" -f 1) + GOARCH=$(echo ${dist} | cut -d "/" -f 2) + echo "Building ${GOOS}/${GOARCH}" + GOOS=${GOOS} GOARCH=${GOARCH} go build -o /dev/null + done diff --git a/AUTHORS b/AUTHORS index 7dafbe2ec..5473a8df9 100644 --- a/AUTHORS +++ b/AUTHORS @@ -16,6 +16,7 @@ Achille Roussel Alex Snast Alexey Palazhchenko Andrew Reid +Animesh Ray Arne Hormann Ariel Mashraki Asta Xie From e2b4b5b454df5ce8c4e611bfac06ebca875bcbad Mon Sep 17 00:00:00 2001 From: rayanimesh Date: Wed, 11 Mar 2020 16:30:52 +0530 Subject: [PATCH 2/2] travis: Check compile support for platform before build `linux/riscv64` platform was added in `go 1.11` but compile was not supported. Therefore buidling with `GOOS=linux GOARCH=riscv64` for `go 1.11` throws error. This check handles above case. --- .travis/complie_check.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.travis/complie_check.sh b/.travis/complie_check.sh index d93763db4..3bb3ed49d 100755 --- a/.travis/complie_check.sh +++ b/.travis/complie_check.sh @@ -5,6 +5,13 @@ dist_list=$(go tool dist list) for dist in ${dist_list}; do GOOS=$(echo ${dist} | cut -d "/" -f 1) GOARCH=$(echo ${dist} | cut -d "/" -f 2) + set +e + GOOS=${GOOS} GOARCH=${GOARCH} go tool compile -V > /dev/null 2>&1 + if [[ $? -ne 0 ]]; then + echo "Compile support for ${GOOS}/${GOARCH} is not provided; skipping" + continue + fi + set -e echo "Building ${GOOS}/${GOARCH}" GOOS=${GOOS} GOARCH=${GOARCH} go build -o /dev/null done