-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: add sonarcloud for go and js (#291)
* ci: add sonarcloud for go and js * add needs field * Update .github/workflows/typescript.yml Co-authored-by: DimitrisJim <[email protected]> * update project name * ignore Rust files --------- Co-authored-by: DimitrisJim <[email protected]>
- Loading branch information
1 parent
b84f236
commit b82084e
Showing
5 changed files
with
74 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,22 +43,21 @@ jobs: | |
working-directory: ./go | ||
run: make test | ||
|
||
coverage: | ||
name: Code Coverage | ||
analysis: | ||
name: Go analysis | ||
needs: [test] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version: "1.21" | ||
- name: Run coverage | ||
working-directory: ./go | ||
run: go test -race -coverprofile=coverage.txt -covermode=atomic | ||
- name: Upload coverage to Codecov | ||
uses: codecov/codecov-action@v4 | ||
# Disabling shallow clone is recommended for improving relevancy of reporting | ||
fetch-depth: 0 | ||
- name: sonarcloud | ||
if: ${{ env.GIT_DIFF && !github.event.pull_request.draft && env.SONAR_TOKEN != null }} | ||
uses: SonarSource/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
files: go/coverage.txt | ||
flags: go | ||
fail_ci_if_error: true | ||
projectBaseDir: go | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,18 +25,20 @@ jobs: | |
working-directory: ./js | ||
run: yarn && yarn test | ||
|
||
coverage: | ||
name: Code Coverage | ||
analysis: | ||
name: Typescript analysis | ||
needs: [test] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Generate code coverage | ||
working-directory: ./js | ||
run: yarn && yarn coverage | ||
- name: Upload coverage to Codecov | ||
uses: codecov/codecov-action@v4 | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
files: js/coverage/lcov.info | ||
flags: typescript | ||
fail_ci_if_error: true | ||
# Disabling shallow clone is recommended for improving relevancy of reporting | ||
fetch-depth: 0 | ||
- name: sonarcloud | ||
if: ${{ env.GIT_DIFF && !github.event.pull_request.draft && env.SONAR_TOKEN != null }} | ||
uses: SonarSource/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | ||
with: | ||
projectBaseDir: js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
sonar.projectKey=ics23-go | ||
sonar.organization=cosmos | ||
|
||
sonar.projectName=ics23 - Go | ||
sonar.project.monorepo.enabled=true | ||
|
||
sonar.sources=. | ||
sonar.exclusions=**/*_test.go,**/testdata/**, | ||
sonar.tests=. | ||
sonar.test.inclusions=**/*_test.go | ||
sonar.go.coverage.reportPaths=coverage.out | ||
|
||
sonar.sourceEncoding=UTF-8 | ||
sonar.scm.provider=git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
sonar.projectKey=ics23-js | ||
sonar.organization=cosmos | ||
|
||
sonar.projectName=ics23 - JS | ||
sonar.project.monorepo.enabled=true | ||
|
||
sonar.sources=. | ||
sonar.exclusions=**/*_test.go,**/node_modules/**, | ||
sonar.tests=. | ||
sonar.test.inclusions=**/*_test.go | ||
sonar.go.coverage.reportPaths=coverage.out | ||
|
||
sonar.sourceEncoding=UTF-8 | ||
sonar.scm.provider=git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
sonar-projects.propertiessonar.projectKey=cosmos_ics23 | ||
sonar.organization=cosmos | ||
|
||
sonar.projectName=ics23 | ||
sonar.project.monorepo.enabled=true | ||
|
||
sonar.sources=. | ||
sonar.exclusions=**/*_test.go,**/testdata/**,scripts/**,rust/**, | ||
sonar.tests=. | ||
sonar.test.inclusions=**/*_test.go,**/testdata/** | ||
sonar.go.coverage.reportPaths=go/coverage.txt | ||
sonar.javascript.lcov.reportPaths=js/coverage/lcov.info | ||
|
||
sonar.python.version=3 | ||
sonar.sourceEncoding=UTF-8 | ||
sonar.scm.provider=git | ||
|
||
# Exclude C/C++/Objective-C files from analysis | ||
sonar.c.file.suffixes=- | ||
sonar.cpp.file.suffixes=- | ||
sonar.objc.file.suffixes=- |