🌱 Track code coverage

Track code coverage
https://github.com/ossf/scorecard/issues/986

Signed-off-by: naveen <172697+naveensrinivasan@users.noreply.github.com>
This commit is contained in:
naveen 2022-01-19 21:52:45 +00:00 committed by Naveen
parent 9973bdeb60
commit 2dcdbcd32b
3 changed files with 11 additions and 3 deletions

View File

@ -39,6 +39,11 @@ jobs:
run: |
go env -w GOFLAGS=-mod=mod
make -j 5 all
- name: Upload codecoverage
uses: codecov/codecov-action@f32b3a3741e1053eb607407145bc9619351dc93b # 2.1.0
with:
files: ./unit-coverage.out
verbose: true
license-check:
name: license boilerplate check
runs-on: ubuntu-latest

2
.gitignore vendored
View File

@ -26,6 +26,8 @@ results.json
# Output of the go coverage tool, specifically when used with LiteIDE.
*.coverprofile*
unit-coverage.out
e2e-coverage.out
# IDE directories.

View File

@ -267,12 +267,13 @@ test: $(test-targets)
unit-test: ## Runs unit test without e2e
# Run unit tests, ignoring e2e tests
go test -race -covermode atomic `go list ./... | grep -v e2e`
# run the go tests and gen the file coverage-all used to do the integration with codecov
go test -race -covermode=atomic -coverprofile=unit-coverage.out `go list ./... | grep -v e2e`
e2e: ## Runs e2e tests. Requires GITHUB_AUTH_TOKEN env var to be set to GitHub personal access token
e2e: build-scorecard check-env | $(GINKGO)
# Run e2e tests. GITHUB_AUTH_TOKEN with personal access token must be exported to run this
$(GINKGO) --race --skip="E2E TEST:executable" -p -v -cover ./...
$(GINKGO) --race --skip="E2E TEST:executable" -p -v -cover -coverprofile=filename ./...
$(GINKGO): install
@ -281,7 +282,7 @@ ci-e2e: build-scorecard check-env | $(GINKGO)
# Run CI e2e tests. GITHUB_AUTH_TOKEN with personal access token must be exported to run this
$(call ndef, GITHUB_AUTH_TOKEN)
@echo Ignoring these test for ci-e2e $(IGNORED_CI_TEST)
$(GINKGO) -p -v -cover --skip=$(IGNORED_CI_TEST) ./e2e/...
$(GINKGO) -p -v -cover --skip=$(IGNORED_CI_TEST) -coverprofile=e2e-coverage.out ./e2e/...
check-env: