diff --git a/.github/workflows/springwolf-core.yml b/.github/workflows/springwolf-core.yml index 192daa796..9ea717de9 100644 --- a/.github/workflows/springwolf-core.yml +++ b/.github/workflows/springwolf-core.yml @@ -30,6 +30,18 @@ jobs: - name: Build with Gradle run: ./gradlew -p springwolf-core build + - name: Cache SonarCloud packages + uses: actions/cache@v3 + with: + path: ~/.sonar/cache + key: ${{ runner.os }}-sonar + restore-keys: ${{ runner.os }}-sonar + - name: Run SonarCloud analysis + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + run: ./gradlew -p springwolf-core build sonarqube --info + - name: Publish package if: github.ref == 'refs/heads/master' run: ./gradlew -p springwolf-core publish diff --git a/springwolf-core/build.gradle b/springwolf-core/build.gradle index f32c180a0..103695255 100644 --- a/springwolf-core/build.gradle +++ b/springwolf-core/build.gradle @@ -6,6 +6,9 @@ plugins { id 'org.springframework.boot' version '3.0.2' id 'io.spring.dependency-management' version '1.1.0' + + id 'org.sonarqube' version "3.5.0.2730" + id 'jacoco' } def isSnapshot = Boolean.valueOf(project.findProperty('SNAPSHOT')) @@ -63,6 +66,11 @@ java { test { useJUnitPlatform() } +jacocoTestReport { + reports { + xml.required = true + } +} publishing { publications { @@ -131,3 +139,12 @@ signing { useInMemoryPgpKeys(signingKey, signingPassword) sign publishing.publications.mavenJava } + +sonarqube { + properties { + property "sonar.projectKey", "timonback_springwolf-core" + property "sonar.organization", "timonback" + property "sonar.host.url", "https://sonarcloud.io" + } +} +