From 52d146a59d5cde9fb0400f0281a1b52921f27b58 Mon Sep 17 00:00:00 2001 From: Jorge Martin Espinosa Date: Thu, 30 Jul 2026 11:51:18 +0200 Subject: [PATCH] CI: split unit tests, screenshots and coverage in `tests.yml` (#7296) * Check if splitting the steps for testing and generating the reports improves performance and keeps the coverage stats * Exclude Konsist tests and include `:app` ones * Remove the extra dependency of `koverVerifyAll` on `:app:koverVerify{variant}` --- .github/workflows/tests.yml | 14 ++++++++++---- .../src/main/kotlin/extension/KoverExtension.kt | 3 +-- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 72f1f7cce7..5ee7f5065d 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -12,7 +12,7 @@ permissions: {} # 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 --no-daemon -Dsonar.gradle.skipCompile=true --no-configuration-cache + CI_GRADLE_ARG_PROPERTIES: --stacktrace -Dsonar.gradle.skipCompile=true --no-configuration-cache jobs: tests: @@ -72,8 +72,14 @@ jobs: with: cache-read-only: ${{ github.ref != 'refs/heads/develop' }} - - name: ⚙️ Check coverage for debug variant (includes unit & screenshot tests) - run: ./gradlew testDebugUnitTest :tests:uitests:verifyPaparazziDebug :koverXmlReportMerged :koverHtmlReportMerged :koverVerifyAll $CI_GRADLE_ARG_PROPERTIES + - name: ⚙️ Run unit tests + run: ./gradlew :app:testGplayDebugUnitTest testDebugUnitTest -x :tests:konsist:testDebugUnitTest $CI_GRADLE_ARG_PROPERTIES + + - name: ⚙️ Run screenshot tests + run: ./gradlew :tests:uitests:verifyPaparazziDebug $CI_GRADLE_ARG_PROPERTIES + + - name: ⚙️ Generate kover coverage report + run: ./gradlew :koverXmlReportMerged :koverHtmlReportMerged :koverVerifyAll -x testDebugUnitTest $CI_GRADLE_ARG_PROPERTIES - name: 🚫 Upload kover failed coverage reports if: failure() @@ -81,7 +87,7 @@ jobs: with: name: kover-error-report path: | - app/build/reports/kover + build/reports/kover - name: ✅ Upload kover report (disabled) if: always() diff --git a/plugins/src/main/kotlin/extension/KoverExtension.kt b/plugins/src/main/kotlin/extension/KoverExtension.kt index c851a25ab9..610562ce6a 100644 --- a/plugins/src/main/kotlin/extension/KoverExtension.kt +++ b/plugins/src/main/kotlin/extension/KoverExtension.kt @@ -64,8 +64,7 @@ fun Project.setupKover() { tasks.register("koverVerifyAll") { group = "verification" description = "Verifies the code coverage of all subprojects." - val dependencies = listOf(":koverVerifyMerged") + koverVariants.map { ":app:koverVerify${it.replaceFirstChar(Char::titlecase)}" } - dependsOn(dependencies) + dependsOn(":koverVerifyMerged") } // https://kotlin.github.io/kotlinx-kover/ // Run `./gradlew :app:koverHtmlReport` to get report at ./app/build/reports/kover