X-Git-Url: https://gerrit.nordix.org/gitweb?a=blobdiff_plain;f=jjb%2Foransc%2Fverify-jobs-go.sh;h=84b3f5a090a64a53a512a5a373c7f9d3ce26d558;hb=a06137a59e3098c35c036037faec9326d0fb9667;hp=d5f70fc90c28b8a0e86e5cd48ddf1489c7a8a2b0;hpb=55ba9419845bfdaabf16e3b628ec2209b7ccbbd2;p=infra%2Fcicd.git diff --git a/jjb/oransc/verify-jobs-go.sh b/jjb/oransc/verify-jobs-go.sh index d5f70fc9..84b3f5a0 100644 --- a/jjb/oransc/verify-jobs-go.sh +++ b/jjb/oransc/verify-jobs-go.sh @@ -1,20 +1,26 @@ -#!/bin/bash +#!/bin/bash -x set -euo pipefail -cd $WORKSPACE +DIRECTORY=$WORKSPACE"/"${DIRECTORY} +cd $DIRECTORY -# read go version from go.mod file -version=$(grep '^go' go.mod | grep -Eo '[0-9]\.[0-9]+') +# Read desired Go version from go.mod file +desired_version=$(grep '^go' go.mod | grep -Eo '[0-9]\.[0-9]+') -echo "Download go $version" -curl -L "https://go.dev/dl/go$version.linux-amd64.tar.gz" | tar -C /usr/local -zxf - +# Remove existing Go installation +sudo rm -fr /usr/local/go + +echo "Download go $desired_version" +curl -L "https://go.dev/dl/go$desired_version.linux-amd64.tar.gz" | sudo tar -C /usr/local -zxf - export PATH=$PATH:/usr/local/go/bin -export CGO_ENABLED=0 echo "Download project deps" go mod tidy +echo "Force build" +go build -a -v + echo "Run tests" -go test ./... +go test ./... -json