Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Oztechan/TraceFit#9] Setup Kover #18

Merged
merged 6 commits into from
Nov 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,13 @@ jobs:
- name: Run Quality Jobs
uses: gradle/[email protected]
with:
arguments: check
arguments: check koverMergedXmlReport --parallel

- name: Upload Coverage Report
uses: actions/[email protected]
with:
name: coverageReport
path: build/reports/kover/merged/xml/report.xml

- name: Cancel other jobs if this fails
if: failure()
Expand Down
17 changes: 17 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ plugins {
alias(kotlinMultiplatform).apply(false)
alias(compose).apply(false)
alias(androidApplication).apply(false)
alias(libs.plugins.kover)
}
}

Expand All @@ -15,5 +16,21 @@ buildscript {
}

allprojects {
apply(plugin = rootProject.libs.plugins.kover.get().pluginId).also {
koverMerged {
filters {
annotations {
excludes += listOf(
"androidx.compose.ui.tooling.preview.Preview",
"androidx.compose.runtime.Composable"
)
Comment on lines +23 to +26

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❓ Why these annotations are excluded?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because unit tests will not be targeting to the Composables or the Previews, and we don't want them to be considered when the overall unit test coverage is being calculated 🙂

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, thanks! 🙂

}
}
enable()
}
}

// todo CMP bug needs to be removed when fixed
// https://youtrack.jetbrains.com/issue/KT-41821/Kotlin-1.4.10-ios-target-java.lang.IllegalStateException-failed-to-resolve-Kotlin-library-org.jetbrains.kotlinx-atomicfu-common
apply(plugin = rootProject.libs.plugins.atomicfu.get().pluginId)
}
2 changes: 2 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ compose = "1.5.1"
composeActivity = "1.7.2"
appcompat = "1.6.1"
atomicfu = "0.17.3"
kover = "0.6.1"

[libraries]

Expand All @@ -22,3 +23,4 @@ kotlinMultiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref =
compose = { id = "org.jetbrains.compose", version.ref = "compose" }
androidApplication = { id = "com.android.application", version.ref = "androidGradlePlugin" }
atomicfu = { id = "kotlinx-atomicfu" }
kover = { id = "org.jetbrains.kotlinx.kover", version.ref = "kover" }
Loading