Skip to content

Commit 7ab654e

Browse files
committed
[no-relnote] Add test coverage report
Signed-off-by: Evan Lezar <elezar@nvidia.com>
1 parent b69d98d commit 7ab654e

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed

.github/workflows/golang.yaml

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
args: -v --timeout 5m
5050
skip-cache: true
5151
- name: Check golang modules
52-
run: |
52+
run: |
5353
make check-vendor
5454
make -C deployments/devel check-modules
5555
test:
@@ -67,7 +67,29 @@ jobs:
6767
uses: actions/setup-go@v5
6868
with:
6969
go-version: ${{ env.GOLANG_VERSION }}
70-
- run: make test
70+
- run: make coverage
71+
72+
- name: Archive code coverage results
73+
uses: actions/upload-artifact@v4
74+
with:
75+
name: code-coverage
76+
path: coverage.out.no-mocks
77+
78+
code_coverage:
79+
name: "Code coverage report"
80+
if: github.event_name == 'pull_request' # Do not run when workflow is triggered by push to main branch
81+
runs-on: ubuntu-latest
82+
needs: tests # Depends on the artifact uploaded by the "unit_tests" job
83+
permissions:
84+
contents: read
85+
actions: read # to download code coverage results from "test" job
86+
pull-requests: write # write permission needed to comment on PR
87+
steps:
88+
- uses: fgrosse/go-coverage-report@v1.2.0 # Consider using a Git revision for maximum security
89+
with:
90+
coverage-artifact-name: "code-coverage" # can be omitted if you used this default value
91+
coverage-file-name: "coverage.out.no-mocks" # can be omitted if you used this default value
92+
7193
build:
7294
name: Build
7395
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)