Skip to content

Commit

Permalink
Upload code coverage of unit tests to codecov (#6321)
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
akshitgrover authored Jun 23, 2021
1 parent c316ba5 commit 38bfd10
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
16 changes: 13 additions & 3 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
- '**/*.md'
branches:
- main
permissions:
permissions:
contents: read
jobs:
go_unit_tests:
Expand All @@ -23,7 +23,12 @@ jobs:
run: |
go get gotest.tools/[email protected]
# TODO: validate bin/protoc-go.sh does not dirty the repo
gotestsum -- -cover -race -v -mod=readonly ./...
gotestsum -- -cover -coverprofile=coverage.out -race -v -mod=readonly ./...
- name: Upload coverage to Codecov
uses: codecov/codecov-action@29386c70ef20e286228c72b668a06fd0e8399192
with:
files: ./coverage.out
flags: unittests,golang
js_unit_tests:
name: JS unit tests
timeout-minutes: 30
Expand All @@ -40,4 +45,9 @@ jobs:
export PATH="$HOME/.yarn/bin:$PATH"
export NODE_ENV=test
bin/web --frozen-lockfile
bin/web test --reporters="jest-dot-reporter" --reporters="./gh_ann_reporter.js"
bin/web test --reporters="jest-dot-reporter" --reporters="./gh_ann_reporter.js" --coverage
- name: Upload coverage to Codecov
uses: codecov/codecov-action@29386c70ef20e286228c72b668a06fd0e8399192
with:
directory: ./web/app/coverage
flags: unittests,javascript
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ vendor
**/charts/**/charts
package-lock.json
.vscode
**/coverage*

0 comments on commit 38bfd10

Please sign in to comment.