Debian Codegraph @

internal/kokoro/test.sh

raw
1 #!/bin/bash
2
3 # Fail on any error
4 set -eo pipefail
5
6 # Display commands being run
7 set -x
8
9 # cd to project dir on Kokoro instance
10 cd github/go-genproto
11 git config --global --add safe.directory "$(pwd)/./.git"
12
13 go version
14
15 # Set $GOPATH
16 export GOPATH="$HOME/go"
17 export GENPROTO_HOME=$GOPATH/src/google.golang.org/genproto
18 export PATH="$GOPATH/bin:$PATH"
19 export GO111MODULE=on
20 mkdir -p $GENPROTO_HOME
21
22 # Move code into $GOPATH and get dependencies
23 git clone . $GENPROTO_HOME
24 cd $GENPROTO_HOME
25
26 try3() { eval "$*" || eval "$*" || eval "$*"; }
27
28 # All packages, including +build tools, are fetched.
29 try3 go mod download
30 ./internal/kokoro/vet.sh
31
32 go get github.com/jstemmer/go-junit-report
33
34 set +e
35
36 exit_code = 0
37 go_test_args=("-race" "-timeout" "10m")
38
39 gotestsum --packages="./..." \
40 --junitfile sponge_log.xml \
41 --format standard-verbose \
42 -- "${go_test_args[@]}" 2>&1 | tee sponge_log.log
43 exit_code=$(($exit_code + $?))
44
45 # Send logs to Flaky Bot for continuous builds.
46 if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"continuous"* ]]; then
47 chmod +x $KOKORO_GFILE_DIR/linux_amd64/flakybot
48 $KOKORO_GFILE_DIR/linux_amd64/flakybot \
49 -logs_dir=$KOKORO_ARTIFACTS_DIR \
50 -repo=googleapis/go-genproto
51 fi
52
53 exit $exit_code