Skip to content

Commit

Permalink
fix: fix kover config
Browse files Browse the repository at this point in the history
  • Loading branch information
kaszabimre committed Oct 22, 2024
1 parent 1f10164 commit 9e0f648
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 46 deletions.
32 changes: 13 additions & 19 deletions .github/workflows/PR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,17 @@ jobs:
env:
WORKING_DIRECTORY: ./iosApp

- name: Tests
uses: gradle/[email protected]
with:
arguments: test

- name: Kover XML Report
uses: ./.github/actions/kover_report
id: kover_report
with:
artifacts_name: android-test-report

build-android:
needs: pre-conditions
runs-on: ubuntu-24.04
Expand All @@ -57,21 +68,6 @@ jobs:
- name: Build
run: ./gradlew build --stacktrace

- name: Kover XML Report
uses: ./.github/actions/kover_report
id: kover_report
with:
kover_report_path: ${{ github.workspace }}/composeApp/build/reports/kover/reportDebug.xml
artifacts_name: android-test-report

- name: Upload Kover Report
if: steps.kover_report.outputs.kover_report_available == 'true'
uses: actions/[email protected]
with:
name: ${{ steps.kover_report.outputs.artifacts_name }}
path: ${{ github.workspace }}/composeApp/build/reports/kover/reportDebug.xml
retention-days: 5

build-ios:
needs: pre-conditions
runs-on: macos-14
Expand Down Expand Up @@ -110,11 +106,10 @@ jobs:
DEVELOPMENT_TEAM=${{ secrets.APPLE_TEAM_ID }}
comment-test-report:
needs: [build-android]
needs: [pre-conditions]
if: |
always() &&
github.event_name == 'pull_request' &&
needs.build-android.outputs.kover_report_available == 'true'
github.event_name == 'pull_request'
runs-on: ubuntu-24.04
permissions:
actions: read
Expand All @@ -126,5 +121,4 @@ jobs:
- name: Comment Kover Report to PR
uses: ./.github/actions/comment_kover_report_to_pr
with:
platform: Android
report_name: android-test-report
48 changes: 21 additions & 27 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ allprojects {
)

val koverIncludeList = listOf("*.viewmodel.*", "*.data.service.*")
val koverProjectNames = listOf("data", "viewmodel", "composeApp")

extensions.configure<DetektExtension> {
autoCorrect = true
Expand Down Expand Up @@ -83,38 +84,31 @@ allprojects {
tasks.withType<DetektCreateBaselineTask>().configureEach {
jvmTarget = libs.versions.javaTargetCompatibility.get()
}

kover {
currentProject {
instrumentation {
excludedClasses.addAll(koverExcludeList)
}
sources {
excludeJava = true
}
}
reports {
filters {
excludes { classes(koverExcludeList) }
includes { classes(koverIncludeList) }
}

total {
if (koverProjectNames.any { project.name.contains(it) }) {
kover {
reports {
filters {
excludes { classes(koverExcludeList) }
includes { classes(koverIncludeList) }
}
verify {
rule("Minimum coverage verification error") {
disabled = false
groupBy = kotlinx.kover.gradle.plugin.dsl.GroupingEntityType.APPLICATION

bound {
minValue.set(defaultRequiredMinimumCoverage)
maxValue.set(defaultRequiredMaximumCoverage)
coverageUnits.set(CoverageUnit.LINE)
aggregationForGroup =
kotlinx.kover.gradle.plugin.dsl.AggregationType.COVERED_PERCENTAGE
total {
filters {
excludes { classes(koverExcludeList) }
includes { classes(koverIncludeList) }
}
verify {
rule("Minimum coverage verification error") {
disabled = false
groupBy = kotlinx.kover.gradle.plugin.dsl.GroupingEntityType.APPLICATION

bound {
minValue.set(defaultRequiredMinimumCoverage)
maxValue.set(defaultRequiredMaximumCoverage)
coverageUnits.set(CoverageUnit.LINE)
aggregationForGroup =
kotlinx.kover.gradle.plugin.dsl.AggregationType.COVERED_PERCENTAGE
}
}
}
}
Expand Down

0 comments on commit 9e0f648

Please sign in to comment.