From ce0a12395d36b3e72ba12a04d1b4fa30b0401520 Mon Sep 17 00:00:00 2001 From: csuzhangxc Date: Wed, 18 Dec 2024 11:12:09 +0800 Subject: [PATCH 1/5] chore: upload coverage to codecov --- .github/workflows/ci.yaml | 8 ++++++++ Makefile | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index b20213bd1b..4ae37f2612 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -87,6 +87,14 @@ jobs: run: | make unit + - name: Upload test coverage + uses: codecov/codecov-action@v5 + with: + flags: unittest + token: ${{ secrets.CODECOV_TOKEN }} + verbose: true + files: ./coverage.txt + verify: runs-on: ubuntu-24.04 steps: diff --git a/Makefile b/Makefile index ecc09f0930..4e5e7fc044 100644 --- a/Makefile +++ b/Makefile @@ -116,7 +116,8 @@ lint: bin/golangci-lint .PHONY: unit unit: - go test $$(go list -e ./... | grep -v tools | grep -v tests) + go test $$(go list -e ./... | grep -v tools | grep -v tests | grep -v third_party) \ + -cover -coverprofile=coverage.txt -covermode=atomic .PHONY: check check: lint unit verify From b0fc05f5740734c04e7a6d2a889a14e893fc8a18 Mon Sep 17 00:00:00 2001 From: csuzhangxc Date: Wed, 18 Dec 2024 11:17:05 +0800 Subject: [PATCH 2/5] rename action --- .github/workflows/{ci.yaml => ci-v2.yaml} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename .github/workflows/{ci.yaml => ci-v2.yaml} (99%) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci-v2.yaml similarity index 99% rename from .github/workflows/ci.yaml rename to .github/workflows/ci-v2.yaml index 4ae37f2612..d9ea49ad94 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci-v2.yaml @@ -1,4 +1,4 @@ -name: ci +name: ci-v2 on: push: From a21d4db7bd3ce12bf3129409d3ca5a28d638d3a8 Mon Sep 17 00:00:00 2001 From: csuzhangxc Date: Wed, 18 Dec 2024 11:50:16 +0800 Subject: [PATCH 3/5] ignore generated code --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index 4e5e7fc044..2906789bed 100644 --- a/Makefile +++ b/Makefile @@ -118,6 +118,7 @@ lint: bin/golangci-lint unit: go test $$(go list -e ./... | grep -v tools | grep -v tests | grep -v third_party) \ -cover -coverprofile=coverage.txt -covermode=atomic + sed -i '' '/generated/d' coverage.txt .PHONY: check check: lint unit verify From eb81544362e1dfaf5242acf60fb43f7ffad74bbd Mon Sep 17 00:00:00 2001 From: csuzhangxc Date: Wed, 18 Dec 2024 11:55:39 +0800 Subject: [PATCH 4/5] sed for Linux and Mac --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 2906789bed..6394413378 100644 --- a/Makefile +++ b/Makefile @@ -118,7 +118,7 @@ lint: bin/golangci-lint unit: go test $$(go list -e ./... | grep -v tools | grep -v tests | grep -v third_party) \ -cover -coverprofile=coverage.txt -covermode=atomic - sed -i '' '/generated/d' coverage.txt + sed -i.bak '/generated/d' coverage.txt && rm coverage.txt.bak .PHONY: check check: lint unit verify From ddab7f25540fb1996be2750c162bb06f54f37109 Mon Sep 17 00:00:00 2001 From: csuzhangxc Date: Wed, 18 Dec 2024 12:00:32 +0800 Subject: [PATCH 5/5] ignore cmd --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 6394413378..da2f183982 100644 --- a/Makefile +++ b/Makefile @@ -116,7 +116,7 @@ lint: bin/golangci-lint .PHONY: unit unit: - go test $$(go list -e ./... | grep -v tools | grep -v tests | grep -v third_party) \ + go test $$(go list -e ./... | grep -v cmd | grep -v tools | grep -v tests | grep -v third_party) \ -cover -coverprofile=coverage.txt -covermode=atomic sed -i.bak '/generated/d' coverage.txt && rm coverage.txt.bak