Skip to content

Commit bdc77af

Browse files
committed
Add Codecov integration for unit test coverage
Signed-off-by: Dev Kumar <dkuma@redhat.com>
1 parent 61b44a5 commit bdc77af

File tree

4 files changed

+34
-2
lines changed

4 files changed

+34
-2
lines changed

.codecov.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
coverage:
2+
status:
3+
project:
4+
default:
5+
target: auto
6+
threshold: 1%
7+
patch:
8+
default:
9+
target: auto
10+
threshold: 1%
11+
12+
flags:
13+
unit:
14+
paths:
15+
- "!test/e2e/"
16+
# e2e: reserved for future use when e2e coverage reporting is enabled
17+
# e2e:
18+
# paths:
19+
# - test/e2e/
20+
21+
comment:
22+
layout: "reach,diff,flags,files"
23+
behavior: default
24+

.github/workflows/integration.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,13 @@ jobs:
116116
- name: Run go unit tests
117117
run: make unit-test
118118

119+
- name: Upload unit test coverage to Codecov
120+
uses: codecov/codecov-action@v5
121+
with:
122+
files: cover-unit.out
123+
flags: unit
124+
token: ${{ secrets.CODECOV_TOKEN }}
125+
119126
- name: Build Spark operator
120127
run: make build-operator
121128

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,9 @@ go-lint-fix: golangci-lint ## Run golangci-lint linter and perform fixes.
162162
unit-test: setup-envtest ## Run unit tests.
163163
@echo "Running unit tests..."
164164
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)"
165-
go test $(shell go list ./... | grep -v /e2e) -coverprofile cover.out
165+
go test $(shell go list ./... | grep -v /e2e) -coverprofile cover-unit.out
166166
@echo "Generating HTML coverage report..."
167-
go tool cover -html=cover.out -o cover.html
167+
go tool cover -html=cover-unit.out -o cover.html
168168
@echo "Coverage report available at cover.html"
169169

170170
.PHONY: e2e-test

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Kubeflow Spark Operator
22

33
[![GitHub release](https://img.shields.io/github/v/release/kubeflow/spark-operator)](https://github.com/kubeflow/spark-operator/releases)
4+
[![codecov](https://codecov.io/gh/kubeflow/spark-operator/branch/main/graph/badge.svg)](https://codecov.io/gh/kubeflow/spark-operator)
45
[![Go Report Card](https://goreportcard.com/badge/github.com/kubeflow/spark-operator)](https://goreportcard.com/report/github.com/kubeflow/spark-operator)
56
[![Integration Test](https://github.com/kubeflow/spark-operator/actions/workflows/integration.yaml/badge.svg)](https://github.com/kubeflow/spark-operator/actions/workflows/integration.yaml)
67
[![Join Slack](https://img.shields.io/badge/Join_Slack-blue?logo=slack)](https://www.kubeflow.org/docs/about/community/#kubeflow-slack-channels)

0 commit comments

Comments
 (0)