diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 2601e4e3d7..19e3fe6afd 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -107,35 +107,23 @@ jobs: GH_PR_HEAD_REF: ${{ github.head_ref }} GH_REF: ${{ github.ref }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - IS_FORK: ${{ github.event.pull_request.head.repo.fork }} run: | if [ "$GH_EVENT" = "pull_request" ]; then - if [ "$IS_FORK" != "true" ]; then - ./gradlew -Dorg.gradle.jvmargs=-Xmx5g sonarqube --no-daemon -x build -x test \ + if [ "$SONAR_TOKEN" != "" ]; then + ./gradlew -Dorg.gradle.jvmargs=-Xmx5g sonar --no-daemon -x build -x test \ -Dsonar.pullrequest.base="$GH_PR_BASE_REF" \ -Dsonar.pullrequest.branch="$GH_PR_HEAD_REF" \ -Dsonar.pullrequest.key="$GH_PR_NUMBER" \ - -Dsonar.organization=rsksmart \ - -Dsonar.projectKey=rskj \ - -Dsonar.host.url="https://sonarcloud.io" \ - -Dsonar.junit.reportPaths=rskj-core/build/test-results/ \ - -Dsonar.coverage.jacoco.xmlReportPaths=rskj-core/build/reports/jacoco/test/jacocoTestReport.xml \ -Dsonar.token="$SONAR_TOKEN" else - echo "Skipping SonarQube analysis for pull request from a forked repo." + echo "Skipping SonarQube analysis." fi else - ./gradlew -Dorg.gradle.jvmargs=-Xmx5g sonarqube --no-daemon -x build -x test \ + ./gradlew -Dorg.gradle.jvmargs=-Xmx5g sonar --no-daemon -x build -x test \ -Dsonar.branch.name="$GH_REF" \ - -Dsonar.organization=rsksmart \ - -Dsonar.projectKey=rskj \ - -Dsonar.host.url="https://sonarcloud.io" \ - -Dsonar.junit.reportPaths=rskj-core/build/test-results/ \ - -Dsonar.coverage.jacoco.xmlReportPaths=rskj-core/build/reports/jacoco/test/jacocoTestReport.xml \ -Dsonar.token="$SONAR_TOKEN" fi - mining-tests: needs: build runs-on: ubuntu-latest diff --git a/build.gradle b/build.gradle index 9a423cc072..66ca08e5b9 100644 --- a/build.gradle +++ b/build.gradle @@ -2,6 +2,16 @@ plugins { id "org.sonarqube" version "5.1.0.4882" } +sonar { + properties { + property "sonar.projectKey", "rskj" + property "sonar.organization", "rsksmart" + property "sonar.host.url", "https://sonarcloud.io" + property "sonar.junit.reportPaths", "rskj-core/build/test-results/" + property "sonar.coverage.jacoco.xmlReportPaths", "rskj-core/build/reports/jacoco/test/jacocoTestReport.xml" + } +} + subprojects { def config = new ConfigSlurper().parse(file("$projectDir/src/main/resources/version.properties").toURI().toURL()) group = 'co.rsk'