Upgrade CodeQL version from v1 to v3 #1370
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: GoBuildAndTest | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: 1.17 | |
- name: Build | |
run: cd go/tunnels && go build -v ./... | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: 1.17 | |
- name: Test | |
run: cd go/tunnels && go test -short -v ./... | |
check-version-update: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Check Go SDK package version updated | |
run: | | |
SDK_DIR=go | |
FILE_WITH_PKG_VER=go/tunnels/tunnels.go | |
test -d $SDK_DIR && test -f $FILE_WITH_PKG_VER | |
BASE_SHA=$(jq -r '.pull_request.base.sha' "$GITHUB_EVENT_PATH") | |
# If go sdk dir updated, package version file updated and "PackageVersion" line updated, success; else error. | |
if git diff --name-only $BASE_SHA HEAD | grep -q "^$SDK_DIR"; then | |
if git diff --name-only $BASE_SHA HEAD | grep -q "^$FILE_WITH_PKG_VER" && git diff $BASE_SHA HEAD -- $FILE_WITH_PKG_VER | grep -q "PackageVersion"; then | |
echo "Success: Package version was updated." | |
exit 0 | |
else | |
echo "Error: An error occurred. Has "PackageVersion" in $FILE_WITH_PKG_VER been updated?" >&2 | |
exit 1 | |
fi | |
else | |
echo "No Go SDK changes detected." | |
fi |