diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 0cf4a039..49ee0bb0 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -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/sonarcloud-github-action@v2.1.1 + 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 diff --git a/.github/workflows/typescript.yml b/.github/workflows/typescript.yml index b902177b..55bc9270 100644 --- a/.github/workflows/typescript.yml +++ b/.github/workflows/typescript.yml @@ -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/sonarcloud-github-action@v2.1.1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + with: + projectBaseDir: js diff --git a/go/sonar-project.properties b/go/sonar-project.properties new file mode 100644 index 00000000..51c69fb8 --- /dev/null +++ b/go/sonar-project.properties @@ -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 \ No newline at end of file diff --git a/js/sonar-project.properties b/js/sonar-project.properties new file mode 100644 index 00000000..e5833b62 --- /dev/null +++ b/js/sonar-project.properties @@ -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 \ No newline at end of file diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 00000000..3044ca15 --- /dev/null +++ b/sonar-project.properties @@ -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=- \ No newline at end of file