From 8231e670e666b9c1e640f79a6b22c1f75430ee5c Mon Sep 17 00:00:00 2001 From: Wenqi Qiu Date: Tue, 30 Aug 2022 15:35:13 +0800 Subject: [PATCH] Add codecov setting for test coverge check Signed-off-by: Wenqi Qiu --- .github/workflows/go.yml | 7 +++++++ Makefile | 4 ++-- codecov.yaml | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 codecov.yaml diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index e71ab9e8..82a70657 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -47,6 +47,13 @@ jobs: - name: Run integration tests run: | make docker-test-integration + - name: Codecov + uses: codecov/codecov-action@v3 + with: + token: ${{ secrets.CODECOV_TOKEN }} + file: cover.out + flags: unit-tests + name: codecov-unit-test tidy: runs-on: [ubuntu-latest] diff --git a/Makefile b/Makefile index 8a3b04dd..48d8f0a9 100755 --- a/Makefile +++ b/Makefile @@ -37,7 +37,7 @@ test-integration: @echo @echo "==> Running integration tests <==" @echo "SOME TESTS WILL FAIL IF NOT RUN AS ROOT!" - $(GO) test antrea.io/ofnet/ofctrl/... + $(GO) test antrea.io/ofnet/ofctrl/... -v -coverprofile cover.out .PHONY: docker-test-integration docker-test-integration: @@ -54,7 +54,7 @@ endif -w /usr/src/antrea.io/ofnet \ -v $(DOCKER_CACHE)/gopath:/tmp/gopath \ -v $(DOCKER_CACHE)/gocache:/tmp/gocache \ - -v $(CURDIR):/usr/src/antrea.io/ofnet:ro \ + -v $(CURDIR):/usr/src/antrea.io/ofnet \ -v /lib/modules:/lib/modules \ ofnet/test test-integration $(USERID) $(GRPID) diff --git a/codecov.yaml b/codecov.yaml new file mode 100644 index 00000000..96e4e9d8 --- /dev/null +++ b/codecov.yaml @@ -0,0 +1,35 @@ +codecov: + branch: main + require_ci_to_pass: no + +comment: + layout: "reach,diff,flags,tree" + behavior: default + require_changes: no + require_base: no + require_head: no + after_n_builds: 1 + show_carryforward_flags: true + +github_checks: + annotations: true + +coverage: + status: + patch: + default: + target: 70% + threshold: 5% + base: auto + only_pulls: false + project: + default: + target: auto + threshold: 0.3% + +flag_management: + default_rules: + carryforward: true + +ignore: + - "**/testing/*.go"