diff --git a/.github/workflows/code-health.yml b/.github/workflows/code-health.yml index fecb79aa72..6d5568fee2 100644 --- a/.github/workflows/code-health.yml +++ b/.github/workflows/code-health.yml @@ -34,6 +34,26 @@ jobs: go-version-file: 'go.mod' - name: Unit Test run: make test + - name: Convert coverage report to Cobertura format + run: | + go install github.com/axw/gocov/gocov@latest + go install github.com/AlekSi/gocov-xml@latest + gocov convert coverage.out | gocov-xml > coverage.xml + - name: Code Coverage Summary Report + uses: irongut/CodeCoverageSummary@v1.3.0 + with: + filename: coverage.xml + format: markdown + hide_complexity: true + hide_branch_rate: false + output: both + badge: true + - name: Add Coverage PR Comment + uses: marocchino/sticky-pull-request-comment@v2 + if: github.event_name == 'pull_request' + with: + recreate: true + path: code-coverage-results.md lint: runs-on: ubuntu-latest steps: diff --git a/.gitignore b/.gitignore index 37222924be..79046c1e5e 100644 --- a/.gitignore +++ b/.gitignore @@ -31,6 +31,7 @@ service-account.json log.* test.env __debug_* +coverage.out website/vendor diff --git a/GNUmakefile b/GNUmakefile index fb1c75473e..175b61cf27 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -37,7 +37,7 @@ install: fmtcheck .PHONY: test test: fmtcheck - go test $(TEST) -timeout=30s -parallel=4 + go test $(TEST) -timeout=30s -parallel=4 -race -covermode=atomic -coverprofile=coverage.out .PHONY: testacc testacc: fmtcheck