Skip to content

Commit 8d0ed83

Browse files
authored
Merge pull request #6392 from getsentry/no/android-sample-own-build
build(samples): [Sample Tests 45] Move the Android sample to its own build
2 parents 370d979 + f9a4d8d commit 8d0ed83

36 files changed

Lines changed: 305 additions & 82 deletions

‎.claude/skills/create-java-pr/SKILL.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,10 @@ Derive the branch name from the changes being made. Use `feat/`, `fix/`, `ref/`,
7474
## Step 2: Format Code and Regenerate API Files
7575

7676
```bash
77-
./gradlew spotlessApply updateKotlinAbi
77+
make format api
7878
```
7979

80-
This is **required** before every PR in this repo. It formats all Java/Kotlin code via Spotless and regenerates the `.api` binary compatibility files.
80+
This is **required** before every PR in this repo. It formats all Java/Kotlin code via Spotless, including the separate builds the root `spotlessApply` doesn't reach, and regenerates the `.api` binary compatibility files.
8181
8282
If the command fails, diagnose and fix the issue before continuing.
8383

‎.github/dependabot.yml‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@ registries:
77
password: dummy # Required by dependabot
88
updates:
99
- package-ecosystem: "gradle"
10-
directory: "/"
10+
# The root build doesn't include the separate sample and test builds.
11+
directories:
12+
- "/"
13+
- "/sentry-samples/sentry-samples-android"
14+
- "/sentry-android-integration-tests"
1115
registries:
1216
- gradle-plugin-portal
1317
schedule:

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

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

9090
- name: Upload test results
9191
if: always()

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
uses: gradle/actions/setup-gradle@8da46b539cd8fe6ab27ca75128919a18d757604c # v6.4.1
2121

2222
- name: Format with spotlessApply
23-
run: ./gradlew spotlessApply
23+
run: make format
2424

2525
# actions/checkout fetches only a single commit in a detached HEAD state. Therefore
2626
# we need to pass the current branch, otherwise we can't commit the changes.

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: 'Integration Tests - Macrobenchmark'
2-
# Runs the sentry-uitest-android-macrobenchmark cold-start benchmark on a Sauce Labs real
2+
# Runs the sentry-samples-android macrobenchmark cold-start benchmark on a Sauce Labs real
33
# device and recovers timeToInitialDisplay from the device log.
44
#
55
on:
@@ -33,7 +33,7 @@ jobs:
3333

3434
- name: Assemble target app and Macrobenchmark apk
3535
if: env.SAUCE_USERNAME != null
36-
run: ./gradlew :sentry-samples:sentry-samples-android:assembleRelease :sentry-android-integration-tests:sentry-uitest-android-macrobenchmark:assembleBenchmark
36+
run: ./gradlew -p sentry-samples/sentry-samples-android :assembleRelease :macrobenchmark:assembleBenchmark
3737

3838
- name: Run Macrobenchmark in SauceLab
3939
uses: saucelabs/saucectl-run-action@283660aa934c02723c497efa151d582a3acc5801 # pin@v3

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,6 @@ jobs:
2929
uses: gradle/actions/setup-gradle@8da46b539cd8fe6ab27ca75128919a18d757604c # v6.4.1
3030

3131
- name: Size Analysis
32-
run: ./gradlew :sentry-android-integration-tests:test-app-size:bundleRelease
32+
run: ./gradlew -p sentry-android-integration-tests :test-app-size:bundleRelease
3333
env:
3434
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}

‎.github/workflows/samples.yml‎

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: 'Samples'
2+
# Runs `check` in each build the SDK build doesn't include, so a broken sample or
3+
# integration test fails its own job instead of the SDK's Build job.
4+
on:
5+
push:
6+
branches:
7+
- main
8+
pull_request:
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
13+
14+
jobs:
15+
check:
16+
name: Check ${{ matrix.name }}
17+
runs-on: ubuntu-latest
18+
19+
strategy:
20+
fail-fast: false
21+
matrix:
22+
include:
23+
- name: sentry-samples-android
24+
path: sentry-samples/sentry-samples-android
25+
- name: sentry-android-integration-tests
26+
path: sentry-android-integration-tests
27+
28+
steps:
29+
- name: Checkout Repo
30+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
31+
32+
- name: Setup Java Version
33+
uses: actions/setup-java@b843ebf9b913146b38da2eaa7aeddf76074ae1ad # v6.1.0
34+
with:
35+
distribution: 'temurin'
36+
java-version: '21'
37+
38+
- name: Setup Gradle
39+
uses: gradle/actions/setup-gradle@8da46b539cd8fe6ab27ca75128919a18d757604c # v6.4.1
40+
41+
- name: Run Tests and Lint
42+
run: ./gradlew -p ${{ matrix.path }} check
43+
44+
- name: Upload test results
45+
if: always()
46+
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7
47+
with:
48+
name: test-results-${{ matrix.name }}
49+
path: |
50+
**/build/reports/*

‎.sauce/sentry-uitest-android-macrobenchmark.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ defaults:
1515

1616
espresso:
1717
app: ./sentry-samples/sentry-samples-android/build/outputs/apk/release/sentry-samples-android-release.apk
18-
testApp: ./sentry-android-integration-tests/sentry-uitest-android-macrobenchmark/build/outputs/apk/benchmark/sentry-uitest-android-macrobenchmark-benchmark.apk
18+
testApp: ./sentry-samples/sentry-samples-android/macrobenchmark/build/outputs/apk/benchmark/macrobenchmark-benchmark.apk
1919

2020
suites:
2121

‎AGENTS.md‎

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ The project uses **Gradle** with Kotlin DSL. Key build files:
4141
## Essential Commands
4242

4343
```bash
44-
# Format code and regenerate .api files (REQUIRED before committing)
45-
./gradlew spotlessApply updateKotlinAbi
44+
# Format code in every build and regenerate .api files (REQUIRED before committing)
45+
make format api
4646

4747
# Run all tests and linter
4848
./gradlew check
@@ -59,11 +59,14 @@ 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
67+
68+
# Build the Android sample, a separate Gradle build that includes this one
69+
./gradlew -p sentry-samples/sentry-samples-android assembleDebug
6770
```
6871

6972
## Development Workflow Rules
@@ -74,7 +77,7 @@ resolves the per-module test task, including integration test suites, for you.
7477
3. **Use todo tracking**: Work through todo items, marking them as complete as you go
7578
4. **High-level communication**: Give high-level explanations of changes made, not step-by-step descriptions
7679
5. **Simplicity first**: Make every task and code change as simple as possible. Avoid massive or complex changes. Impact as little code as possible.
77-
6. **Format and regenerate**: Once done, format code and regenerate .api files: `./gradlew spotlessApply updateKotlinAbi`
80+
6. **Format and regenerate**: Once done, format code and regenerate .api files: `make format api`
7881
7. **Propose commit**: As final step, git stage relevant files and propose (but not execute) a single git commit command. This applies to implementation work; when the task is to open a PR, the `create-java-pr` skill takes over from here and does commit, push, and open it.
7982

8083
## Repository Skills
@@ -110,7 +113,7 @@ The repository is organized into multiple modules:
110113

111114
### Utility Modules
112115
- **`sentry-test-support`** - Shared test utilities, including `MockSentryServer` and envelope matchers
113-
- **`sentry-samples`** - Example applications
116+
- **`sentry-samples`** - Example applications. `sentry-samples-android` is a separate Gradle build that includes this one, so root tasks such as `check` and `spotlessApply` don't reach it
114117
- **`sentry-bom`** - Bill of Materials for dependency management
115118

116119
### Key Architectural Patterns

‎CONTRIBUTING.md‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,7 @@ To format the changed code and make CI happy you can run:
7373
make format
7474
```
7575

76-
or
77-
78-
```shell
79-
./gradlew spotlessApply
80-
```
76+
`./gradlew spotlessApply` alone formats only the SDK build, not the separate builds it doesn't include, such as the Android sample.
8177

8278
# Binary compatibility validation
8379

0 commit comments

Comments
 (0)