From f33a69ce9fa9c0ba91b6b1a9f8fee66f3e3648ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Mikul=C3=A1=C5=A1ek?= Date: Thu, 8 Feb 2024 10:12:25 +0100 Subject: [PATCH] build: introduce code coverage --- .github/workflows/check.yml | 10 ++++++++++ build.gradle.kts | 1 + gradle/libs.versions.toml | 1 + 3 files changed, 12 insertions(+) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 2997052..729fb31 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -28,3 +28,13 @@ jobs: - name: Check with Gradle run: ./gradlew -p ${{ inputs.projectDir }} clean check + + - name: Generate Coverage report + if: ${{ inputs.projectDir == '.' }} + run: ./gradlew -p ${{ inputs.projectDir }} koverXmlReport + + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v3 + if: ${{ inputs.projectDir == '.' }} + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} diff --git a/build.gradle.kts b/build.gradle.kts index eba7116..c80384b 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -4,6 +4,7 @@ plugins { alias(libs.plugins.kotlin.serialization) alias(libs.plugins.kotest.multiplatform) alias(libs.plugins.detekt) + alias(libs.plugins.kover) `maven-publish` } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 5fc5c48..ca19d4c 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -29,3 +29,4 @@ kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" } kotest-multiplatform = { id = "io.kotest.multiplatform", version.ref = "kotest" } detekt = { id = "io.gitlab.arturbosch.detekt", version.ref = "detekt"} +kover = { id = "org.jetbrains.kotlinx.kover", version = "0.7.5" }