Skip to content

Commit

Permalink
Publish coverage to SonarCloud.
Browse files Browse the repository at this point in the history
Signed-off-by: Kenneth J. Shackleton <[email protected]>
  • Loading branch information
kennethshackleton committed Sep 19, 2023
1 parent 1a843d4 commit 89c3a52
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:
path: |
**/build/reports/detekt
- name: 'Unit tests'
run: ./gradlew :selekt-android:testDebugUnitTest :selekt-java:test :koverHtmlReport -x integrationTest ${{ env.SCAN }}
run: ./gradlew :selekt-android:testDebugUnitTest :selekt-java:test :koverHtmlReport :koverXmlReport -x integrationTest ${{ env.SCAN }}
- uses: actions/upload-artifact@v3
if: always()
with:
Expand All @@ -69,6 +69,8 @@ jobs:
build/reports/kover/html
selekt-android/build/reports/tests/testDebugUnitTest
selekt-java/build/reports/tests/test
- name: 'Publish coverage'
run: ./gradlew :sonar -Dsonar.host.url=https://sonarcloud.io
- name: 'Build Selekt'
run: |
./gradlew assembleRelease ${{ env.SCAN }}
Expand Down
19 changes: 19 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.jlleitschuh.gradle.ktlint.KtlintExtension
import org.jlleitschuh.gradle.ktlint.reporter.ReporterType
import org.jlleitschuh.gradle.ktlint.tasks.GenerateReportsTask
import org.sonarqube.gradle.SonarTask

plugins {
base
Expand All @@ -41,6 +42,7 @@ plugins {
id("org.jetbrains.qodana") version Versions.QODANA_PLUGIN.version
id("org.jlleitschuh.gradle.ktlint") version Versions.KTLINT_GRADLE_PLUGIN.version
id("org.jetbrains.gradle.plugin.idea-ext") version Versions.IDE_EXT_GRADLE_PLUGIN.version
id("org.sonarqube") version Versions.SONAR.version
}

repositories {
Expand Down Expand Up @@ -217,6 +219,23 @@ allprojects {
}
}

sonar {
properties {
property("sonar.organization", "Bloomberg")
property("sonar.projectKey", "com.bloomberg.selekt")
property("sonar.projectName", "Selekt")
property("sonar.projectVersion", selektVersionName)
property(
"sonar.coverage.jacoco.xmlReportPaths",
"${layout.buildDirectory.get()}/reports/kover/report.xml"
)
}
}

tasks.withType<SonarTask>().configureEach {
mustRunAfter("koverXmlReport")
}

koverReport {
defaults {
filters {
Expand Down
3 changes: 2 additions & 1 deletion buildSrc/src/main/kotlin/Versions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ enum class Versions(
MOCKITO_KOTLIN("5.0.0", URL("https://github.com/mockito/mockito-kotlin")),
NEXUS_PLUGIN("1.3.0", URL("https://github.com/gradle-nexus/publish-plugin")),
QODANA_PLUGIN("0.1.12", URL("https://www.jetbrains.com/help/qodana/qodana-gradle-plugin.html")),
ROBOLECTRIC_ANDROID_ALL("12.1-robolectric-8229987", URL("https://github.com/robolectric/robolectric"));
ROBOLECTRIC_ANDROID_ALL("12.1-robolectric-8229987", URL("https://github.com/robolectric/robolectric")),
SONAR("4.0.0.2929", URL("https://docs.sonarsource.com/sonarqube/latest"));

override fun toString() = version

Expand Down

0 comments on commit 89c3a52

Please sign in to comment.