Browse Source

Test and verify coverage only on debug variant (#2556)

* Test and verify coverage only on debug variant

* Set files to upload

* Fix also nightlyReports flow
pull/2559/head
Jorge Martin Espinosa 6 months ago committed by GitHub
parent
commit
810c0ed8f3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      .github/workflows/nightlyReports.yml
  2. 12
      .github/workflows/tests.yml
  3. 23
      app/build.gradle.kts
  4. 3
      plugins/src/main/kotlin/extension/KoverExtension.kt

2
.github/workflows/nightlyReports.yml

@ -33,7 +33,7 @@ jobs: @@ -33,7 +33,7 @@ jobs:
run: ./gradlew verifyPaparazziDebug $CI_GRADLE_ARG_PROPERTIES
- name: 📈 Generate kover report and verify coverage
run: ./gradlew :app:koverHtmlReport :app:koverXmlReport :app:koverVerify $CI_GRADLE_ARG_PROPERTIES -Pci-build=true
run: ./gradlew :app:koverXmlReportGplayDebug :app:koverHtmlReportGplayDebug :app:koverVerifyGplayDebug $CI_GRADLE_ARG_PROPERTIES
- name: ✅ Upload kover report
if: always()

12
.github/workflows/tests.yml

@ -48,14 +48,14 @@ jobs: @@ -48,14 +48,14 @@ jobs:
with:
cache-read-only: ${{ github.ref != 'refs/heads/develop' }}
- name: Run unit tests, debug and release
run: ./gradlew test $CI_GRADLE_ARG_PROPERTIES
- name: Run unit tests for debug variant
run: ./gradlew testDebugUnitTest $CI_GRADLE_ARG_PROPERTIES
- name: 📸 Run screenshot tests
run: ./gradlew verifyPaparazziDebug $CI_GRADLE_ARG_PROPERTIES
- name: 📈Generate kover report and verify coverage
run: ./gradlew :app:koverHtmlReport :app:koverXmlReport :app:koverVerify $CI_GRADLE_ARG_PROPERTIES -Pci-build=true
run: ./gradlew :app:koverXmlReportGplayDebug :app:koverHtmlReportGplayDebug :app:koverVerifyGplayDebug $CI_GRADLE_ARG_PROPERTIES
- name: 🚫 Upload kover failed coverage reports
if: failure()
@ -63,7 +63,7 @@ jobs: @@ -63,7 +63,7 @@ jobs:
with:
name: kover-error-report
path: |
app/build/reports/kover/verify.err
app/build/reports/kover/verifyGplayDebug.err
- name: ✅ Upload kover report (disabled)
if: always()
@ -85,5 +85,5 @@ jobs: @@ -85,5 +85,5 @@ jobs:
with:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
# with:
# files: build/reports/kover/xml/report.xml
files: app/build/reports/kover/reportGplayDebug.xml
verbose: true

23
app/build.gradle.kts

@ -24,7 +24,6 @@ import extension.gitBranchName @@ -24,7 +24,6 @@ import extension.gitBranchName
import extension.gitRevision
import extension.koverDependencies
import extension.setupKover
import org.jetbrains.kotlin.cli.common.toBooleanLenient
plugins {
id("io.element.android-compose-application")
@ -189,7 +188,7 @@ androidComponents { @@ -189,7 +188,7 @@ androidComponents {
val abiCode = abiVersionCodes[name] ?: 0
// Assigns the new version code to output.versionCode, which changes the version code
// for only the output APK, not for the variant itself.
output.versionCode.set((output.versionCode.get() ?: 0) * 10 + abiCode)
output.versionCode.set((output.versionCode.orNull ?: 0) * 10 + abiCode)
}
}
}
@ -215,26 +214,6 @@ knit { @@ -215,26 +214,6 @@ knit {
}
}
val ciBuildProperty = "ci-build"
val isCiBuild = if (project.hasProperty(ciBuildProperty)) {
val raw = project.property(ciBuildProperty) as? String
raw?.toBooleanLenient() == true || raw?.toIntOrNull() == 1
} else {
false
}
kover {
// When running on the CI, run only debug test variants
if (isCiBuild) {
excludeTests {
// Disable instrumentation for debug test tasks
tasks(
"testDebugUnitTest",
)
}
}
}
dependencies {
allLibrariesImpl()
allServicesImpl()

3
plugins/src/main/kotlin/extension/KoverExtension.kt

@ -100,7 +100,6 @@ fun Project.setupKover() { @@ -100,7 +100,6 @@ fun Project.setupKover() {
defaults {
// add reports of both 'debug' and 'release' Android build variants to default reports
mergeWith("gplayDebug")
mergeWith("gplayRelease")
verify {
onCheck = true
@ -203,8 +202,6 @@ fun Project.setupKover() { @@ -203,8 +202,6 @@ fun Project.setupKover() {
}
}
}
androidReports("gplayRelease") {}
}
}

Loading…
Cancel
Save