diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index bbf8fdf811..4bb11596fa 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -78,6 +78,9 @@ jobs: - name: ⚙️ Run screenshot tests run: ./gradlew :tests:uitests:verifyPaparazziDebug $CI_GRADLE_ARG_PROPERTIES + - name: ⚙️ Run Compound screenshot tests + run: ./gradlew :libraries:compound:verifyRoborazziDebug $CI_GRADLE_ARG_PROPERTIES + - name: ⚙️ Generate kover coverage report run: ./gradlew :koverXmlReportMerged :koverHtmlReportMerged :koverVerifyAll -x testDebugUnitTest $CI_GRADLE_ARG_PROPERTIES diff --git a/build.gradle.kts b/build.gradle.kts index 876383e325..725033a6ea 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -153,7 +153,10 @@ allprojects { maxParallelForks = (Runtime.getRuntime().availableProcessors() / 2).coerceAtLeast(1) val isScreenshotTest = project.gradle.startParameter.taskNames.any { it.contains("paparazzi", ignoreCase = true) } + val isRoborazziTest = project.gradle.startParameter.taskNames.any { it.contains("roborazzi", ignoreCase = true) } if (isScreenshotTest) { + // Paparazzi tests benefit from parallelisation, so we can use half the available cores to run them in parallel. + maxParallelForks = (Runtime.getRuntime().availableProcessors() / 2).coerceAtLeast(1) // Increase heap size for screenshot tests maxHeapSize = "2g" // Record all the languages? @@ -165,9 +168,22 @@ allprojects { exclude("translations/*.class") } } else { + // Robolectric and Compose pay a 5 to 30 seconds bootstrap cost per test JVM (instrumenting + // android-all, then warming up the Compose runtime). That cost is paid once per JVM and then + // amortised over every test class the JVM runs, so splitting a module across several forks + // re-pays it for each fork instead of saving time. Keep a single fork per module and let + // Gradle parallelise by running many modules' test tasks concurrently instead. + maxParallelForks = 1 + // Disable screenshot tests by default exclude("ui/*.class") exclude("translations/*.class") + if (isRoborazziTest.not()) { + // Roborazzi screenshot tests (:libraries:compound) live in a `screenshot` package, which + // the two patterns above do not match, so they used to run on every plain unit test run. + // They are verified by the dedicated `verifyRoborazziDebug` task instead. + exclude("**/screenshot/**") + } } } }