Skip to content

Commit 38bfd10

Browse files
authored
Upload code coverage of unit tests to codecov (#6321)
Code coverage is not being tracked for unittests, Tracking code coverage is important as it give insights on where to test and what to test This PR updates unit tests workflow to create coverage reports and upload the same to codecov using codecov github action Fixes #6289 Signed-off-by: Akshit Grover <[email protected]>
1 parent c316ba5 commit 38bfd10

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

.github/workflows/unit_tests.yml

+13-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
- '**/*.md'
88
branches:
99
- main
10-
permissions:
10+
permissions:
1111
contents: read
1212
jobs:
1313
go_unit_tests:
@@ -23,7 +23,12 @@ jobs:
2323
run: |
2424
go get gotest.tools/[email protected]
2525
# TODO: validate bin/protoc-go.sh does not dirty the repo
26-
gotestsum -- -cover -race -v -mod=readonly ./...
26+
gotestsum -- -cover -coverprofile=coverage.out -race -v -mod=readonly ./...
27+
- name: Upload coverage to Codecov
28+
uses: codecov/codecov-action@29386c70ef20e286228c72b668a06fd0e8399192
29+
with:
30+
files: ./coverage.out
31+
flags: unittests,golang
2732
js_unit_tests:
2833
name: JS unit tests
2934
timeout-minutes: 30
@@ -40,4 +45,9 @@ jobs:
4045
export PATH="$HOME/.yarn/bin:$PATH"
4146
export NODE_ENV=test
4247
bin/web --frozen-lockfile
43-
bin/web test --reporters="jest-dot-reporter" --reporters="./gh_ann_reporter.js"
48+
bin/web test --reporters="jest-dot-reporter" --reporters="./gh_ann_reporter.js" --coverage
49+
- name: Upload coverage to Codecov
50+
uses: codecov/codecov-action@29386c70ef20e286228c72b668a06fd0e8399192
51+
with:
52+
directory: ./web/app/coverage
53+
flags: unittests,javascript

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@ vendor
1717
**/charts/**/charts
1818
package-lock.json
1919
.vscode
20+
**/coverage*

0 commit comments

Comments
 (0)