diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index a40d4e4690..5b5bea8b03 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -55,6 +55,27 @@ jobs: path: | rskj-core/build + sonarcloud: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + # Disabling shallow clone is recommended for improving relevancy of reporting + fetch-depth: 0 + - name: SonarCloud Scan + uses: sonarsource/sonarcloud-github-action@3.1.0 # Ex: v3.1.0, See the latest version at https://github.com/marketplace/actions/sonarcloud-scan + env: + GH_EVENT: ${{ github.event_name }} + GH_PR_NUMBER: ${{ github.event.pull_request.number }} + GH_PR_BASE_REF: ${{ github.base_ref }} + GH_PR_HEAD_REF: ${{ github.head_ref }} + GH_REF: ${{ github.ref }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + with: + args: > + -Dsonar.branch.name="$GH_REF" + -Dsonar.verbose=true + smell-test: needs: unit-tests-java17 runs-on: ubuntu-latest diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 0000000000..c8c031f37f --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,9 @@ +sonar.organization=rsksmart +sonar.projectKey=rskj +sonar.host.url=https://sonarcloud.io +sonar.junit.reportPaths=./rskj-core/build/test-results/ +sonar.coverage.jacoco.xmlReportPaths=./rskj-core/build/reports/jacoco/test/jacocoTestReport.xml + +# relative paths to source directories. More details and properties are described +# in https://sonarcloud.io/documentation/project-administration/narrowing-the-focus/ +sonar.sources=./rskj-core \ No newline at end of file