Skip to content

Commit

Permalink
sonar and jacoco config
Browse files Browse the repository at this point in the history
  • Loading branch information
maemresen committed May 4, 2024
1 parent 379ed7d commit 31181a3
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,10 @@ jobs:
run: CI=true ./gradlew test
- name: Integration Test
run: CI=true ./gradlew integrationTest
- name: Sonar Scan
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
echo "Branch name $(git rev-parse --abbrev-ref HEAD)"
CI=true ./gradlew sonar --info -Dsonar.branch.name=$(git rev-parse --abbrev-ref HEAD)
46 changes: 46 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
import org.gradle.plugins.ide.idea.model.IdeaModel

plugins {
id("org.sonarqube") version "4.4.1.3373"
}

sonar {
properties {
property("sonar.projectKey", "maeworkshop_k8s-workshop")
property("sonar.organization", "maeworkshop")
property("sonar.host.url", "https://sonarcloud.io")
property("sonar.coverage.jacoco.xmlReportPaths", "**/build/reports/jacoco/test/jacocoTestReport.xml")
}
}

subprojects {
pluginManager.withPlugin("java") {
val integrationTestSrcPath = "src/integrationTest"
Expand Down Expand Up @@ -53,6 +66,39 @@ subprojects {
}
}

pluginManager.withPlugin("jacoco") {
tasks {
named("test") {
finalizedBy(named("jacocoTestReport"))
}

named("jacocoTestReport") {
dependsOn("test")
}
}


}

pluginManager.withPlugin("jacoco") {
tasks {
named("test") {
finalizedBy(named("jacocoTestReport"))
}


named("jacocoTestReport") {
dependsOn("test")
}

withType<JacocoReport> {
reports {
xml.required = true
}
}
}
}

pluginManager.withPlugin("idea") {
extensions.configure<IdeaModel> {
module {
Expand Down
1 change: 1 addition & 0 deletions module/app/k8s-workshop-data-generator/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
plugins {
idea
java
jacoco
id("org.springframework.boot") version "3.2.1"
id("io.spring.dependency-management") version "1.1.4"
}
Expand Down
1 change: 1 addition & 0 deletions module/app/k8s-workshop-listener/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
plugins {
idea
java
jacoco
id("org.springframework.boot") version "3.2.1"
id("io.spring.dependency-management") version "1.1.4"
}
Expand Down
1 change: 1 addition & 0 deletions module/lib/k8s-workshop-avro-schemes/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
plugins {
idea
`java-library`
jacoco
id("com.github.davidmc24.gradle.plugin.avro") version "1.3.0"
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
plugins {
idea
`java-library`
jacoco
id("org.springframework.boot") version "3.2.1" apply false
id("io.spring.dependency-management") version "1.1.4"
}
Expand Down

0 comments on commit 31181a3

Please sign in to comment.