From d51da19cbe11ece45a5efda8f2776f483ae8e8a7 Mon Sep 17 00:00:00 2001 From: Pete Moore Date: Mon, 1 Aug 2016 18:37:11 +0200 Subject: [PATCH] Fix for travis-ci/gimme#42 --- .travis.yml | 27 ++++++++++++++------------- .travis_rename_releases.sh | 8 ++++---- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1c645bd..82f82ee 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,18 +3,19 @@ sudo: false go: - 1.5 env: - - "GIMME_OS=linux GIMME_ARCH=amd64" - - "GIMME_OS=darwin GIMME_ARCH=amd64" - - "GIMME_OS=windows GIMME_ARCH=amd64" - - "GIMME_OS=windows GIMME_ARCH=386" + - "MY_GOOS=linux MY_GOARCH=amd64" + - "MY_GOOS=darwin MY_GOARCH=amd64" + - "MY_GOOS=windows MY_GOARCH=amd64" + - "MY_GOOS=windows MY_GOARCH=386" before_install: -# workaround for travis-ci/gimme#25 to pick up latest version of gimme and run again -- curl -o gimme -sL https://raw.githubusercontent.com/travis-ci/gimme/master/gimme -- chmod u+x gimme -- unset GOROOT GOTOOLDIR -- eval "$(./gimme 1.5)" -- go version -- go env +# workaround for travis-ci/gimme#42 + - curl -o go.tar.gz -sL https://storage.googleapis.com/golang/go1.6.3.linux-amd64.tar.gz + - tar -C $HOME -xf go.tar.gz + - rm go.tar.gz + - export GOROOT="${HOME}/go" + - export PATH="${GOROOT}/bin:${PATH}" + - export GOOS="${MY_GOOS}" + - export GOARCH="${MY_GOARCH}" # end of workaround ### - go get github.com/axw/gocov/gocov - go get github.com/mattn/goveralls @@ -22,10 +23,10 @@ before_install: - go get github.com/pierrre/gotestcover script: # need to test without gotestcover since error code is not reliable for gotestcover -- "test $GIMME_OS.$GIMME_ARCH != linux.amd64 || go test -v ./..." +- "test $GOOS.$GOARCH != linux.amd64 || go test -v ./..." after_script: # using gotestcover means tests get run again, but need to do this since exit code of gotestcover is unreliable -- "if test $GIMME_OS.$GIMME_ARCH = linux.amd64; ${GOPATH}/bin/gotestcover -v -coverprofile=coverage.report ./...; go tool cover -func=coverage.report; ${HOME}/gopath/bin/goveralls -coverprofile=coverage.report -service=travis-ci; fi" +- "if test $GOOS.$GOARCH = linux.amd64; ${GOPATH}/bin/gotestcover -v -coverprofile=coverage.report ./...; go tool cover -func=coverage.report; ${HOME}/gopath/bin/goveralls -coverprofile=coverage.report -service=travis-ci; fi" notifications: irc: channels: diff --git a/.travis_rename_releases.sh b/.travis_rename_releases.sh index 23f9003..a30428d 100755 --- a/.travis_rename_releases.sh +++ b/.travis_rename_releases.sh @@ -5,7 +5,7 @@ # set an environment variable for its location that we can use in .travis.yml for # publishing back to github. -# all cross-compiled binaries are in subdirectories: ${GOPATH}/bin/${GIMME_OS}_${GIMME_ARCH}/ +# all cross-compiled binaries are in subdirectories: ${GOPATH}/bin/${GOOS}_${GOARCH}/ # linux 64 bit, not cross-compiled, breaks this rule and is in ${GOPATH}/bin # therefore move it to match the convention of the others, to simplify subsequent steps # note: we don't know what we built, so only move it if we happen to be linux amd64 travis job @@ -16,10 +16,10 @@ fi # linux, darwin: FILE_EXT="" -[ "${GIMME_OS}" == "windows" ] && FILE_EXT=".exe" +[ "${GOOS}" == "windows" ] && FILE_EXT=".exe" # let's rename the release file because it has a 1:1 mapping with what it is called on # github releases, and therefore the name for each platform needs to be unique so that # they don't overwrite each other. Set a variable that can be used in .travis.yml -export RELEASE_FILE="${TRAVIS_BUILD_DIR}/taskcluster-proxy-${GIMME_OS}-${GIMME_ARCH}${FILE_EXT}" -mv "${GOPATH}/bin/${GIMME_OS}_${GIMME_ARCH}/taskcluster-proxy${FILE_EXT}" "${RELEASE_FILE}" +export RELEASE_FILE="${TRAVIS_BUILD_DIR}/taskcluster-proxy-${GOOS}-${GOARCH}${FILE_EXT}" +mv "${GOPATH}/bin/${GOOS}_${GOARCH}/taskcluster-proxy${FILE_EXT}" "${RELEASE_FILE}"