| #!/bin/bash |
| |
| # TODO(deklerk) Add integration tests when it's secure to do so. b/64723143 |
| |
| # Fail on any error |
| set -eo pipefail |
| |
| # Display commands being run |
| set -x |
| |
| # cd to project dir on Kokoro instance |
| cd git/gocloud |
| |
| go version |
| |
| # Set $GOPATH |
| export GOPATH="$HOME/go" |
| export GOCLOUD_HOME=$GOPATH/src/cloud.google.com/go/ |
| export PATH="$GOPATH/bin:$PATH" |
| |
| # Move code into $GOPATH and get dependencies |
| mkdir -p $GOCLOUD_HOME |
| git clone . $GOCLOUD_HOME |
| cd $GOCLOUD_HOME |
| |
| try3() { eval "$*" || eval "$*" || eval "$*"; } |
| |
| if [[ `go version` == *"go1.11"* ]]; then |
| export GO111MODULE=on |
| try3 go get . |
| else |
| try3 go get -v -t ./... |
| fi |
| |
| ./internal/kokoro/vet.sh |
| |
| # TODO(deklerk): Remove once tools are installed via tools.go. |
| go get github.com/jstemmer/go-junit-report |
| |
| # Run tests and tee output to log file, to be pushed to GCS as artifact. |
| # Also generate test summary in xUnit format to summarize the test execution. |
| mkdir $KOKORO_ARTIFACTS_DIR/tests |
| go test -race -v -timeout 15m -short ./... 2>&1 \ |
| | tee $KOKORO_ARTIFACTS_DIR/$KOKORO_GERRIT_CHANGE_NUMBER.txt \ |
| | go-junit-report >$KOKORO_ARTIFACTS_DIR/tests/sponge_log.xml |
| |