From 852177e4be004fa28cedcfb55aadede135f31d19 Mon Sep 17 00:00:00 2001 From: javadjafari Date: Thu, 11 Apr 2024 14:19:08 +0330 Subject: [PATCH] #147 add kover verification in CI machine --- .github/workflows/build_on_pull_request.yml | 3 ++ app/build.gradle.kts | 40 +++++++++++++++++++++ 2 files changed, 43 insertions(+) diff --git a/.github/workflows/build_on_pull_request.yml b/.github/workflows/build_on_pull_request.yml index 7f22813..ef5ed38 100644 --- a/.github/workflows/build_on_pull_request.yml +++ b/.github/workflows/build_on_pull_request.yml @@ -27,6 +27,9 @@ jobs: - name: Run All Unit Tests run: ./gradlew :app:testCafeBazaarDebugUnitTest + - name: Verify tests With Kover + run: ./gradlew :app:koverVerifyCafeBazaarDebug + - name: Run Detekt run: ./gradlew detekt diff --git a/app/build.gradle.kts b/app/build.gradle.kts index df83feb..a583b06 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -1,3 +1,5 @@ +import kotlinx.kover.gradle.plugin.dsl.AggregationType +import kotlinx.kover.gradle.plugin.dsl.MetricType import org.jetbrains.kotlin.konan.properties.Properties plugins { @@ -278,6 +280,44 @@ kover { useJacoco(libs.versions.jacoco.get()) } +koverReport { + androidReports("cafeBazaarDebug") { + verify { + onCheck = true + rule { + isEnabled = true + bound { + minValue = 90 + aggregation = AggregationType.COVERED_PERCENTAGE + metric = MetricType.LINE + } + } + rule { + isEnabled = true + bound { + minValue = 97 + aggregation = AggregationType.COVERED_PERCENTAGE + metric = MetricType.INSTRUCTION + } + } + rule { + isEnabled = true + bound { + minValue = 94 + aggregation = AggregationType.COVERED_PERCENTAGE + metric = MetricType.BRANCH + } + } + } + } + + filters { + includes { + classes("*ViewModel") + } + } +} + tasks.withType { useJUnitPlatform() }