From 9402ab13d3e5c7a36f667bd84931f7635d53f8a9 Mon Sep 17 00:00:00 2001 From: "sentry-junior[bot]" <264270552+sentry-junior[bot]@users.noreply.github.com> Date: Fri, 20 Nov 2026 10:48:42 +0000 Subject: [PATCH] ci(replay): Run Compose UI test matrix in a dedicated workflow Co-Authored-By: Nelson Osacky --- .../workflows/replay-compose-ui-matrix.yml | 54 +++++++++++++++++++ sentry-android-replay/build.gradle.kts | 20 ++++++- 2 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/replay-compose-ui-matrix.yml diff --git a/.github/workflows/replay-compose-ui-matrix.yml b/.github/workflows/replay-compose-ui-matrix.yml new file mode 100644 index 0000000000..b27ba4c0a9 --- /dev/null +++ b/.github/workflows/replay-compose-ui-matrix.yml @@ -0,0 +1,54 @@ +name: 'Replay Compose UI Matrix' +on: + push: + branches: + - main + pull_request: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + replay-compose-ui-matrix: + name: Replay Compose UI Matrix + runs-on: ubuntu-latest + + steps: + - name: Checkout Repo + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + ref: ${{ github.event.pull_request.head.sha || github.sha }} + + - name: Setup Java Version + uses: actions/setup-java@d1374f8ac74474200d16ef8ecee22c7ae7a51880 # v6.3.0 + with: + distribution: 'temurin' + java-version: '21' + + - name: Setup Gradle + uses: gradle/actions/setup-gradle@8da46b539cd8fe6ab27ca75128919a18d757604c # v6.4.1 + + - name: Run Replay Tests Against Each Compose UI Version + run: ./gradlew :sentry-android-replay:testComposeUiMatrix -PcomposeUiTestMatrix + + - name: Upload test results + if: always() + uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7 + with: + name: test-results-replay-compose-ui-matrix + path: | + sentry-android-replay/build/reports/* + + - name: Test Report + uses: phoenix-actions/test-reporting@7317eea6e13c47348dd0bb318669485157c518d6 # pin@v16 + if: always() + with: + name: JUnit Replay Compose UI Matrix + list-suites: 'failed' + list-tests: 'failed' + path: | + sentry-android-replay/build/test-results/**/*.xml + reporter: java-junit + output-to: step-summary + fail-on-error: false diff --git a/sentry-android-replay/build.gradle.kts b/sentry-android-replay/build.gradle.kts index d0d101d190..e9feb65c77 100644 --- a/sentry-android-replay/build.gradle.kts +++ b/sentry-android-replay/build.gradle.kts @@ -20,7 +20,15 @@ plugins { // Session Replay calls Compose internals, whose mangled JVM names change between Compose versions. // Creating extra build types to run tests against the latest stable, and latest preview version. -val composeUiTestVersions = mapOf("composeUi112" to "1.12.1", "composeUi113" to "1.13.0-rc01") +// These are heavy Robolectric runs, so they stay out of `check` and only exist when the +// composeUiTestMatrix property is set. CI runs them in their own job: +// ./gradlew :sentry-android-replay:testComposeUiMatrix -PcomposeUiTestMatrix +val composeUiTestVersions = + if (providers.gradleProperty("composeUiTestMatrix").isPresent) { + mapOf("composeUi112" to "1.12.1", "composeUi113" to "1.13.0-rc01") + } else { + emptyMap() + } android { compileSdk = libs.versions.compileSdk.get().toInt() @@ -127,6 +135,16 @@ composeUiTestVersions.forEach { (buildType, version) -> } } +if (composeUiTestVersions.isNotEmpty()) { + tasks.register("testComposeUiMatrix") { + group = "verification" + description = "Runs the unit tests against each Compose UI version in composeUiTestVersions." + dependsOn( + composeUiTestVersions.keys.map { "test${it.replaceFirstChar(Char::uppercase)}UnitTest" }, + ) + } +} + tasks.withType().configureEach { // Target version of the generated JVM bytecode. It is used for type resolution. jvmTarget = JavaVersion.VERSION_1_8.toString()