-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add coverage evidence to the project
Configure CI to collect coverage and integrate with coveralls.io service. Move plugin packages out of `pkg` package, as they aren't exportable as library and their presence conflicts with `-coverpkg=./...` cover parameter. Add Makefile rules for merging coverage profiles from multiple sources, as tests are usually run by `make test-pkg` and `make test-controllers`. Add Makefile's rules to download gocovmerge and gcov2lcov. Signed-off-by: Andrea Panattoni <[email protected]>
- Loading branch information
Showing
8 changed files
with
25 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,3 +42,15 @@ jobs: | |
- name: test controllers on opensfhit | ||
run: CLUSTER_TYPE=openshift make test-controllers | ||
|
||
- name: merge test coverage | ||
run: make merge-test-coverage | ||
|
||
- uses: shogo82148/actions-goveralls@v1 | ||
with: | ||
path-to-profile: cover.out | ||
|
||
- name: Coveralls | ||
uses: coverallsapp/[email protected] | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
path-to-lcov: lcov.out |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -201,21 +201,31 @@ test-e2e-validation-only: | |
test-e2e: generate vet manifests skopeo | ||
mkdir -p ${ENVTEST_ASSETS_DIR} | ||
test -f ${ENVTEST_ASSETS_DIR}/setup-envtest.sh || curl -sSLo ${ENVTEST_ASSETS_DIR}/setup-envtest.sh https://raw.githubusercontent.com/kubernetes-sigs/controller-runtime/v0.8.3/hack/setup-envtest.sh | ||
source ${ENVTEST_ASSETS_DIR}/setup-envtest.sh; fetch_envtest_tools $(ENVTEST_ASSETS_DIR); setup_envtest_env $(ENVTEST_ASSETS_DIR); source hack/env.sh; go test ./test/e2e/... -timeout 60m -coverprofile cover.out -v | ||
source ${ENVTEST_ASSETS_DIR}/setup-envtest.sh; fetch_envtest_tools $(ENVTEST_ASSETS_DIR); setup_envtest_env $(ENVTEST_ASSETS_DIR); source hack/env.sh; go test ./test/e2e/... -timeout 60m coverprofile cover.out -v | ||
|
||
test-e2e-k8s: export NAMESPACE=sriov-network-operator | ||
test-e2e-k8s: test-e2e | ||
|
||
test-%: generate vet manifests | ||
mkdir -p ${ENVTEST_ASSETS_DIR} | ||
test -f ${ENVTEST_ASSETS_DIR}/setup-envtest.sh || curl -sSLo ${ENVTEST_ASSETS_DIR}/setup-envtest.sh https://raw.githubusercontent.com/kubernetes-sigs/controller-runtime/v0.8.3/hack/setup-envtest.sh | ||
source ${ENVTEST_ASSETS_DIR}/setup-envtest.sh; fetch_envtest_tools $(ENVTEST_ASSETS_DIR); setup_envtest_env $(ENVTEST_ASSETS_DIR); go test ./$*/... -coverprofile cover.out -v | ||
source ${ENVTEST_ASSETS_DIR}/setup-envtest.sh; fetch_envtest_tools $(ENVTEST_ASSETS_DIR); setup_envtest_env $(ENVTEST_ASSETS_DIR); go test ./$*/... -coverprofile cover-$*.out -coverpkg ./... -v | ||
|
||
# deploy-setup-k8s: export NAMESPACE=sriov-network-operator | ||
# deploy-setup-k8s: export ENABLE_ADMISSION_CONTROLLER=false | ||
# deploy-setup-k8s: export CNI_BIN_PATH=/opt/cni/bin | ||
# test-e2e-k8s: test-e2e | ||
|
||
gocovmerge: ## Download gocovmerge locally if necessary. | ||
go install -mod=readonly github.com/shabbyrobe/gocovmerge/cmd/gocovmerge@latest | ||
|
||
gcov2lcov: | ||
go install -mod=readonly github.com/jandelgado/[email protected] | ||
|
||
merge-test-coverage: gocovmerge gcov2lcov | ||
gocovmerge cover-*.out > cover.out | ||
gcov2lcov -infile cover.out -outfile lcov.out | ||
|
||
deploy-wait: | ||
hack/deploy-wait.sh | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.