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 <akshit.grover2016@gmail.com>
This commit is contained in:
Akshit Grover 2021-06-23 21:45:01 +05:30 committed by GitHub
parent c316ba59a6
commit 38bfd10815
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 3 deletions

View File

@ -7,7 +7,7 @@ on:
- '**/*.md'
branches:
- main
permissions:
permissions:
contents: read
jobs:
go_unit_tests:
@ -23,7 +23,12 @@ jobs:
run: |
go get gotest.tools/gotestsum@v0.4.2
# 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
@ -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
.gitignore vendored
View File

@ -17,3 +17,4 @@ vendor
**/charts/**/charts
package-lock.json
.vscode
**/coverage*