From 16b012784c926bb4bb19ad356d46828302420b2f Mon Sep 17 00:00:00 2001 From: James Hodgkinson Date: Wed, 19 Mar 2025 19:18:44 +1000 Subject: [PATCH] fix: test on minimal and stable golang versions (#183) fix: test on minimal and stable golang versions --------- Signed-off-by: Mario Candela Signed-off-by: James Hodgkinson Co-authored-by: Mario Candela --- .github/workflows/ci.yml | 14 +++++++++++--- .gitignore | 3 ++- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 69ffcbf..8579fb6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,6 +9,12 @@ on: jobs: CI: + strategy: + fail-fast: false + matrix: + go-version: + - "1.20.0" + - "stable" runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -16,7 +22,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v3 with: - go-version: 1.20.0 + go-version: ${{ matrix.go-version }} - name: Dependencies run: go mod download @@ -35,12 +41,12 @@ jobs: - name: Quality Gate - Test coverage shall be above threshold env: - TESTCOVERAGE_THRESHOLD: 65 + TESTCOVERAGE_THRESHOLD: 75 run: | echo "Quality Gate: checking test coverage is above threshold ..." echo "Threshold : $TESTCOVERAGE_THRESHOLD %" # Excluded the concrete strategy from the unit test coverage, because covered by integration tests - cat coverage.tmp.out | grep -v "ssh.go" | grep -v "http.go" | grep -v "tcp.go" > coverage.out + cat coverage.tmp.out | grep -v "ssh.go" | grep -v "http.go" | grep -v "tcp.go" | grep -v "builder.go" | grep -v "director.go" > coverage.out totalCoverage=`go tool cover -func=coverage.out | grep total | grep -Eo '[0-9]+\.[0-9]+'` echo "Current test coverage : $totalCoverage %" if (( $(echo "$totalCoverage $TESTCOVERAGE_THRESHOLD" | awk '{print ($1 > $2)}') )); then @@ -53,6 +59,8 @@ jobs: - name: Upload coverage reports to Codecov uses: codecov/codecov-action@v3 + with: + files: ./coverage.out env: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} diff --git a/.gitignore b/.gitignore index 66b7101..f81da62 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ .idea logs .vscode -.history \ No newline at end of file +.history +coverage*.out