diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index df8631d4e13..dd13d6cf492 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -120,6 +120,22 @@ jobs: with: arguments: check + - name: Create code coverage report + if: "! github.event.pull_request.head.repo.fork " + uses: gradle/gradle-build-action@v2 + with: + arguments: koverMergedReport + + - name: Add coverage report to PR + if: "! github.event.pull_request.head.repo.fork " + id: kover + uses: mi-kas/kover-report@v1 + with: + path: build/reports/kover/merged/xml/report.xml + token: ${{ secrets.GITHUB_TOKEN }} + title: Kover Report + update-comment: true + - name: Upload reports if: failure() uses: actions/upload-artifact@v3 diff --git a/arrow-libs/gradle/test-coverage.gradle b/arrow-libs/gradle/test-coverage.gradle index 59253bc3768..7373143b7b8 100644 --- a/arrow-libs/gradle/test-coverage.gradle +++ b/arrow-libs/gradle/test-coverage.gradle @@ -30,3 +30,5 @@ // dependsOn test // tests are required to run before generating the report // mustRunAfter test //} + +apply plugin: 'kover' diff --git a/build.gradle.kts b/build.gradle.kts index 148b13de04f..980dbf14036 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -23,6 +23,7 @@ plugins { alias(libs.plugins.dokka) alias(libs.plugins.animalSniffer) apply false alias(libs.plugins.kotest.multiplatform) apply false + alias(libs.plugins.kotlinx.kover) alias(libs.plugins.kotlin.multiplatform) apply false alias(libs.plugins.kotlin.binaryCompatibilityValidator) alias(libs.plugins.arrowGradleConfig.nexus) @@ -44,6 +45,24 @@ configure { } } +koverMerged { + enable() + filters { + projects { + excludes.addAll( + listOf( + ":arrow-annotations", + ":arrow-core-test", + ":arrow-fx-coroutines-test", + ":arrow-optics-test", + ":arrow-site", + ":arrow-stack" + ) + ) + } + } +} + allprojects { group = property("projects.group").toString() } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index dd589a53186..870616b2178 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -10,6 +10,7 @@ jUnitJupiter = "5.8.2" jUnitVintage = "5.8.2" kotest = "5.5.4" kotestGradle = "5.5.4" +kover = "0.6.0" kotlin = "1.7.22" kotlinBinaryCompatibilityValidator = "0.12.1" kotlinCompileTesting = "1.4.9" @@ -63,5 +64,6 @@ kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" } kotlin-binaryCompatibilityValidator = { id = "org.jetbrains.kotlinx.binary-compatibility-validator", version.ref = "kotlinBinaryCompatibilityValidator" } kotlinx-knit = { id = "org.jetbrains.kotlinx.knit", version.ref = "knit" } +kotlinx-kover = { id = "org.jetbrains.kotlinx.kover", version.ref = "kover" } kotlinx-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" } ksp = { id = "com.google.devtools.ksp", version.ref = "kspVersion" }