mirror of
https://github.com/kyverno/kyverno.git
synced 2025-03-30 19:35:06 +00:00
Add codecov
to CI (#3382)
* Add `codecov` to CI Signed-off-by: Abhinav Sinha <abhinav@nirmata.com> * Add `codecov` badge for `main` to `README.md` Signed-off-by: Abhinav Sinha <abhinav@nirmata.com> * Addressed code review Signed-off-by: Abhinav Sinha <abhinav@nirmata.com>
This commit is contained in:
parent
851a81845c
commit
9bb7238a22
3 changed files with 42 additions and 4 deletions
35
.github/workflows/codecov.yaml
vendored
Normal file
35
.github/workflows/codecov.yaml
vendored
Normal file
|
@ -0,0 +1,35 @@
|
|||
name: Codecov
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- 'main'
|
||||
- 'release*'
|
||||
pull_request:
|
||||
branches:
|
||||
- 'main'
|
||||
- 'release*'
|
||||
|
||||
permissions: read-all
|
||||
|
||||
jobs:
|
||||
codecov:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||
steps:
|
||||
- uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # v2.4.0
|
||||
- uses: actions/setup-go@424fc82d43fa5a37540bae62709ddcc23d9520d4 # v2.1.5
|
||||
with:
|
||||
go-version: '1.17'
|
||||
-
|
||||
name: Generate Code Coverage Report
|
||||
run: make code-cov-report
|
||||
-
|
||||
name: Upload Report to Codecov
|
||||
uses: codecov/codecov-action@f32b3a3741e1053eb607407145bc9619351dc93b # v2.1.0
|
||||
with:
|
||||
file: ./coverage.out
|
||||
fail_ci_if_error: true
|
||||
verbose: true
|
10
Makefile
10
Makefile
|
@ -265,11 +265,13 @@ test-unit: $(GO_ACC)
|
|||
@echo " running unit tests"
|
||||
go-acc ./... -o $(CODE_COVERAGE_FILE_TXT)
|
||||
|
||||
code-cov-report: $(CODE_COVERAGE_FILE_TXT)
|
||||
# transform to html format
|
||||
code-cov-report:
|
||||
# generate code coverage report
|
||||
@echo " generating code coverage report"
|
||||
go tool cover -html=coverage.txt
|
||||
if [ -a $(CODE_COVERAGE_FILE_HTML) ]; then open $(CODE_COVERAGE_FILE_HTML); fi;
|
||||
|
||||
GO111MODULE=on go test -v -coverprofile=coverage.out ./...
|
||||
go tool cover -func=coverage.out -o $(CODE_COVERAGE_FILE_TXT)
|
||||
go tool cover -html=coverage.out -o $(CODE_COVERAGE_FILE_HTML)
|
||||
|
||||
# Test E2E
|
||||
test-e2e:
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||

|
||||
[](https://github.com/kyverno/kyverno/stargazers)
|
||||
[](https://bestpractices.coreinfrastructure.org/projects/5327)
|
||||
[](https://app.codecov.io/gh/kyverno/kyverno/branch/main)
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue