diff options
| author | Paul Buetow <paul@buetow.org> | 2026-03-25 16:51:15 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-03-25 16:51:15 +0200 |
| commit | e51331be9cb32ad203ce222321c97f82ba2f189f (patch) | |
| tree | a3501689f4537423ea3d3a41eb58faf53c14d5ce /.github/workflows/ci.yml | |
| parent | 1a48b600d1dbd7b185de3a466bc5672683640de4 (diff) | |
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
Diffstat (limited to '.github/workflows/ci.yml')
| -rw-r--r-- | .github/workflows/ci.yml | 15 |
1 files changed, 13 insertions, 2 deletions
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 |
