diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 52114dffe..b19fe6a5e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -23,6 +23,7 @@ jobs: permissions: contents: read packages: write + id-token: write steps: - name: Checkout source uses: actions/checkout@v4 @@ -46,6 +47,15 @@ jobs: - name: Build operator container run: make docker-build docker-push + - name: Upload coverage to Codecov + if: always() + uses: codecov/codecov-action@v6 + with: + files: coverage.out + flags: unit + use_oidc: true + fail_ci_if_error: false + build-bundle: name: Build-bundle-image runs-on: ubuntu-24.04 diff --git a/Makefile b/Makefile index f5bd54998..a3cd17103 100644 --- a/Makefile +++ b/Makefile @@ -126,7 +126,7 @@ vet: ## Run go vet against code. .PHONY: test test: manifests generate fmt vet envtest ## Run tests. - KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test $$(go list ./... | grep -v /e2e) + KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test -coverprofile=coverage.out $$(go list ./... | grep -v /e2e) # Utilize Kind or modify the e2e tests to load the image locally, enabling compatibility with other vendors. .PHONY: test-e2e # Run the e2e tests against a Kind k8s instance that is spun up. diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 000000000..d85a2ecdc --- /dev/null +++ b/codecov.yml @@ -0,0 +1,15 @@ +coverage: + status: + project: + default: + target: auto + informational: true + patch: + default: + target: 70% + threshold: 5% + informational: true + +flag_management: + default_rules: + carryforward: true