diff --git a/.codecov.yml b/.codecov.yml new file mode 100644 index 000000000..f9936e3af --- /dev/null +++ b/.codecov.yml @@ -0,0 +1,11 @@ +coverage: + status: + project: #add everything under here, more options at https://docs.codecov.com/docs/commit-status + default: + # basic + target: auto #default + 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 diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b58071e91..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,9 +49,13 @@ 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: - 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