nauman | 55ba941 | 2022-03-28 15:15:19 +0000 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | set -euo pipefail |
| 4 | |
| 5 | cd $WORKSPACE |
| 6 | |
| 7 | # read go version from go.mod file |
| 8 | version=$(grep '^go' go.mod | grep -Eo '[0-9]\.[0-9]+') |
| 9 | |
| 10 | echo "Download go $version" |
nauman | 016f4c0 | 2022-03-30 12:45:57 +0000 | [diff] [blame^] | 11 | curl -L "https://go.dev/dl/go$version.linux-amd64.tar.gz" | sudo tar -C /usr/local -zxf - |
nauman | 55ba941 | 2022-03-28 15:15:19 +0000 | [diff] [blame] | 12 | |
| 13 | export PATH=$PATH:/usr/local/go/bin |
nauman | 016f4c0 | 2022-03-30 12:45:57 +0000 | [diff] [blame^] | 14 | export CGO_ENABLED=0 |
nauman | 55ba941 | 2022-03-28 15:15:19 +0000 | [diff] [blame] | 15 | |
| 16 | echo "Download project deps" |
| 17 | go mod tidy |
| 18 | |
| 19 | echo "Run tests" |
| 20 | go test ./... |