summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/codecov.yml12
-rw-r--r--.github/workflows/main.yaml11
-rwxr-xr-xhack/lib/golang.sh1
3 files changed, 22 insertions, 2 deletions
diff --git a/.github/codecov.yml b/.github/codecov.yml
new file mode 100644
index 000000000..a94af3013
--- /dev/null
+++ b/.github/codecov.yml
@@ -0,0 +1,12 @@
+coverage:
+ status:
+ project: off
+ # https://docs.codecov.com/docs/commit-status#patch-status
+ patch:
+ default:
+ target: 80%
+ informational: false
+ if_ci_failed: error
+
+# https://docs.codecov.com/docs/pull-request-comments#disable-comment
+comment: false
diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml
index 75f76d8c1..d12db57d1 100644
--- a/.github/workflows/main.yaml
+++ b/.github/workflows/main.yaml
@@ -136,7 +136,16 @@ jobs:
with:
fetch-depth: 0
- - run: make test
+ - run: make test PROFILE=y
+
+ - name: Upload coverage to Codecov
+ uses: codecov/codecov-action@v3
+ with:
+ files: ./coverage.out
+ flags: unittests
+ fail_ci_if_error: true
+ verbose: true
+
- run: make integrationtest
diff --git a/hack/lib/golang.sh b/hack/lib/golang.sh
index deda28e7d..aa93125d1 100755
--- a/hack/lib/golang.sh
+++ b/hack/lib/golang.sh
@@ -447,7 +447,6 @@ kubeedge::golang::run_test() {
local profile=${PROFILE:-""}
if [[ $profile ]]; then
go test "-coverprofile=${profile}" ${testdirs[@]}
- go tool cover -func=${profile}
else
go test ${testdirs[@]}
fi