Skip to content

Commit 0ec48f1

Browse files
runningcodeclaude
andcommitted
build(samples): Move the Android integration tests to their own build
sentry-uitest-android, sentry-uitest-android-critical and test-app-size are now a standalone Gradle build that includes the SDK build, like the Android sample. They depend on io.sentry:* coordinates, which Gradle substitutes with the SDK's projects, including the unpublished sentry-test-support. The SDK build doesn't include them back, so SAGP, errorprone's uitest checks and their AndroidX test dependencies no longer load in the SDK build. AGP stays shared: a composite build can only use one AGP version, so the AGP matrix job's VERSION_AGP still applies to both builds. Root check and spotlessApply no longer reach these apps, so preMerge runs this build's check, which covers what the root check ran for them: lint, detekt and spotless. The format workflow runs its spotlessApply, and the AGP matrix, UI test and size workflows call it with -p. APK paths don't change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 0da6737 commit 0ec48f1

14 files changed

Lines changed: 162 additions & 26 deletions

File tree

‎.github/workflows/agp-matrix.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ jobs:
9090
disable-spellchecker: true
9191
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
9292
disk-size: 4096M
93-
script: ./gradlew sentry-android-integration-tests:sentry-uitest-android:connectedReleaseAndroidTest -Denvironment=github --daemon
93+
script: ./gradlew -p sentry-android-integration-tests :sentry-uitest-android:connectedReleaseAndroidTest -Denvironment=github --daemon
9494

9595
- name: Upload test results
9696
if: always()

‎.github/workflows/format-code.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ jobs:
2727
run: |
2828
./gradlew spotlessApply
2929
./gradlew -p sentry-samples/sentry-samples-android spotlessApply
30+
./gradlew -p sentry-android-integration-tests spotlessApply
3031
3132
# actions/checkout fetches only a single commit in a detached HEAD state. Therefore
3233
# we need to pass the current branch, otherwise we can't commit the changes.

‎.github/workflows/integration-tests-size.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,6 @@ jobs:
4141
cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
4242

4343
- name: Size Analysis
44-
run: ./gradlew :sentry-android-integration-tests:test-app-size:bundleRelease
44+
run: ./gradlew -p sentry-android-integration-tests :test-app-size:bundleRelease
4545
env:
4646
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}

‎AGENTS.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ resolves the per-module test task, including integration test suites, for you.
5959

6060
### Android-Specific Commands
6161
```bash
62-
# Assemble Android test APKs
63-
./gradlew :sentry-android-integration-tests:sentry-uitest-android:assembleRelease :sentry-android-integration-tests:sentry-uitest-android:assembleAndroidTest
62+
# Assemble Android test APKs, in a separate Gradle build that includes this one
63+
./gradlew -p sentry-android-integration-tests :sentry-uitest-android:assembleRelease :sentry-uitest-android:assembleAndroidTest
6464

6565
# Run critical UI tests
6666
./scripts/test-ui-critical.sh

‎Makefile‎

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
.PHONY: all clean compile javadocs dryRelease update checkFormat api assembleUiTestRelease assembleUiTestCriticalRelease runUiTestCritical check checkSampleAndroid preMerge publish
1+
.PHONY: all clean compile javadocs dryRelease update checkFormat api assembleUiTestRelease assembleUiTestCriticalRelease runUiTestCritical check checkSampleAndroid checkIntegrationTests preMerge publish
22

33
all: stop clean javadocs compile
44
assembleUiTests: assembleUiTestRelease
5-
preMerge: check checkSampleAndroid
5+
preMerge: check checkSampleAndroid checkIntegrationTests
66
publish: clean dryRelease
77

88
# deep clean
@@ -29,18 +29,19 @@ update:
2929
checkFormat:
3030
./gradlew spotlessJavaCheck spotlessKotlinCheck
3131
./gradlew -p sentry-samples/sentry-samples-android spotlessJavaCheck spotlessKotlinCheck
32+
./gradlew -p sentry-android-integration-tests spotlessJavaCheck spotlessKotlinCheck
3233

3334
# Binary compatibility validator
3435
api:
3536
./gradlew updateKotlinAbi
3637

3738
# Assemble release and Android test apk of the uitest-android module
3839
assembleUiTestRelease:
39-
./gradlew :sentry-android-integration-tests:sentry-uitest-android:assembleRelease :sentry-android-integration-tests:sentry-uitest-android:assembleAndroidTest
40+
./gradlew -p sentry-android-integration-tests :sentry-uitest-android:assembleRelease :sentry-uitest-android:assembleAndroidTest
4041

4142
# Assemble release of the uitest-android-critical module
4243
assembleUiTestCriticalRelease:
43-
./gradlew :sentry-android-integration-tests:sentry-uitest-android-critical:assembleRelease
44+
./gradlew -p sentry-android-integration-tests :sentry-uitest-android-critical:assembleRelease
4445

4546
# Run Maestro tests for the uitest-android-critical module
4647
runUiTestCritical:
@@ -53,3 +54,7 @@ check:
5354
# The Android sample is a separate build, so the root `check` doesn't reach it
5455
checkSampleAndroid:
5556
./gradlew -p sentry-samples/sentry-samples-android check
57+
58+
# The Android integration tests are a separate build, so the root `check` doesn't reach them
59+
checkIntegrationTests:
60+
./gradlew -p sentry-android-integration-tests check
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
# Android performance-impact and integration tests
22

3+
This directory is a separate Gradle build that includes the SDK build, so run its tasks with
4+
`./gradlew -p sentry-android-integration-tests <task>`. The SDK build doesn't include it, so
5+
`./gradlew` from the repository root doesn't build, lint or format these apps.
6+
37
* [Espresso-based UI tests](./sentry-uitest-android) - run within SauceLabs (see /.sauce/*.yml)
48
* Also used for compatibility test matrix against new AGP versions
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// Loads the plugins once for every subproject, so they all share one classpath.
2+
plugins {
3+
alias(libs.plugins.android.application) apply false
4+
alias(libs.plugins.kotlin.android) apply false
5+
alias(libs.plugins.kotlin.compose) apply false
6+
alias(libs.plugins.errorprone) apply false
7+
alias(libs.plugins.detekt) apply false
8+
alias(libs.plugins.gradle.versions) apply false
9+
alias(libs.plugins.sentry) apply false
10+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Gradle properties are per build, so this repeats what these apps need from the SDK build's
2+
# gradle.properties. settings.gradle.kts reads the SDK version from that file.
3+
4+
org.gradle.jvmargs=-Xmx6g -XX:MaxMetaspaceSize=2g -XX:+CrashOnOutOfMemoryError -Dfile.encoding=UTF-8 -XX:+UseParallelGC
5+
org.gradle.caching=true
6+
org.gradle.parallel=true
7+
org.gradle.configureondemand=true
8+
org.gradle.configuration-cache=true
9+
org.gradle.configuration-cache.parallel=true
10+
11+
android.useAndroidX=true
12+
# AGP 9+ migration opt-outs until we remove kotlin-android plugin and adopt built-in Kotlin.
13+
android.builtInKotlin=false
14+
android.newDsl=false
15+
16+
android.defaults.buildfeatures.renderscript=false
17+
android.defaults.buildfeatures.shaders=false
18+
android.defaults.buildfeatures.aidl=false
19+
android.defaults.buildfeatures.resvalues=false
20+
android.nonTransitiveRClass=true
21+
22+
kotlin.stdlib.default.dependency=false
23+
24+
systemProp.org.gradle.internal.http.socketTimeout=120000

‎sentry-android-integration-tests/sentry-uitest-android-critical/build.gradle.kts‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,12 @@ plugins {
55
id("com.android.application")
66
alias(libs.plugins.kotlin.android)
77
alias(libs.plugins.kotlin.compose)
8+
id("io.sentry.spotless")
9+
id("io.sentry.jdk-target")
810
}
911

12+
val sentryVersion = libs.versions.sentry.get()
13+
1014
android {
1115
compileSdk = libs.versions.compileSdk.get().toInt()
1216
compileSdkMinor = libs.versions.compileSdkMinor.get().toInt()
@@ -47,7 +51,7 @@ dependencies {
4751
implementation(libs.androidx.compose.material3)
4852
implementation(libs.androidx.constraintlayout)
4953
implementation(libs.androidx.core)
50-
implementation(projects.sentryAndroidCore)
54+
implementation("io.sentry:sentry-android-core:$sentryVersion")
5155
}
5256

5357
tasks.withType<Detekt>().configureEach {

‎sentry-android-integration-tests/sentry-uitest-android/README.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ By default the envelopes sent to relay are caught by a mock server which allows
55

66
# How to use
77

8-
Simply run `./gradlew connectedCheck` to run all ui tests of all modules (requires a connected device, either physical or an emulator).
8+
Simply run `./gradlew -p sentry-android-integration-tests connectedCheck` to run all ui tests of all modules (requires a connected device, either physical or an emulator).
99

1010
# SauceLabs
1111
To run on saucelabs execute following commands (need also `SAUCE_USERNAME` and `SAUCE_ACCESS_KEY` environment variables):
1212
For End 2 End:
1313
```
14-
./gradlew :sentry-android-integration-tests:sentry-uitest-android:assembleRelease :sentry-android-integration-tests:sentry-uitest-android:assembleAndroidTest
14+
./gradlew -p sentry-android-integration-tests :sentry-uitest-android:assembleRelease :sentry-uitest-android:assembleAndroidTest
1515
saucectl run -c .sauce/sentry-uitest-android-end2end.yml
1616
```
1717

0 commit comments

Comments
 (0)