Skip to content

Commit 9095690

Browse files
crodriguezvegacoderabbitai[bot]
andauthoredMar 8, 2024
ci: replace codecov with sonarcloud (#5931)
* ci: replace codecov with sonarcloud * simplify for now repo analysis step by not considering coverage by e2e tests * Apply suggestions from code review Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
1 parent 3f7320c commit 9095690

12 files changed

+107
-87
lines changed
 

‎.codecov.yml

-57
This file was deleted.

‎.github/PULL_REQUEST_TEMPLATE.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,4 @@ write a little note why.
4343
- [ ] Provide a [conventional commit message](https://github.com/cosmos/ibc-go/blob/main/docs/dev/pull-requests.md#commit-messages) to follow the repository standards.
4444
- [ ] Include a descriptive changelog entry when appropriate. This may be left to the discretion of the PR reviewers. (e.g. chores should be omitted from changelog)
4545
- [ ] Re-reviewed `Files changed` in the GitHub PR explorer.
46-
- [ ] Review `Codecov Report` in the comment section below once CI passes.
46+
- [ ] Review `SonarCloud Report` in the comment section below once CI passes.

‎.github/workflows/callbacks.yml

+8
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,11 @@ jobs:
4848
run: |
4949
cd modules/apps/callbacks
5050
go test -v -mod=readonly ./...
51+
- name: sonarcloud
52+
if: ${{ env.GIT_DIFF && !github.event.pull_request.draft && env.SONAR_TOKEN != null }}
53+
uses: SonarSource/sonarcloud-github-action@v1.6
54+
env:
55+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
56+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
57+
with:
58+
projectBaseDir: modules/apps/callbacks/

‎.github/workflows/capability.yml

+8
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,11 @@ jobs:
3434
run: |
3535
cd modules/capability
3636
go test -v -mod=readonly ./...
37+
- name: sonarcloud
38+
if: ${{ env.GIT_DIFF && !github.event.pull_request.draft && env.SONAR_TOKEN != null }}
39+
uses: SonarSource/sonarcloud-github-action@v1.6
40+
env:
41+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
43+
with:
44+
projectBaseDir: modules/capability/

‎.github/workflows/test.yml

+17-26
Original file line numberDiff line numberDiff line change
@@ -104,53 +104,44 @@ jobs:
104104
cat pkgs.txt.part.${{ matrix.part }} | xargs go test -mod=readonly -timeout 30m -coverprofile=${{ matrix.part }}profile.out -covermode=atomic -tags='ledger test_ledger_mock'
105105
if: env.GIT_DIFF
106106
- uses: actions/upload-artifact@v4
107+
if: env.GIT_DIFF
107108
with:
108109
name: '${{ github.sha }}-${{ matrix.part }}-coverage'
109110
path: ./${{ matrix.part }}profile.out
110111

111-
upload-coverage-report:
112+
repo-analysis:
112113
runs-on: ubuntu-latest
113-
needs: tests
114+
needs: [tests]
114115
steps:
115116
- uses: actions/checkout@v4
116117
- uses: technote-space/get-diff-action@v6.1.2
118+
id: git_diff
117119
with:
118120
PATTERNS: |
119-
**/**.go
121+
**/*.go
120122
go.mod
121123
go.sum
124+
**/go.mod
125+
**/go.sum
122126
- uses: actions/download-artifact@v4
127+
if: env.GIT_DIFF
123128
with:
124129
name: '${{ github.sha }}-00-coverage'
125-
if: env.GIT_DIFF
126130
- uses: actions/download-artifact@v4
131+
if: env.GIT_DIFF
127132
with:
128133
name: '${{ github.sha }}-01-coverage'
129-
if: env.GIT_DIFF
130134
- uses: actions/download-artifact@v4
135+
if: env.GIT_DIFF
131136
with:
132137
name: '${{ github.sha }}-02-coverage'
133-
if: env.GIT_DIFF
134138
- uses: actions/download-artifact@v4
135-
with:
136-
name: '${{ github.sha }}-03-coverage'
137-
if: env.GIT_DIFF
138-
- run: |
139-
cat ./*profile.out | grep -v "mode: atomic" >> coverage.txt
140139
if: env.GIT_DIFF
141-
- name: filter out DONTCOVER
142-
run: |
143-
excludelist="$(find ./ -type f -name '*.go' | xargs grep -l 'DONTCOVER')"
144-
excludelist+=" $(find ./ -type f -name '*.pb.go')"
145-
excludelist+=" $(find ./ -type f -name '*.pb.gw.go')"
146-
excludelist+=" $(find ./ -type f -path './tests/mocks/*.go')"
147-
for filename in ${excludelist}; do
148-
filename=$(echo $filename | sed 's/^./github.com\/cosmos\/cosmos-sdk/g')
149-
echo "Excluding ${filename} from coverage report..."
150-
sed -i.bak "/$(echo $filename | sed 's/\//\\\//g')/d" coverage.txt
151-
done
152-
if: env.GIT_DIFF
153-
- uses: codecov/codecov-action@v4
154140
with:
155-
file: ./coverage.txt
156-
if: env.GIT_DIFF
141+
name: '${{ github.sha }}-03-coverage'
142+
- name: sonarcloud
143+
if: ${{ env.GIT_DIFF && !github.event.pull_request.draft }}
144+
uses: SonarSource/sonarcloud-github-action@master
145+
env:
146+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
147+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

‎.github/workflows/wasm-client.yml

+8
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,11 @@ jobs:
5555
run: |
5656
cd modules/light-clients/08-wasm
5757
go test -v -mod=readonly ./...
58+
- name: sonarcloud
59+
if: ${{ env.GIT_DIFF && !github.event.pull_request.draft && env.SONAR_TOKEN != null }}
60+
uses: SonarSource/sonarcloud-github-action@v1.6
61+
env:
62+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
63+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
64+
with:
65+
projectBaseDir: modules/light-clients/08-wasm/

‎README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
<a href="https://goreportcard.com/report/github.com/cosmos/ibc-go">
1818
<img alt="Go report card" src="https://goreportcard.com/badge/github.com/cosmos/ibc-go" />
1919
</a>
20-
<a href="https://codecov.io/gh/cosmos/ibc-go">
21-
<img alt="Code Coverage" src="https://codecov.io/gh/cosmos/ibc-go/branch/main/graph/badge.svg" />
20+
<a href="https://sonarcloud.io/summary/overall?id=cosmos_ibc-go">
21+
<img alt="Code Coverage" src="https://sonarcloud.io/api/project_badges/measure?project=cosmos_ibc-go&metric=coverage" />
2222
</a>
2323
</div>
2424
<div align="center">

‎docs/dev/development-setup.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ When testing a function under a variety of different inputs, we prefer to use [t
5252

5353
All unit tests should use the testing package. Please see the testing package [README](../../testing/README.md) for more information.
5454

55-
Test coverage is continuously deployed at [codecov](https://app.codecov.io/github/cosmos/ibc-go). PRs that improve test coverage are welcome, but in general the test coverage should be used as a guidance for finding API use cases that are not covered by tests. We don't recommend adding tests that only improve coverage but not actually test a meaning use case.
55+
Test coverage is continuously deployed at [SonarCloud](https://sonarcloud.io/project/overview?id=cosmos_ibc-go). PRs that improve test coverage are welcome, but in general the test coverage should be used as a guidance for finding API use cases that are not covered by tests. We don't recommend adding tests that only improve coverage but not actually test a meaning use case.
5656

5757
## Documentation
5858

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
sonar.projectKey=ibc-go-callbacks
2+
sonar.organization=cosmos
3+
4+
sonar.projectName=ibc-go - Callbacks
5+
sonar.project.monorepo.enabled=true
6+
7+
sonar.sources=.
8+
sonar.exclusions=**/*_test.go
9+
sonar.tests=.
10+
sonar.test.inclusions=**/*_test.go
11+
sonar.go.coverage.reportPaths=coverage.out
12+
13+
sonar.sourceEncoding=UTF-8
14+
sonar.scm.provider=git
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
sonar.projectKey=ibc-go-capability
2+
sonar.organization=cosmos
3+
4+
sonar.projectName=ibc-go - Capability
5+
sonar.project.monorepo.enabled=true
6+
7+
sonar.sources=.
8+
sonar.exclusions=**/*_test.go
9+
sonar.tests=.
10+
sonar.test.inclusions=**/*_test.go
11+
sonar.go.coverage.reportPaths=coverage.out
12+
13+
sonar.sourceEncoding=UTF-8
14+
sonar.scm.provider=git
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
sonar.projectKey=ibc-go-08-wasm
2+
sonar.organization=cosmos
3+
4+
sonar.projectName=ibc-go - 08-wasm
5+
sonar.project.monorepo.enabled=true
6+
7+
sonar.sources=.
8+
sonar.exclusions=**/*_test.go
9+
sonar.tests=.
10+
sonar.test.inclusions=**/*_test.go
11+
sonar.go.coverage.reportPaths=coverage.out
12+
13+
sonar.sourceEncoding=UTF-8
14+
sonar.scm.provider=git

‎sonar-project.properties

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
sonar-projects.propertiessonar.projectKey=cosmos_ibc-go
2+
sonar.organization=cosmos
3+
4+
sonar.projectName=ibc-go
5+
sonar.project.monorepo.enabled=true
6+
7+
sonar.sources=.
8+
sonar.exclusions=**/*_test.go,**/testing/**,e2e/**,**/*.pb.go,**/*.pb.gw.go,**/*.pulsar.go,docs/**,**/*.md,scripts/**,
9+
sonar.tests=.
10+
sonar.test.inclusions=**/*_test.go,**/testing/**,e2e/**,**/testutil/**
11+
sonar.go.coverage.reportPaths=coverage.out,*profile.out
12+
13+
sonar.python.version=3
14+
sonar.sourceEncoding=UTF-8
15+
sonar.scm.provider=git
16+
17+
# Exclude C/C++/Objective-C files from analysis
18+
sonar.c.file.suffixes=-
19+
sonar.cpp.file.suffixes=-
20+
sonar.objc.file.suffixes=-

0 commit comments

Comments
 (0)