Skip to content

Commit

Permalink
Improve coverage reporting
Browse files Browse the repository at this point in the history
1. Improve make coverage to take integration test into account
2. Upload coverage report as an artifact of CI

Signed-off-by: Yutaro Hayakawa <[email protected]>
  • Loading branch information
YutaroHayakawa committed May 26, 2024
1 parent 5c52f3a commit 64fe96a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
11 changes: 7 additions & 4 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@ jobs:
with:
go-version-file: ./go.mod

- name: Run unit tests
run: go test -v
- name: Run tests
run: go test -v -exec "sudo" -coverpkg=./... -coverprofile=coverage.out ./...

- name: Run integration tests
run: go test -exec "sudo -E" -v ./integration_tests
- name: Upload coverage report
uses: actions/upload-artifact@v4
with:
name: coverage.html
path: coverage.html
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ check-deepcopy:
git diff --exit-code zz_generated_deepcopy.go || echo "deepcopy is not up to date. Please commit the changes."; git diff zz_generated_deepcopy.go

coverage:
go test -cover -coverprofile=coverage.out -v
go test -v -exec "sudo" -coverpkg=./... -coverprofile=coverage.out ./...
go tool cover -html=coverage.out -o coverage.html

0 comments on commit 64fe96a

Please sign in to comment.