Skip to content

Commit

Permalink
jacoco improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Javier Manrique committed Nov 5, 2024
1 parent 1f22c59 commit 81552e0
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 16 deletions.
9 changes: 8 additions & 1 deletion .github/workflows/code-coverage-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,15 @@ jobs:
- name: Build and test with Gradle
run: ./gradlew clean generateJacocoCoverageReport

- name: Upload unit tests report
if: always()
uses: actions/upload-artifact@v4
with:
name: unit-tests-report
path: build/reports/tests/aggregate

- name: Upload JaCoCo report
if: success()
if: always()
uses: actions/upload-artifact@v4
with:
name: jacoco-report
Expand Down
2 changes: 0 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,6 @@ dependencies {
ksp libs.hilt.compiler
ksp libs.hilt.android.compiler

implementation libs.org.jacoco.agent

kspTest libs.hilt.android.compiler
testImplementation libs.android.runner
testImplementation libs.androidx.core.testing
Expand Down
12 changes: 2 additions & 10 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ buildscript {
classpath(libs.agp)
classpath(libs.karumi.shot)
classpath libs.hilt.android.gradle.plugin
classpath libs.org.jacoco.core
classpath libs.jacoco.org.jacoco.ant
classpath libs.jacoco
}
}

Expand Down Expand Up @@ -55,13 +54,7 @@ project.afterEvaluate {
group = "Reporting"
description = "Generate JaCoCo coverage report for the debug build."

subprojects.collect { subproject ->
subproject.tasks.findAll { task ->
if (task.name == "testDebugUnitTest") {
dependsOn task
}
}
}
dependsOn unitTests

finalizedBy(tasks.named("jacocoCoverageVerification").get())

Expand Down Expand Up @@ -107,7 +100,6 @@ project.afterEvaluate {
}
def sources = subprojects.collect { project ->
[
"${project.projectDir.name}/src/main/java",
"${project.projectDir.name}/src/main/java"
]
}.flatten()
Expand Down
4 changes: 1 addition & 3 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,11 @@ awaitility-kotlin = { module = "org.awaitility:awaitility-kotlin", version.ref =
gradle = { group = "com.android.tools.build", name = "gradle", version.ref = "android-application" }
agp = { group = "org.jetbrains.kotlin", name = "kotlin-gradle-plugin" }
hilt-android-gradle-plugin = { module = "com.google.dagger:hilt-android-gradle-plugin", version.ref = "hilt" }
jacoco-org-jacoco-ant = { module = "org.jacoco:org.jacoco.ant", version.ref = "jacoco" }
kotlin = { group = "org.jetbrains.kotlin", name = "kotlin-stdlib-jdk7", version.ref = "kotlin" }
material = { group = "com.google.android.material", name = "material", version.ref = "material" }
appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompat" }
mockito-inline = { module = "org.mockito:mockito-inline", version.ref = "mockitoInline" }
org-jacoco-agent = { module = "org.jacoco:org.jacoco.agent", version.ref = "jacoco" }
org-jacoco-core = { module = "org.jacoco:org.jacoco.core", version.ref = "jacoco" }
jacoco = { module = "org.jacoco:org.jacoco.core", version.ref = "jacoco" }
window = { group = "androidx.window", name = "window", version.ref = "androidx-window" }
recyclerview = { group = "androidx.recyclerview", name = "recyclerview", version.ref = "recycler-view" }
security = { group = "androidx.security", name = "security-crypto", version.ref = "security-crypto" }
Expand Down

0 comments on commit 81552e0

Please sign in to comment.