diff --git a/.github/workflows/verify.yaml b/.github/workflows/verify.yaml index aa93477..37c2906 100644 --- a/.github/workflows/verify.yaml +++ b/.github/workflows/verify.yaml @@ -4,6 +4,7 @@ on: env: JDK_VERSION: 21 + GRADLE_OPTS: -Dorg.gradle.daemon=false concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} @@ -16,8 +17,6 @@ jobs: permissions: contents: read checks: write - env: - GRADLE_OPTS: -Dorg.gradle.daemon=false steps: - name: Checkout Code uses: actions/checkout@v4 @@ -44,8 +43,6 @@ jobs: # only required for workflows in private repositories actions: read contents: read - env: - GRADLE_OPTS: -Dorg.gradle.daemon=false steps: - name: Checkout Code uses: actions/checkout@v4 @@ -62,3 +59,33 @@ jobs: if: success() || failure() # always run even if the previous step fails with: path: 'build/reports/detekt/merge.xml' + coverage: + name: Coverage + runs-on: ubuntu-latest + permissions: + # required for all workflows + security-events: write + checks: write + # only required for workflows in private repositories + actions: read + contents: read + steps: + - name: Checkout Code + uses: actions/checkout@v4 + - name: Set up JDK ${{ env.JDK_VERSION }} + uses: actions/setup-java@v4 + with: + distribution: 'adopt' + java-version: '${{ env.JDK_VERSION }}' + cache: 'gradle' + - name: Run Kover + run: ./gradlew koverXmlReport + - name: Publish Kover Report + uses: madrapps/jacoco-report@v1.6.1 + if: success() || failure() # always run even if the previous step fails + with: + paths: | + ${{ github.workspace }}/build/reports/kover/report.xml + token: ${{ secrets.GITHUB_TOKEN }} + min-coverage-overall: 40 + min-coverage-changed-files: 60 diff --git a/build.gradle.kts b/build.gradle.kts index 0cfd268..18a6f57 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -8,6 +8,7 @@ plugins { kotlin("jvm") version libs.versions.kotlin.get() apply false kotlin("plugin.serialization") version libs.versions.kotlin.get() apply false id("io.gitlab.arturbosch.detekt") version libs.versions.detekt.get() + id("org.jetbrains.kotlinx.kover") version libs.versions.kover.get() } // register task before using in subprojects @@ -15,11 +16,8 @@ val reportMerge by tasks.registering(ReportMergeTask::class) { output.set(rootProject.layout.buildDirectory.file("reports/detekt/merge.xml")) } +// Detekt configuration subprojects { - repositories { - mavenCentral() - } - apply(plugin = "io.gitlab.arturbosch.detekt") detekt { @@ -47,3 +45,43 @@ subprojects { ) } } + +// Kover - coverage +allprojects { + apply(plugin = "org.jetbrains.kotlinx.kover") +} + +kover { + reports { + filters { + excludes { + projects.add("sample") + } + } + total { + // configuring report tasks + verify { + rule { + minBound(90) + } + } + } + + verify { + rule { + minBound(50) + } + } + } +} + + +dependencies { + kover(project(":core")) + kover(project(":cors")) + kover(project(":json")) + kover(project(":jwt")) + kover(project(":metrics")) + kover(project(":tracing")) + kover(project(":typesafe")) +} diff --git a/settings.gradle.kts b/settings.gradle.kts index bdcec9f..5f79af1 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -15,10 +15,15 @@ include("tracing") include("typesafe") dependencyResolutionManagement { + repositories { + mavenCentral() + } + versionCatalogs { create("libs") { version("kotlin", "2.0.0") version("detekt", "1.23.6") + version("kover", "0.8.2") version("jakarta", "6.1.0") library("jakarta-api", "jakarta.servlet", "jakarta.servlet-api").versionRef("jakarta") @@ -74,4 +79,4 @@ dependencyResolutionManagement { library("mockk", "io.mockk", "mockk").versionRef("mockk") } } -} \ No newline at end of file +}