Skip to content

Commit

Permalink
ci: Add Code Test Coverage with CodeCov (sourcenetwork#116)
Browse files Browse the repository at this point in the history
Generates defra's code's testing coverage report and uploads it to CodeCov.
  • Loading branch information
shahzadlone authored Jan 14, 2022
1 parent cee48ce commit df2a81c
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
33 changes: 33 additions & 0 deletions .github/workflows/code-test-coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Code Test Coverage

on: [push]

jobs:
code-test-coverage:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 2

- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: '1.17'

- name: Generate coverage report
run: go test ./... -race -coverprofile=coverage.out -covermode=atomic

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
files: ./coverage.out
flags: unittests
name: codecov-umbrella
verbose: true
# path_to_write_report: ./coverage/codecov_report.txt
# directory: ./coverage/reports/
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<p align="center">
[![codecov](https://codecov.io/gh/sourcenetwork/defradb/branch/develop/graph/badge.svg?token=RHAORX13PA)](https://codecov.io/gh/sourcenetwork/defradb)

<p align="center">
<img height="120px" src="docs/DefraDB_Full-v2-cropped.png">
</p>

Expand Down

0 comments on commit df2a81c

Please sign in to comment.