Skip to content

Commit

Permalink
Add codecov for unit test coverage (#585)
Browse files Browse the repository at this point in the history
* Add codecov for unit test coverage

* Add codecov badge into readme file

Co-authored-by: rick <linuxsuren@users.noreply.github.com>
  • Loading branch information
LinuxSuRen and LinuxSuRen committed Jun 29, 2021
1 parent c29637f commit cf48bf6
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 4 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/pull-request.yaml
Expand Up @@ -98,3 +98,25 @@ jobs:
# run: |
# export PATH=$PATH:${PWD}/bin:$GOPATH/bin:/home/runner/go/bin
# make test
UnitTest:
name: Test
runs-on: ubuntu-20.04
steps:
- name: Set up Go 1.15
uses: actions/setup-go@v2.1.3
with:
go-version: 1.15
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v2.3.4
- name: Test
run: |
make test
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.out
flags: unittests
name: codecov-umbrella
fail_ci_if_error: true
3 changes: 1 addition & 2 deletions Makefile
Expand Up @@ -131,8 +131,7 @@ test-slow:

test:
mkdir -p bin
go test ./util ./client ./app/ ./app/health ./app/helper ./app/i18n ./app/cmd/common -v -count=1 -coverprofile coverage.out
go test ./app/cmd -v -count=1
go test ./util ./app/health ./app/i18n ./app/cmd/common -v -count=1 -coverprofile coverage.out
# go test ./util -v -count=1
# go test ./client -v -count=1 -coverprofile coverage.out
# go test ./app -v -count=1
Expand Down
2 changes: 1 addition & 1 deletion README-zh.md
Expand Up @@ -9,7 +9,7 @@
-->
[![](https://goreportcard.com/badge/jenkins-zh/jenkins-cli)](https://goreportcard.com/report/jenkins-zh/jenkins-cli)
[![](http://img.shields.io/badge/godoc-reference-5272B4.svg?style=flat-square)](https://godoc.org/github.com/jenkins-zh/jenkins-cli)
![Sonar Coverage](https://img.shields.io/sonar/coverage/jenkins-zh_jenkins-cli?server=https%3A%2F%2Fsonarcloud.io)
[![codecov](https://codecov.io/gh/jenkins-zh/jenkins-cli/branch/master/graph/badge.svg?token=XS8g2CjdNL)](https://codecov.io/gh/jenkins-zh/jenkins-cli)
[![Contributors](https://img.shields.io/github/contributors/jenkins-zh/jenkins-cli.svg)](https://github.com/jenkins-zh/jenkins-cli/graphs/contributors)
[![GitHub release](https://img.shields.io/github/release/jenkins-zh/jenkins-cli.svg?label=release)](https://github.com/jenkins-zh/jenkins-cli/releases/latest)
![GitHub All Releases](https://img.shields.io/github/downloads/jenkins-zh/jenkins-cli/total)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -9,7 +9,7 @@
-->
[![](https://goreportcard.com/badge/jenkins-zh/jenkins-cli)](https://goreportcard.com/report/jenkins-zh/jenkins-cli)
[![](http://img.shields.io/badge/godoc-reference-5272B4.svg?style=flat-square)](https://godoc.org/github.com/jenkins-zh/jenkins-cli)
![Sonar Coverage](https://img.shields.io/sonar/coverage/jenkins-zh_jenkins-cli?server=https%3A%2F%2Fsonarcloud.io)
[![codecov](https://codecov.io/gh/jenkins-zh/jenkins-cli/branch/master/graph/badge.svg?token=XS8g2CjdNL)](https://codecov.io/gh/jenkins-zh/jenkins-cli)
[![Contributors](https://img.shields.io/github/contributors/jenkins-zh/jenkins-cli.svg)](https://github.com/jenkins-zh/jenkins-cli/graphs/contributors)
[![GitHub release](https://img.shields.io/github/release/jenkins-zh/jenkins-cli.svg?label=release)](https://github.com/jenkins-zh/jenkins-cli/releases/latest)
![GitHub All Releases](https://img.shields.io/github/downloads/jenkins-zh/jenkins-cli/total)
Expand Down

0 comments on commit cf48bf6

Please sign in to comment.