From f475c4c07cb38abe46baa132504fce831e9e5bfa Mon Sep 17 00:00:00 2001 From: xuezhaojun Date: Mon, 5 Jun 2023 15:32:22 +0800 Subject: [PATCH] Add: codecov configuration. Signed-off-by: xuezhaojun --- .codecov.yml | 10 ++++++++++ .github/workflows/pre.yml | 9 +++++++++ Makefile | 1 + 3 files changed, 20 insertions(+) create mode 100644 .codecov.yml diff --git a/.codecov.yml b/.codecov.yml new file mode 100644 index 000000000..b6250420a --- /dev/null +++ b/.codecov.yml @@ -0,0 +1,10 @@ +coverage: + status: + patch: off # disable patch status, https://docs.codecov.com/docs/commit-status#patch-status + project: + default: + target: auto + threshold: 1% + +ignore: + - "**/*generated*.go" diff --git a/.github/workflows/pre.yml b/.github/workflows/pre.yml index 44116418c..74e4c4a3e 100644 --- a/.github/workflows/pre.yml +++ b/.github/workflows/pre.yml @@ -68,6 +68,15 @@ jobs: go-version: ${{ env.GO_VERSION }} - name: unit run: make test + - name: report coverage + uses: codecov/codecov-action@v3 + with: + token: ${{ secrets.CODECOV_UPLOAD_TOKEN }} + files: ./coverage.out + flags: unit + name: unit + verbose: true + fail_ci_if_error: true integration: name: integration diff --git a/Makefile b/Makefile index 2524e48f7..a918f1b59 100644 --- a/Makefile +++ b/Makefile @@ -25,6 +25,7 @@ endif # Add packages to do unit test GO_TEST_PACKAGES :=./pkg/... +GO_TEST_FLAGS := -race -coverprofile=coverage.out IMAGE_REGISTRY?=quay.io/open-cluster-management IMAGE_TAG?=latest