Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 

45 lignes
1.1 KiB

  1. #!/bin/bash
  2. # TODO(deklerk) Add integration tests when it's secure to do so. b/64723143
  3. # Fail on any error
  4. set -eo pipefail
  5. # Display commands being run
  6. set -x
  7. # cd to project dir on Kokoro instance
  8. cd git/google-api-go-client
  9. go version
  10. # Set $GOPATH
  11. export GOPATH="$HOME/go"
  12. export GOCLOUD_HOME=$GOPATH/src/google.golang.org/api/
  13. export PATH="$GOPATH/bin:$PATH"
  14. mkdir -p $GOCLOUD_HOME
  15. # Move code into $GOPATH and get dependencies
  16. git clone . $GOCLOUD_HOME
  17. cd $GOCLOUD_HOME
  18. try3() { eval "$*" || eval "$*" || eval "$*"; }
  19. download_deps() {
  20. if [[ `go version` == *"go1.11"* ]] || [[ `go version` == *"go1.12"* ]]; then
  21. export GO111MODULE=on
  22. # All packages, including +build tools, are fetched.
  23. try3 go mod download
  24. else
  25. # Because we don't provide -tags tools, the +build tools
  26. # dependencies aren't fetched.
  27. try3 go get -v -t ./...
  28. fi
  29. }
  30. download_deps
  31. ./internal/kokoro/vet.sh
  32. # Run tests and tee output to log file, to be pushed to GCS as artifact.
  33. go test -race -v -short ./... 2>&1 | tee $KOKORO_ARTIFACTS_DIR/$KOKORO_GERRIT_CHANGE_NUMBER.txt