Skip to content

Update Go to v1.22.2 #214

Update Go to v1.22.2

Update Go to v1.22.2 #214

Workflow file for this run

name: Test Incoming Changes
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:
jobs:
test:
name: Run Tests
runs-on: ubuntu-22.04
steps:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.22.2
- name: Check out code into the Go module directory
uses: actions/checkout@v4
- name: Run Tests
run: make generate-golang-schema build tests
- name: Quality Gate - Test coverage shall be above threshold
env:
TESTCOVERAGE_THRESHOLD: 40
run: |
echo "Quality Gate: checking test coverage is above threshold ..."
echo "Threshold : $TESTCOVERAGE_THRESHOLD %"
totalCoverage=`go tool cover -func=cover.out | grep total | grep -Eo '[0-9]+\.[0-9]+'`
echo "Current test coverage : $totalCoverage %"
if (( $(echo "$totalCoverage $TESTCOVERAGE_THRESHOLD" | awk '{print ($1 > $2)}') )); then
echo "OK"
else
echo "Current test coverage is below threshold. Please add more unit tests or adjust threshold to a lower value."
echo "Failed"
exit 1
fi