Add CodeCov GitHub Action (#467)

* Add CodeCov GitHub Action

* Address Sundar's comment about blocking on coverage.

Since currently testing of components-contrib usually require building
with dapr/dapr, we don't yet have a lot of coverage. So we shouldn't
block PRs based on that.
This commit is contained in:
Nghia Tran 2020-09-22 12:57:00 -07:00 committed by GitHub
parent dd888565d7
commit 677645e191
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 1 deletions

15
.codecov.yaml Normal file
View File

@ -0,0 +1,15 @@
coverage:
# Commit status https://docs.codecov.io/docs/commit-status are used
# to block PR based on coverage threshold.
status:
project:
default:
informational: true
patch:
# Disable the coverage threshold of the patch, so that PRs are
# only failing because of overall project coverage threshold.
# See https://docs.codecov.io/docs/commit-status#disabling-a-status.
default: false
comment:
# Delete old comment and post new one for new coverage information.
behavior: new

View File

@ -60,5 +60,10 @@ jobs:
if: matrix.target_arch != 'arm'
run: make go.mod check-diff
- name: Run make test
env:
COVERAGE_OPTS: "-coverprofile=coverage.txt -covermode=atomic"
if: matrix.target_arch != 'arm'
run: make test
- name: Codecov
if: matrix.target_arch == 'amd64' && matrix.target_os == 'linux'
uses: codecov/codecov-action@v1

View File

@ -51,7 +51,7 @@ endif
################################################################################
.PHONY: test
test:
go test ./...
go test ./... $(COVERAGE_OPTS)
################################################################################
# Target: lint #