From cf4990335ba01165c246af693811103f29d454f9 Mon Sep 17 00:00:00 2001 From: LiZhenCheng9527 Date: Wed, 10 Jul 2024 14:23:02 +0800 Subject: [PATCH 1/3] add codecov config Signed-off-by: LiZhenCheng9527 --- .codecov.yml | 8 ++++++++ .github/workflows/main.yml | 12 ++++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) create mode 100644 .codecov.yml diff --git a/.codecov.yml b/.codecov.yml new file mode 100644 index 000000000..4eae5d7fa --- /dev/null +++ b/.codecov.yml @@ -0,0 +1,8 @@ +coverage: + status: + project: #add everything under here, more options at https://docs.codecov.com/docs/commit-status + default: + # basic + target: auto #default + threshold: 35% + base: auto diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b58071e91..5333ec676 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -47,7 +47,11 @@ jobs: - name: Upload coverage reports to Codecov uses: codecov/codecov-action@v4.0.1 with: - token: ${{ secrets.CODECOV_TOKEN }} - files: coverage.out - flags: unittests - fail_ci_if_error: false \ No newline at end of file + # Even though token upload token is not required for public repos, + # but adding a token might increase successful uploads as per: + # https://community.codecov.com/t/upload-issues-unable-to-locate-build-via-github-actions-api/3954 + token: ${{ secrets.CODECOV_TOKEN }} + files: ./coverage.out + flags: unittests + fail_ci_if_error: false + verbose: true From 09c8622ffb607dfc12e8f3a41e270a08e41980a3 Mon Sep 17 00:00:00 2001 From: LiZhenCheng9527 Date: Wed, 10 Jul 2024 16:43:18 +0800 Subject: [PATCH 2/3] fix no CODECOV_TOKEN error Signed-off-by: LiZhenCheng9527 --- .github/workflows/main.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5333ec676..f13ff02b5 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -3,6 +3,10 @@ name: Kmesh CI Workflow on: pull_request: merge_group: # enable merge queue + workflow_call: + secrets: + CODECOV_TOKEN: + required: true jobs: @@ -45,7 +49,7 @@ jobs: sudo env LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib:$GITHUB_WORKSPACE/api/v2-c:$GITHUB_WORKSPACE/bpf/deserialization_to_bpf_map PKG_CONFIG_PATH=$GITHUB_WORKSPACE/mk go test -v -vet=off -coverprofile=coverage.out ./pkg/... - name: Upload coverage reports to Codecov - uses: codecov/codecov-action@v4.0.1 + uses: codecov/codecov-action@v4 with: # Even though token upload token is not required for public repos, # but adding a token might increase successful uploads as per: From 548ebc1bc0b11380b4ab7f20ded0fd555291277a Mon Sep 17 00:00:00 2001 From: LiZhenCheng9527 Date: Wed, 10 Jul 2024 16:58:56 +0800 Subject: [PATCH 3/3] change threshold to 50% Signed-off-by: LiZhenCheng9527 --- .codecov.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.codecov.yml b/.codecov.yml index 4eae5d7fa..f9936e3af 100644 --- a/.codecov.yml +++ b/.codecov.yml @@ -4,5 +4,8 @@ coverage: default: # basic target: auto #default - threshold: 35% + threshold: 50% base: auto +comment: # this is a top-level key + layout: "header, files, footer" # remove "new" from "header" and "footer" + hide_project_coverage: false # set to false \ No newline at end of file