Merge unit, screenshot tests and coverage in a single CI call (#3593)

* Merge unit, screenshot tests and coverage tasks in a single CI call

* Disable gradle daemon too since it's all in a single gradle call now

* Make Kover upload the HTML reports on failure too
This commit is contained in:
Jorge Martin Espinosa
2024-10-03 15:38:08 +02:00
committed by GitHub
parent 60f1bf6e54
commit 0350a95672
2 changed files with 4 additions and 20 deletions

View File

@@ -10,7 +10,7 @@ on:
# Enrich gradle.properties for CI/CD
env:
GRADLE_OPTS: -Dorg.gradle.jvmargs="-Xmx7g -XX:MaxMetaspaceSize=512m -Dfile.encoding=UTF-8 -XX:+HeapDumpOnOutOfMemoryError" -Dkotlin.daemon.jvm.options=-Xmx2g -XX:+UseG1GC
CI_GRADLE_ARG_PROPERTIES: --stacktrace -Dsonar.gradle.skipCompile=true
CI_GRADLE_ARG_PROPERTIES: --stacktrace -Dsonar.gradle.skipCompile=true --no-daemon
jobs:
tests:
@@ -56,14 +56,8 @@ jobs:
with:
cache-read-only: ${{ github.ref != 'refs/heads/develop' }}
- 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:koverXmlReportGplayDebug :app:koverHtmlReportGplayDebug :app:koverVerifyAll $CI_GRADLE_ARG_PROPERTIES
- name: ⚙️ Check coverage for debug variant (includes unit & screenshot tests)
run: ./gradlew :tests:uitests:verifyPaparazziDebug :app:koverXmlReportGplayDebug :app:koverHtmlReportGplayDebug :app:koverVerifyAll $CI_GRADLE_ARG_PROPERTIES
- name: 🚫 Upload kover failed coverage reports
if: failure()
@@ -71,7 +65,7 @@ jobs:
with:
name: kover-error-report
path: |
app/build/reports/kover/verifyGplayDebug.err
app/build/reports/kover
- name: ✅ Upload kover report (disabled)
if: always()

View File

@@ -19,16 +19,6 @@ android {
namespace = "ui"
}
// Workaround: `kover` tasks somehow trigger the screenshot tests with a broken configuration, removing
// any previous test results and not creating new ones. This is a workaround to disable the screenshot tests
// when the `kover` tasks are detected.
tasks.withType<Test> {
if (project.gradle.startParameter.taskNames.any { it.contains("kover", ignoreCase = true) }) {
println("WARNING: Kover task detected, disabling screenshot test task $name.")
isEnabled = false
}
}
dependencies {
// Paparazzi 1.3.2 workaround (see https://github.com/cashapp/paparazzi/blob/master/CHANGELOG.md#132---2024-01-13)
constraints.add("testImplementation", "com.google.guava:guava") {