Skip to content

Commit

Permalink
chore: adjust test coverage settings (#1315)
Browse files Browse the repository at this point in the history
* chore: adjust config of report codecov

* chore: adjust config of report codecov

* chore: adjust jacoco excludes of compposables by pattern name

* chore: cleanup

* chore: cleanup

* chore: cleanup
  • Loading branch information
yamilmedina authored Jan 12, 2023
1 parent e2bd52b commit d63720a
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 27 deletions.
13 changes: 6 additions & 7 deletions buildSrc/src/main/kotlin/scripts/quality.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package scripts

import io.gitlab.arturbosch.detekt.Detekt
import io.gitlab.arturbosch.detekt.DetektCreateBaselineTask
import scripts.Variants_gradle.Default

plugins {
id("com.android.application") apply false
Expand Down Expand Up @@ -83,10 +82,11 @@ tasks.register("staticCodeAnalysis") {
val jacocoReport by tasks.registering(JacocoReport::class) {
group = "Quality"
description = "Reports code coverage on tests within the Wire Android codebase"
dependsOn("test${Default.BUILD_VARIANT}UnitTest")
val buildVariant = "devDebug" // It's not necessary to run unit tests on every variant so we default to "devDebug"
dependsOn("test${buildVariant.capitalize()}UnitTest")

val outputDir = "$buildDir/jacoco/html"
val classPathBuildVariant = "${Default.BUILD_FLAVOR}${Default.BUILD_TYPE.capitalize()}"
val classPathBuildVariant = buildVariant

reports {
xml.required.set(true)
Expand All @@ -97,9 +97,7 @@ val jacocoReport by tasks.registering(JacocoReport::class) {
classDirectories.setFrom(
fileTree(project.buildDir) {
include(
"**/classes/**/main/**",
"**/intermediates/classes/$classPathBuildVariant/**",
"**/intermediates/javac/$classPathBuildVariant/*/classes/**",
"**/classes/**/main/**", // This probably can be removed
"**/tmp/kotlin-classes/$classPathBuildVariant/**"
)
exclude(
Expand All @@ -118,8 +116,9 @@ val jacocoReport by tasks.registering(JacocoReport::class) {
"**/*Response.*",
"**/*Application.*",
"**/*Entity.*",
"**/*Screen.*",
"**/mock/**",
"**/*Screen*", // These are composable classes
"**/*Kt*", // These are "usually" kotlin generated classes
"**/theme/**/*.*", // Ignores jetpack compose theme related code
"**/common/**/*.*", // Ignores jetpack compose common components related code
"**/navigation/**/*.*" // Ignores jetpack navigation related code
Expand Down
54 changes: 34 additions & 20 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,48 @@
# Coverage configuration
#
# Validate this file using the following command in root project:
# curl -X POST --data-binary @codecov.yml https://codecov.io/validate
# ----------------------
codecov:
notify:
wait_for_ci: false

coverage:
status:
project:
default:
# basic
target: auto
threshold: 5%
base: auto
patch: false
status:
project:
default:
target: auto
threshold: 2%
base: auto
patch:
default:
informational: true # don't fail the build if patch coverage is below threshold
target: 80%
base: auto

# Ignoring Paths
# --------------
# which folders/files to ignore
ignore:
- ".*/test/.*"
- "buildSrc/.*"
- "kalium/.*"
- ".*/androidTest/.*"
- ".*/_version.py"
- "setup.py"
- ".*/_Screen.kt"
- ".*/mock/.*"
- ".*/theme/.*"
- ".*/common/.*"
- ".*/navigation/.*"
- ".*/test/.*"
- "buildSrc/.*"
- "kalium/.*"
- ".*/androidTest/.*"
- ".*/_version.py"
- "setup.py"
- ".*/_Screen.kt"
- ".*/mock/.*"
- ".*/theme/.*"
- ".*/common/.*"
- ".*/navigation/.*"
- ".*/di/.*"
- ".*/.*Screen*.kt"

# Pull request comments:
# ----------------------
# Diff is the Coverage Diff of the pull request.
# Files are the files impacted by the pull request
comment:
layout: diff, files # accepted in any order: reach, diff, flags, and/or files
layout: diff, files, footer
behavior: default
require_changes: true

0 comments on commit d63720a

Please sign in to comment.