Skip to content

Commit c2b3efd

Browse files
runningcodeclaude
andcommitted
ci(macrobenchmark): Run startup benchmark on Sauce Labs (POC)
The sentry-uitest-android-macrobenchmark module currently only runs on a locally connected device. This wires it to Sauce Labs so we can evaluate whether the cold-start timeToInitialDisplay benchmark can run on the real-device cloud already used by our other benchmarks. This is a proof-of-concept, gated behind workflow_dispatch and kept off the per-PR path. Device-guard errors are intentionally not suppressed: on non-rooted, unlocked-clock cloud devices the guards (UNLOCKED, DEBUGGABLE, ...) are expected to fire, and seeing which ones fire is the point of the POC. It also tells us whether timeToInitialDisplay can be retrieved from Sauce artifacts (benchmark JSON) or must be parsed from the device log. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 5043164 commit c2b3efd

3 files changed

Lines changed: 109 additions & 1 deletion

File tree

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: 'Integration Tests - Macrobenchmark (POC)'
2+
# Proof-of-concept: run the sentry-uitest-android-macrobenchmark cold-start benchmark on Sauce
3+
# Labs real devices. Manual trigger only — this is not yet a per-PR gate. The goal is to learn
4+
# (a) whether Macrobenchmark runs on non-rooted cloud devices and which device guards fire, and
5+
# (b) whether timeToInitialDisplay can be retrieved from Sauce artifacts. See the module README.
6+
on:
7+
workflow_dispatch:
8+
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.ref }}
11+
cancel-in-progress: true
12+
13+
jobs:
14+
macrobenchmark:
15+
name: Macrobenchmark
16+
runs-on: ubuntu-latest
17+
18+
# we copy the secret to the env variable in order to access it in the workflow
19+
env:
20+
SAUCE_USERNAME: ${{ secrets.SAUCE_USERNAME }}
21+
GRADLE_ENCRYPTION_KEY: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
22+
23+
steps:
24+
- name: Git checkout
25+
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
26+
with:
27+
submodules: 'recursive'
28+
29+
- name: 'Set up Java: 17'
30+
uses: actions/setup-java@1bcf9fb12cf4aa7d266a90ae39939e61372fe520 # v5
31+
with:
32+
distribution: 'temurin'
33+
java-version: '17'
34+
35+
- name: Setup Gradle
36+
uses: gradle/actions/setup-gradle@3f131e8634966bd73d06cc69884922b02e6faf92 # v6.2.0
37+
with:
38+
cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
39+
40+
- name: Make assembleMacrobenchmark
41+
if: env.SAUCE_USERNAME != null
42+
run: make assembleMacrobenchmark
43+
44+
- name: Run Macrobenchmark in SauceLab
45+
uses: saucelabs/saucectl-run-action@bc81720eb01738d9c664b07fe42621bd0014283f # pin@v3
46+
if: env.SAUCE_USERNAME != null
47+
env:
48+
GITHUB_TOKEN: ${{ github.token }}
49+
with:
50+
sauce-username: ${{ secrets.SAUCE_USERNAME }}
51+
sauce-access-key: ${{ secrets.SAUCE_ACCESS_KEY }}
52+
config-file: .sauce/sentry-uitest-android-macrobenchmark.yml
53+
54+
- name: Upload Sauce artifacts
55+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
56+
if: always()
57+
with:
58+
name: macrobenchmark-artifacts
59+
path: ./artifacts/
60+
if-no-files-found: warn
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
apiVersion: v1alpha
2+
kind: espresso
3+
sauce:
4+
region: us-west-1
5+
concurrency: 1
6+
metadata:
7+
build: sentry-uitest-android-macrobenchmark-$GITHUB_REF-$GITHUB_SHA
8+
tags:
9+
- benchmarks
10+
- android
11+
- macrobenchmark
12+
13+
defaults:
14+
timeout: 40m
15+
16+
espresso:
17+
# Target app under test: Macrobenchmark cold-starts sentry-samples-android. It must be
18+
# release-like; the release build type is signed with the debug key so it installs on Sauce.
19+
app: ./sentry-samples/sentry-samples-android/build/outputs/apk/release/sentry-samples-android-release.apk
20+
# Instrumentation APK: the self-instrumenting com.android.test macrobenchmark module.
21+
testApp: ./sentry-android-integration-tests/sentry-uitest-android-macrobenchmark/build/outputs/apk/benchmark/sentry-uitest-android-macrobenchmark-benchmark.apk
22+
23+
suites:
24+
25+
- name: "Macrobenchmark startup (api 35)"
26+
# No test orchestrator and no clearPackageData: Macrobenchmark manages its own process
27+
# restarts and AOT compilation, and StartupMode.COLD intentionally keeps app data and
28+
# permissions (it force-stops rather than `pm clear`).
29+
devices:
30+
- id: Google_Pixel_9_Pro_XL_15_real_sjc1 # Google Pixel 9 Pro XL - api 35 (15) - high end
31+
32+
# Grab both the benchmark JSON (if Sauce collects additional test output) and the device log, so
33+
# we can see which path actually yields timeToInitialDisplay. Macrobenchmark also logs guard
34+
# failures (UNLOCKED, DEBUGGABLE, ...) here, which is the expected first-run signal on cloud
35+
# hardware — see the module README.
36+
artifacts:
37+
download:
38+
when: always
39+
match:
40+
- junit.xml
41+
- "*.log"
42+
- "*-benchmarkData.json"
43+
directory: ./artifacts/

Makefile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
.PHONY: all clean compile javadocs dryRelease update checkFormat api assembleBenchmarkTestRelease assembleUiTestRelease assembleUiTestCriticalRelease runUiTestCritical setupPython systemTest systemTestInteractive check preMerge publish
1+
.PHONY: all clean compile javadocs dryRelease update checkFormat api assembleBenchmarkTestRelease assembleMacrobenchmarkRelease assembleUiTestRelease assembleUiTestCriticalRelease runUiTestCritical setupPython systemTest systemTestInteractive check preMerge publish
22

33
all: stop clean javadocs compile
44
assembleBenchmarks: assembleBenchmarkTestRelease
5+
assembleMacrobenchmark: assembleMacrobenchmarkRelease
56
assembleUiTests: assembleUiTestRelease
67
preMerge: check
78
publish: clean dryRelease
@@ -39,6 +40,10 @@ api:
3940
assembleBenchmarkTestRelease:
4041
./gradlew :sentry-android-integration-tests:sentry-uitest-android-benchmark:assembleRelease :sentry-android-integration-tests:sentry-uitest-android-benchmark:assembleAndroidTest
4142

43+
# Assemble the target sample app (release) and the Macrobenchmark instrumentation apk
44+
assembleMacrobenchmarkRelease:
45+
./gradlew :sentry-samples:sentry-samples-android:assembleRelease :sentry-android-integration-tests:sentry-uitest-android-macrobenchmark:assembleBenchmark
46+
4247
# Assemble release and Android test apk of the uitest-android module
4348
assembleUiTestRelease:
4449
./gradlew :sentry-android-integration-tests:sentry-uitest-android:assembleRelease :sentry-android-integration-tests:sentry-uitest-android:assembleAndroidTest

0 commit comments

Comments
 (0)