kopia lustrzana https://github.com/meshtastic/Meshtastic-Android
feat(ci): add kover for test coverage reporting (#3041)
Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>pull/2900/merge
rodzic
72c5284e2e
commit
0659d38438
|
@ -9,6 +9,8 @@ on:
|
||||||
required: false
|
required: false
|
||||||
DATADOG_CLIENT_TOKEN:
|
DATADOG_CLIENT_TOKEN:
|
||||||
required: false
|
required: false
|
||||||
|
CODECOV_TOKEN:
|
||||||
|
required: false
|
||||||
inputs:
|
inputs:
|
||||||
upload_artifacts:
|
upload_artifacts:
|
||||||
description: 'Whether to upload build and Detekt artifacts'
|
description: 'Whether to upload build and Detekt artifacts'
|
||||||
|
@ -67,9 +69,17 @@ jobs:
|
||||||
echo "datadogApplicationId=$DATADOG_APPLICATION_ID" >> ./secrets.properties
|
echo "datadogApplicationId=$DATADOG_APPLICATION_ID" >> ./secrets.properties
|
||||||
echo "datadogClientToken=$DATADOG_CLIENT_TOKEN" >> ./secrets.properties
|
echo "datadogClientToken=$DATADOG_CLIENT_TOKEN" >> ./secrets.properties
|
||||||
- name: Run Spotless, Detekt, Build, Lint, and Local Tests
|
- name: Run Spotless, Detekt, Build, Lint, and Local Tests
|
||||||
run: ./gradlew :app:spotlessCheck :app:detekt :app:lintFdroidDebug :app:lintGoogleDebug :app:assembleDebug :app:testFdroidDebug :app:testGoogleDebug --configuration-cache --scan
|
run: ./gradlew :app:spotlessCheck :app:detekt :app:lintFdroidDebug :app:lintGoogleDebug :app:assembleDebug koverXmlReport --configuration-cache --scan
|
||||||
env:
|
env:
|
||||||
VERSION_CODE: ${{ env.VERSION_CODE }}
|
VERSION_CODE: ${{ env.VERSION_CODE }}
|
||||||
|
|
||||||
|
- name: Upload coverage reports to Codecov
|
||||||
|
uses: codecov/codecov-action@v4
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.CODECOV_TOKEN }}
|
||||||
|
slug: meshtastic/Meshtastic-Android
|
||||||
|
files: app/build/reports/kover/xml/report.xml
|
||||||
|
|
||||||
- name: Upload F-Droid debug artifact
|
- name: Upload F-Droid debug artifact
|
||||||
if: ${{ inputs.upload_artifacts }}
|
if: ${{ inputs.upload_artifacts }}
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||

|

|
||||||
[](https://github.com/meshtastic/Meshtastic-Android/actions/workflows/pull-request.yml)
|
[](https://github.com/meshtastic/Meshtastic-Android/actions/workflows/pull-request.yml)
|
||||||
|
[](https://codecov.io/gh/meshtastic/Meshtastic-Android)
|
||||||
[](https://crowdin.meshtastic.org/android)
|
[](https://crowdin.meshtastic.org/android)
|
||||||
[](https://cla-assistant.io/meshtastic/Meshtastic-Android)
|
[](https://cla-assistant.io/meshtastic/Meshtastic-Android)
|
||||||
[](https://opencollective.com/meshtastic/)
|
[](https://opencollective.com/meshtastic/)
|
||||||
|
|
|
@ -34,6 +34,7 @@ plugins {
|
||||||
alias(libs.plugins.secrets)
|
alias(libs.plugins.secrets)
|
||||||
alias(libs.plugins.spotless)
|
alias(libs.plugins.spotless)
|
||||||
alias(libs.plugins.dokka)
|
alias(libs.plugins.dokka)
|
||||||
|
alias(libs.plugins.kover)
|
||||||
}
|
}
|
||||||
|
|
||||||
val keystorePropertiesFile = rootProject.file("keystore.properties")
|
val keystorePropertiesFile = rootProject.file("keystore.properties")
|
||||||
|
@ -62,12 +63,18 @@ android {
|
||||||
minSdk = Configs.MIN_SDK
|
minSdk = Configs.MIN_SDK
|
||||||
targetSdk = Configs.TARGET_SDK
|
targetSdk = Configs.TARGET_SDK
|
||||||
// Prioritize injected props, then ENV, then fallback to git commit count
|
// Prioritize injected props, then ENV, then fallback to git commit count
|
||||||
versionCode = (project.findProperty("android.injected.version.code")?.toString()?.toInt()
|
versionCode =
|
||||||
|
(
|
||||||
|
project.findProperty("android.injected.version.code")?.toString()?.toInt()
|
||||||
?: System.getenv("VERSION_CODE")?.toInt()
|
?: System.getenv("VERSION_CODE")?.toInt()
|
||||||
?: gitVersionProvider.get().toInt())
|
?: gitVersionProvider.get().toInt()
|
||||||
versionName = (project.findProperty("android.injected.version.name")?.toString()
|
)
|
||||||
|
versionName =
|
||||||
|
(
|
||||||
|
project.findProperty("android.injected.version.name")?.toString()
|
||||||
?: System.getenv("VERSION_NAME")
|
?: System.getenv("VERSION_NAME")
|
||||||
?: Configs.VERSION_NAME_BASE)
|
?: Configs.VERSION_NAME_BASE
|
||||||
|
)
|
||||||
testInstrumentationRunner = "com.geeksville.mesh.TestRunner"
|
testInstrumentationRunner = "com.geeksville.mesh.TestRunner"
|
||||||
buildConfigField("String", "MIN_FW_VERSION", "\"${Configs.MIN_FW_VERSION}\"")
|
buildConfigField("String", "MIN_FW_VERSION", "\"${Configs.MIN_FW_VERSION}\"")
|
||||||
buildConfigField("String", "ABS_MIN_FW_VERSION", "\"${Configs.ABS_MIN_FW_VERSION}\"")
|
buildConfigField("String", "ABS_MIN_FW_VERSION", "\"${Configs.ABS_MIN_FW_VERSION}\"")
|
||||||
|
|
|
@ -31,6 +31,44 @@ plugins {
|
||||||
alias(libs.plugins.protobuf) apply false
|
alias(libs.plugins.protobuf) apply false
|
||||||
alias(libs.plugins.secrets) apply false
|
alias(libs.plugins.secrets) apply false
|
||||||
alias(libs.plugins.dokka) apply false
|
alias(libs.plugins.dokka) apply false
|
||||||
|
alias(libs.plugins.kover)
|
||||||
|
}
|
||||||
|
|
||||||
|
kover {
|
||||||
|
reports {
|
||||||
|
total {
|
||||||
|
filters {
|
||||||
|
excludes {
|
||||||
|
// Exclude generated classes
|
||||||
|
classes("*_Impl")
|
||||||
|
classes("*Binding")
|
||||||
|
classes("*Factory")
|
||||||
|
classes("*.BuildConfig")
|
||||||
|
classes("*.R")
|
||||||
|
classes("*.R$*")
|
||||||
|
|
||||||
|
// Exclude UI components
|
||||||
|
annotatedBy("*Preview")
|
||||||
|
|
||||||
|
// Exclude declarations
|
||||||
|
annotatedBy(
|
||||||
|
"*.HiltAndroidApp",
|
||||||
|
"*.AndroidEntryPoint",
|
||||||
|
"*.Module",
|
||||||
|
"*.Provides",
|
||||||
|
"*.Binds",
|
||||||
|
"*.Composable",
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
kover(project(":app"))
|
||||||
|
kover(project(":network"))
|
||||||
|
kover(project(":mesh_service_example"))
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.register<Delete>("clean") {
|
tasks.register<Delete>("clean") {
|
||||||
|
|
|
@ -31,6 +31,7 @@ kotlin = "2.2.20"
|
||||||
kotlinx-collections-immutable = "0.4.0"
|
kotlinx-collections-immutable = "0.4.0"
|
||||||
kotlinx-coroutines-android = "1.10.2"
|
kotlinx-coroutines-android = "1.10.2"
|
||||||
kotlinx-serialization-json = "1.9.0"
|
kotlinx-serialization-json = "1.9.0"
|
||||||
|
kover = "0.9.1"
|
||||||
lifecycle = "2.9.3"
|
lifecycle = "2.9.3"
|
||||||
location-services = "21.3.0"
|
location-services = "21.3.0"
|
||||||
maps-compose = "6.10.0"
|
maps-compose = "6.10.0"
|
||||||
|
@ -229,6 +230,7 @@ kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
|
||||||
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
|
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
|
||||||
kotlin-parcelize = { id = "org.jetbrains.kotlin.plugin.parcelize", version.ref = "kotlin" }
|
kotlin-parcelize = { id = "org.jetbrains.kotlin.plugin.parcelize", version.ref = "kotlin" }
|
||||||
kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
|
kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
|
||||||
|
kover = { id = "org.jetbrains.kotlinx.kover", version.ref = "kover" }
|
||||||
protobuf = { id = "com.google.protobuf", version.ref = "protobuf-gradle-plugin" }
|
protobuf = { id = "com.google.protobuf", version.ref = "protobuf-gradle-plugin" }
|
||||||
secrets = { id = "com.google.android.libraries.mapsplatform.secrets-gradle-plugin", version.ref = "secrets-gradle-plugin" }
|
secrets = { id = "com.google.android.libraries.mapsplatform.secrets-gradle-plugin", version.ref = "secrets-gradle-plugin" }
|
||||||
spotless = { id = "com.diffplug.spotless", version .ref= "spotless" }
|
spotless = { id = "com.diffplug.spotless", version .ref= "spotless" }
|
||||||
|
|
|
@ -23,6 +23,7 @@ plugins {
|
||||||
alias(libs.plugins.compose)
|
alias(libs.plugins.compose)
|
||||||
alias(libs.plugins.protobuf)
|
alias(libs.plugins.protobuf)
|
||||||
alias(libs.plugins.detekt)
|
alias(libs.plugins.detekt)
|
||||||
|
alias(libs.plugins.kover)
|
||||||
}
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
|
|
|
@ -25,6 +25,7 @@ plugins {
|
||||||
alias(libs.plugins.detekt)
|
alias(libs.plugins.detekt)
|
||||||
id("kotlinx-serialization")
|
id("kotlinx-serialization")
|
||||||
alias(libs.plugins.dokka)
|
alias(libs.plugins.dokka)
|
||||||
|
alias(libs.plugins.kover)
|
||||||
}
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
|
|
Ładowanie…
Reference in New Issue