From 47a406431a9d795fddfca00cf59ba67b025a39fb Mon Sep 17 00:00:00 2001 From: Shreyas Kirtane Date: Thu, 23 Jan 2025 16:45:06 -0700 Subject: [PATCH 1/9] [jaeger-idl] adding coverage calculation and badge Signed-off-by: Shreyas Kirtane --- .github/actions/upload-codecov/action.yml | 34 +++++++++++++++++++++++ .github/workflows/ci-unit-tests.yml | 10 +++---- Makefile | 3 +- README.md | 3 ++ 4 files changed, 43 insertions(+), 7 deletions(-) create mode 100644 .github/actions/upload-codecov/action.yml diff --git a/.github/actions/upload-codecov/action.yml b/.github/actions/upload-codecov/action.yml new file mode 100644 index 0000000..087c5d2 --- /dev/null +++ b/.github/actions/upload-codecov/action.yml @@ -0,0 +1,34 @@ +# Copyright (c) 2023 The Jaeger Authors. +# SPDX-License-Identifier: Apache-2.0 + +# Codecov upload often fails on rate limits if used without a token. +# See https://github.com/codecov/codecov-action/issues/837 +# This action embeds a token directly. +# We cannot define it as "secret" as we need it accessible from forks. + +name: 'Upload coverage to codecov' +description: 'Uploads coverage to codecov with retries' +inputs: + files: + description: 'Coverage files to upload' + required: true + flags: + description: 'Flags for codecov' + required: true +runs: + using: 'composite' + steps: + - name: Retry upload + uses: Wandalen/wretry.action@v3.7.0 + with: + attempt_limit: 6 + # sleep 10 seconds between retries + attempt_delay: 10000 + action: codecov/codecov-action@v5 + with: | + slug: jaegertracing/jaeger-idl + files: ${{ inputs.files }} + flags: ${{ inputs.flags }} + verbose: true + fail_ci_if_error: true + token: 95fab3d9-8038-40ba-ac56-0d8bd91390a4 \ No newline at end of file diff --git a/.github/workflows/ci-unit-tests.yml b/.github/workflows/ci-unit-tests.yml index e32cc2f..4af9b22 100644 --- a/.github/workflows/ci-unit-tests.yml +++ b/.github/workflows/ci-unit-tests.yml @@ -35,13 +35,11 @@ jobs: - name: Run unit tests run: make test-ci - - name: Upload coverage reports to Codecov - uses: codecov/codecov-action@v5 + - name: Upload coverage to codecov + uses: ./.github/actions/upload-codecov with: - slug: jaegertracing/jaeger-idl - verbose: true - fail_ci_if_error: true - token: 95fab3d9-8038-40ba-ac56-0d8bd91390a4 + files: coverage.txt + flags: unittests test-code-gen: runs-on: ubuntu-latest diff --git a/Makefile b/Makefile index dffdf5c..b25cd12 100644 --- a/Makefile +++ b/Makefile @@ -40,6 +40,7 @@ swagger-validate: clean: rm -rf *gen-* || true rm -rf .*gen-* || true + rm -rf coverage.txt .PHONY: thrift thrift: thrift-image clean $(THRIFT_FILES) @@ -158,7 +159,7 @@ endef .PHONY: test-ci test-ci: - go test -v -coverprofile=coverage.txt ./... + go test -v -coverprofile=coverage.txt ./... && sed -i '/^github.com\/jaegertracing\/jaeger-idl\/model\/v1\/model.pb.go/d' coverage.txt # proto target is used to generate source code that is released as part of this library proto: proto-prepare proto-api-v2 proto-prototest diff --git a/README.md b/README.md index 449cfb6..396ea84 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ # jaeger-idl [![Build Status][ci-img]][ci] +[![Coverage Status][cov-img]][cov] A set of shared Thrift and Protobuf data model definitions used by the Jaeger components. @@ -35,3 +36,5 @@ See [CONTRIBUTING](./CONTRIBUTING.md). [ci-img]: https://github.com/jaegertracing/jaeger-idl/actions/workflows/ci-unit-tests.yml/badge.svg [ci]: https://github.com/jaegertracing/jaeger-idl/actions/workflows/ci-unit-tests.yml +[cov-img]: https://codecov.io/gh/jaegertracing/jaeger-idl/branch/main/graph/badge.svg +[cov]: https://codecov.io/gh/jaegertracing/jaeger-idl/branch/main/ From 4d7293eb6b8a432fe6f0ca686adcc08876ce6cee Mon Sep 17 00:00:00 2001 From: Shreyas Kirtane Date: Thu, 23 Jan 2025 18:44:36 -0700 Subject: [PATCH 2/9] fixing issues in pr Signed-off-by: Shreyas Kirtane --- .codecov.yml | 22 +++++++++++++++ .github/actions/upload-codecov/action.yml | 34 ----------------------- .github/workflows/ci-unit-tests.yml | 19 +++++++++---- Makefile | 2 +- 4 files changed, 37 insertions(+), 40 deletions(-) create mode 100644 .codecov.yml delete mode 100644 .github/actions/upload-codecov/action.yml diff --git a/.codecov.yml b/.codecov.yml new file mode 100644 index 0000000..35f2ed6 --- /dev/null +++ b/.codecov.yml @@ -0,0 +1,22 @@ +codecov: + notify: + require_ci_to_pass: yes + after_n_builds: 18 + strict_yaml_branch: main # only use the latest copy on the main branch + +ignore: + - "model/v1/model.pb.go" + +coverage: + precision: 2 + round: down + range: "95...100" + status: + project: + default: + enabled: yes + target: 95% + patch: + default: + enabled: yes + target: 95% \ No newline at end of file diff --git a/.github/actions/upload-codecov/action.yml b/.github/actions/upload-codecov/action.yml deleted file mode 100644 index 087c5d2..0000000 --- a/.github/actions/upload-codecov/action.yml +++ /dev/null @@ -1,34 +0,0 @@ -# Copyright (c) 2023 The Jaeger Authors. -# SPDX-License-Identifier: Apache-2.0 - -# Codecov upload often fails on rate limits if used without a token. -# See https://github.com/codecov/codecov-action/issues/837 -# This action embeds a token directly. -# We cannot define it as "secret" as we need it accessible from forks. - -name: 'Upload coverage to codecov' -description: 'Uploads coverage to codecov with retries' -inputs: - files: - description: 'Coverage files to upload' - required: true - flags: - description: 'Flags for codecov' - required: true -runs: - using: 'composite' - steps: - - name: Retry upload - uses: Wandalen/wretry.action@v3.7.0 - with: - attempt_limit: 6 - # sleep 10 seconds between retries - attempt_delay: 10000 - action: codecov/codecov-action@v5 - with: | - slug: jaegertracing/jaeger-idl - files: ${{ inputs.files }} - flags: ${{ inputs.flags }} - verbose: true - fail_ci_if_error: true - token: 95fab3d9-8038-40ba-ac56-0d8bd91390a4 \ No newline at end of file diff --git a/.github/workflows/ci-unit-tests.yml b/.github/workflows/ci-unit-tests.yml index 4af9b22..295fe20 100644 --- a/.github/workflows/ci-unit-tests.yml +++ b/.github/workflows/ci-unit-tests.yml @@ -34,12 +34,21 @@ jobs: - name: Run unit tests run: make test-ci - - - name: Upload coverage to codecov - uses: ./.github/actions/upload-codecov + + - name: upload code coverage + uses: Wandalen/wretry.action@v3.7.0 with: - files: coverage.txt - flags: unittests + attempt_limit: 6 + # sleep 10 seconds between retries + attempt_delay: 10000 + action: codecov/codecov-action@v5 + with: | + slug: jaegertracing/jaeger-idl + files: coverage.txt + flags: unittests + verbose: true + fail_ci_if_error: true + token: 95fab3d9-8038-40ba-ac56-0d8bd91390a4 test-code-gen: runs-on: ubuntu-latest diff --git a/Makefile b/Makefile index b25cd12..82f2a48 100644 --- a/Makefile +++ b/Makefile @@ -159,7 +159,7 @@ endef .PHONY: test-ci test-ci: - go test -v -coverprofile=coverage.txt ./... && sed -i '/^github.com\/jaegertracing\/jaeger-idl\/model\/v1\/model.pb.go/d' coverage.txt + go test -v -coverprofile=coverage.txt ./... # proto target is used to generate source code that is released as part of this library proto: proto-prepare proto-api-v2 proto-prototest From 133a94fd44bdbd5f40941d8cc6dd623ba3431b6a Mon Sep 17 00:00:00 2001 From: Shreyas Kirtane Date: Thu, 23 Jan 2025 18:46:52 -0700 Subject: [PATCH 3/9] fixing issues in pr Signed-off-by: Shreyas Kirtane --- .github/workflows/ci-unit-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-unit-tests.yml b/.github/workflows/ci-unit-tests.yml index 295fe20..9087e7e 100644 --- a/.github/workflows/ci-unit-tests.yml +++ b/.github/workflows/ci-unit-tests.yml @@ -34,7 +34,7 @@ jobs: - name: Run unit tests run: make test-ci - + - name: upload code coverage uses: Wandalen/wretry.action@v3.7.0 with: From 75cd5ac78579c7f98329680a3e579b5f1b4ecb79 Mon Sep 17 00:00:00 2001 From: Shreyas Kirtane Date: Thu, 23 Jan 2025 20:32:52 -0700 Subject: [PATCH 4/9] address new comments Signed-off-by: Shreyas Kirtane --- .codecov.yml | 2 +- .gitignore | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.codecov.yml b/.codecov.yml index 35f2ed6..3bff4e9 100644 --- a/.codecov.yml +++ b/.codecov.yml @@ -1,11 +1,11 @@ codecov: notify: require_ci_to_pass: yes - after_n_builds: 18 strict_yaml_branch: main # only use the latest copy on the main branch ignore: - "model/v1/model.pb.go" + - "proto-gen/*/*" coverage: precision: 2 diff --git a/.gitignore b/.gitignore index 6eae0f3..396dc68 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .idea/ gen-*/ .proto-gen-polyglot/ +coverage.txt From b26cfcaef13d11272f9b0c39e80800e286d109d7 Mon Sep 17 00:00:00 2001 From: Yuri Shkuro Date: Fri, 24 Jan 2025 16:20:52 -0500 Subject: [PATCH 5/9] Update .github/workflows/ci-unit-tests.yml Signed-off-by: Yuri Shkuro --- .github/workflows/ci-unit-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-unit-tests.yml b/.github/workflows/ci-unit-tests.yml index 9087e7e..cafa675 100644 --- a/.github/workflows/ci-unit-tests.yml +++ b/.github/workflows/ci-unit-tests.yml @@ -36,7 +36,7 @@ jobs: run: make test-ci - name: upload code coverage - uses: Wandalen/wretry.action@v3.7.0 + uses: Wandalen/wretry.action@v3.8.0 with: attempt_limit: 6 # sleep 10 seconds between retries From fa84792a5d8600a5e668548d41eeee910a06e323 Mon Sep 17 00:00:00 2001 From: Shreyas Kirtane Date: Fri, 24 Jan 2025 15:52:55 -0700 Subject: [PATCH 6/9] use private action Signed-off-by: Shreyas Kirtane --- .github/actions/upload-codecov/action.yml | 34 +++++++++++++++++++++++ .github/workflows/ci-unit-tests.yml | 15 ++-------- 2 files changed, 37 insertions(+), 12 deletions(-) create mode 100644 .github/actions/upload-codecov/action.yml diff --git a/.github/actions/upload-codecov/action.yml b/.github/actions/upload-codecov/action.yml new file mode 100644 index 0000000..3f35821 --- /dev/null +++ b/.github/actions/upload-codecov/action.yml @@ -0,0 +1,34 @@ +# Copyright (c) 2023 The Jaeger Authors. +# SPDX-License-Identifier: Apache-2.0 + +# Codecov upload often fails on rate limits if used without a token. +# See https://github.com/codecov/codecov-action/issues/837 +# This action embeds a token directly. +# We cannot define it as "secret" as we need it accessible from forks. + +name: 'Upload coverage to codecov' +description: 'Uploads coverage to codecov with retries' +inputs: + files: + description: 'Coverage files to upload' + required: true + flags: + description: 'Flags for codecov' + required: true +runs: + using: 'composite' + steps: + - name: Retry upload + uses: Wandalen/wretry.action@v3.8.0 + with: + attempt_limit: 6 + # sleep 10 seconds between retries + attempt_delay: 10000 + action: codecov/codecov-action@v5 + with: | + slug: jaegertracing/jaeger-idl + files: ${{ inputs.files }} + flags: ${{ inputs.flags }} + verbose: true + fail_ci_if_error: true + token: 95fab3d9-8038-40ba-ac56-0d8bd91390a4 \ No newline at end of file diff --git a/.github/workflows/ci-unit-tests.yml b/.github/workflows/ci-unit-tests.yml index cafa675..64552ad 100644 --- a/.github/workflows/ci-unit-tests.yml +++ b/.github/workflows/ci-unit-tests.yml @@ -36,19 +36,10 @@ jobs: run: make test-ci - name: upload code coverage - uses: Wandalen/wretry.action@v3.8.0 + uses: ./.github/actions/upload-codecov with: - attempt_limit: 6 - # sleep 10 seconds between retries - attempt_delay: 10000 - action: codecov/codecov-action@v5 - with: | - slug: jaegertracing/jaeger-idl - files: coverage.txt - flags: unittests - verbose: true - fail_ci_if_error: true - token: 95fab3d9-8038-40ba-ac56-0d8bd91390a4 + files: coverage.txt + flags: unittests test-code-gen: runs-on: ubuntu-latest From 2d35e2c682bce66afe6d2508008d13437871482c Mon Sep 17 00:00:00 2001 From: Yuri Shkuro Date: Sat, 25 Jan 2025 10:57:04 -0400 Subject: [PATCH 7/9] Update .github/actions/upload-codecov/action.yml Signed-off-by: Yuri Shkuro --- .github/actions/upload-codecov/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/upload-codecov/action.yml b/.github/actions/upload-codecov/action.yml index 3f35821..087c5d2 100644 --- a/.github/actions/upload-codecov/action.yml +++ b/.github/actions/upload-codecov/action.yml @@ -19,7 +19,7 @@ runs: using: 'composite' steps: - name: Retry upload - uses: Wandalen/wretry.action@v3.8.0 + uses: Wandalen/wretry.action@v3.7.0 with: attempt_limit: 6 # sleep 10 seconds between retries From 6f7bfc1245969ae3c861f6f3278446c75b984673 Mon Sep 17 00:00:00 2001 From: Yuri Shkuro Date: Sat, 25 Jan 2025 10:06:16 -0500 Subject: [PATCH 8/9] Undo retries Signed-off-by: Yuri Shkuro --- .github/actions/upload-codecov/action.yml | 34 ----------------------- .github/workflows/ci-unit-tests.yml | 10 ++++--- 2 files changed, 6 insertions(+), 38 deletions(-) delete mode 100644 .github/actions/upload-codecov/action.yml diff --git a/.github/actions/upload-codecov/action.yml b/.github/actions/upload-codecov/action.yml deleted file mode 100644 index 087c5d2..0000000 --- a/.github/actions/upload-codecov/action.yml +++ /dev/null @@ -1,34 +0,0 @@ -# Copyright (c) 2023 The Jaeger Authors. -# SPDX-License-Identifier: Apache-2.0 - -# Codecov upload often fails on rate limits if used without a token. -# See https://github.com/codecov/codecov-action/issues/837 -# This action embeds a token directly. -# We cannot define it as "secret" as we need it accessible from forks. - -name: 'Upload coverage to codecov' -description: 'Uploads coverage to codecov with retries' -inputs: - files: - description: 'Coverage files to upload' - required: true - flags: - description: 'Flags for codecov' - required: true -runs: - using: 'composite' - steps: - - name: Retry upload - uses: Wandalen/wretry.action@v3.7.0 - with: - attempt_limit: 6 - # sleep 10 seconds between retries - attempt_delay: 10000 - action: codecov/codecov-action@v5 - with: | - slug: jaegertracing/jaeger-idl - files: ${{ inputs.files }} - flags: ${{ inputs.flags }} - verbose: true - fail_ci_if_error: true - token: 95fab3d9-8038-40ba-ac56-0d8bd91390a4 \ No newline at end of file diff --git a/.github/workflows/ci-unit-tests.yml b/.github/workflows/ci-unit-tests.yml index 64552ad..e32cc2f 100644 --- a/.github/workflows/ci-unit-tests.yml +++ b/.github/workflows/ci-unit-tests.yml @@ -35,11 +35,13 @@ jobs: - name: Run unit tests run: make test-ci - - name: upload code coverage - uses: ./.github/actions/upload-codecov + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v5 with: - files: coverage.txt - flags: unittests + slug: jaegertracing/jaeger-idl + verbose: true + fail_ci_if_error: true + token: 95fab3d9-8038-40ba-ac56-0d8bd91390a4 test-code-gen: runs-on: ubuntu-latest From 1f563c01240c29f52db6af3f0fd0590028a40909 Mon Sep 17 00:00:00 2001 From: Yuri Shkuro Date: Sat, 25 Jan 2025 10:10:58 -0500 Subject: [PATCH 9/9] relax-targets Signed-off-by: Yuri Shkuro --- .codecov.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.codecov.yml b/.codecov.yml index 3bff4e9..a69cfa2 100644 --- a/.codecov.yml +++ b/.codecov.yml @@ -10,13 +10,13 @@ ignore: coverage: precision: 2 round: down - range: "95...100" + range: "85...100" status: project: default: enabled: yes - target: 95% + target: 85% patch: default: enabled: yes - target: 95% \ No newline at end of file + target: 90%