Compare commits
1 Commits
1bc0caac29
...
6e80198695
Author | SHA1 | Date | |
---|---|---|---|
6e80198695 |
@ -44,20 +44,20 @@ jobs:
|
||||
api-level: 29
|
||||
script: |
|
||||
./gradlew androidApp:createScreenshotDirectory
|
||||
./gradlew androidApp:connectedAndroidTest || true
|
||||
./gradlew JacocoDebugCodeCoverage || true
|
||||
./gradlew androidApp:fetchScreenshots
|
||||
- uses: actions/upload-artifact@v3
|
||||
if: always()
|
||||
with:
|
||||
name: failure-espresso
|
||||
path: build/reports/androidTests/connected/screenshots
|
||||
path: androidApp/build/reports/androidTests/connected/screenshots
|
||||
retention-days: 2
|
||||
overwrite: true
|
||||
include-hidden-files: true
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: coverage-espresso
|
||||
path: androidApp/build/reports/coverage/androidTest/githubConfig/debug/connected
|
||||
path: androidApp/build/reports/jacoco/JacocoDebugCodeCoverage
|
||||
retention-days: 1
|
||||
overwrite: true
|
||||
include-hidden-files: true
|
||||
|
@ -10,6 +10,7 @@ plugins {
|
||||
id("com.mikepenz.aboutlibraries.plugin")
|
||||
id("org.jetbrains.kotlinx.kover")
|
||||
id("app.cash.sqldelight") version "2.0.2"
|
||||
jacoco
|
||||
}
|
||||
|
||||
fun Project.execWithOutput(
|
||||
@ -64,6 +65,15 @@ fun versionNameFromGit(): String {
|
||||
return gitVersion()
|
||||
}
|
||||
|
||||
val exclusions =
|
||||
listOf(
|
||||
"**/R.class",
|
||||
"**/R\$*.class",
|
||||
"**/BuildConfig.*",
|
||||
"**/Manifest*.*",
|
||||
"**/*Test*.*",
|
||||
)
|
||||
|
||||
android {
|
||||
compileOptions {
|
||||
isCoreLibraryDesugaringEnabled = true
|
||||
@ -114,6 +124,39 @@ android {
|
||||
installation {
|
||||
installOptions("-g", "-r")
|
||||
}
|
||||
|
||||
val androidTests = "connectedAndroidTest"
|
||||
tasks.register<JacocoReport>("JacocoDebugCodeCoverage") {
|
||||
// Depend on unit tests and Android tests tasks
|
||||
dependsOn(listOf(androidTests))
|
||||
// Set task grouping and description
|
||||
group = "Reporting"
|
||||
description = "Execute UI and unit tests, generate and combine Jacoco coverage report"
|
||||
// Configure reports to generate both XML and HTML formats
|
||||
reports {
|
||||
xml.required.set(true)
|
||||
html.required.set(true)
|
||||
}
|
||||
// Set source directories to the main source directory
|
||||
sourceDirectories.setFrom(layout.projectDirectory.dir("src/main"))
|
||||
// Set class directories to compiled Java and Kotlin classes, excluding specified exclusions
|
||||
classDirectories.setFrom(
|
||||
files(
|
||||
fileTree(layout.buildDirectory.dir("intermediates/javac/")) {
|
||||
exclude(exclusions)
|
||||
},
|
||||
fileTree(layout.buildDirectory.dir("tmp/kotlin-classes/")) {
|
||||
exclude(exclusions)
|
||||
},
|
||||
),
|
||||
)
|
||||
// Collect execution data from .exec and .ec files generated during test execution
|
||||
executionData.setFrom(
|
||||
files(
|
||||
fileTree(layout.buildDirectory) { include(listOf("**/*.exec", "**/*.ec")) },
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
flavorDimensions.add("build")
|
||||
@ -268,3 +311,12 @@ tasks.register<Exec>("fetchScreenshots") {
|
||||
reportsDirectory.mkdirs()
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType(Test::class) {
|
||||
if (this.name == "connectedAndroidTest") {
|
||||
configure<JacocoTaskExtension> {
|
||||
isIncludeNoLocationClasses = true
|
||||
excludes = listOf("jdk.internal.*")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user