Browse Source

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
pull/2600/head
Jorge Martin Espinosa 2 weeks ago committed by GitHub
parent
commit
4d6b37f157
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 14
      .github/workflows/tests.yml
  2. 10
      tests/uitests/build.gradle.kts

14
.github/workflows/tests.yml

@ -10,7 +10,7 @@ on: @@ -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: @@ -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: @@ -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()

10
tests/uitests/build.gradle.kts

@ -19,16 +19,6 @@ android { @@ -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") {

Loading…
Cancel
Save