Skip to content

Commit

Permalink
Merge pull request #2836 from rsksmart/add-gradle-sonar-scanner
Browse files Browse the repository at this point in the history
Updating smell test
  • Loading branch information
Vovchyk authored Nov 18, 2024
2 parents 83269bd + 2aa85a5 commit 821de1f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 16 deletions.
20 changes: 4 additions & 16 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 10 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down

0 comments on commit 821de1f

Please sign in to comment.