From 8c27edc940bcf229596508536d49dac79b032bcf Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Wed, 25 Mar 2026 16:51:15 +0200 Subject: ci: Add test coverage check to CI pipeline - Updated .github/workflows/ci.yml to run tests with coverage - Enforces minimum 60% coverage threshold - Uploads coverage report as artifact for review Coverage check command: go test -coverprofile=coverage.out ./... go tool cover -func=coverage.out | grep total --- .github/workflows/ci.yml | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to '.github') diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 36b383e..8fd0031 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,8 +18,19 @@ jobs: with: go-version: '1.22' - - name: Run tests - run: go test ./... + - name: Run tests with coverage + run: | + go test -coverprofile=coverage.out ./... + if [ "$(go tool cover -func=coverage.out | grep total | awk '{print $3}' | tr -d '%')" -lt 60 ]; then + echo "Coverage below 60%" + exit 1 + fi + + - name: Upload coverage to GitHub + uses: actions/upload-artifact@v4 + with: + name: coverage-report + path: coverage.out lint: runs-on: ubuntu-latest -- cgit v1.2.3