Skip to content

Commit

Permalink
feat: add coverage report to PRs (#1496)
Browse files Browse the repository at this point in the history
  • Loading branch information
andreaangiolillo authored Sep 26, 2023
1 parent 1fabeeb commit 86ac961
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
20 changes: 20 additions & 0 deletions .github/workflows/code-health.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected]
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:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ service-account.json
log.*
test.env
__debug_*
coverage.out

website/vendor

Expand Down
2 changes: 1 addition & 1 deletion GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 86ac961

Please sign in to comment.