CI verify jobs for oransc golang projects
[infra/cicd.git] / jjb / oransc / verify-jobs-go.sh
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"
11 curl -L  "https://go.dev/dl/go$version.linux-amd64.tar.gz" | tar -C /usr/local -zxf -
12
13 export PATH=$PATH:/usr/local/go/bin
14 export CGO_ENABLED=0 
15
16 echo "Download project deps"
17 go mod tidy
18
19 echo "Run tests"
20 go test ./...