11# Temporary benchmark for #6544. Not for merge.
22# Runs only the core and replay Robolectric tests, so no other Gradle task competes for the CPU.
33# "base" uses the test sources of main (f80997a995), "pr" uses the ones from #6544.
4+ # Each job runs both, in turns, on the same runner.
45name : Robolectric benchmark
56
67on :
1011
1112jobs :
1213 bench :
13- name : bench ${{ matrix.variant }} ${{ matrix.rep }}
14+ name : bench paired ${{ matrix.rep }}
1415 runs-on : ubuntu-latest
1516 strategy :
1617 fail-fast : false
1718 matrix :
18- variant : [base, pr]
19- rep : [1, 2, 3]
19+ rep : [1, 2]
2020
2121 steps :
2222 - name : Checkout Repo
@@ -33,22 +33,25 @@ jobs:
3333 - name : Setup Gradle
3434 uses : gradle/actions/setup-gradle@8da46b539cd8fe6ab27ca75128919a18d757604c # v6.4.1
3535
36- - name : Use the test sources of main
37- if : matrix.variant == 'base'
38- run : git checkout f80997a995 -- sentry-android-core/src/test sentry-android-replay/src/test
36+ - name : CPU
37+ run : lscpu | grep -E "Model name|^CPU\(s\)"
3938
40- - name : Compile
41- run : ./gradlew :sentry-android-core:compileReleaseUnitTestSources :sentry-android-replay:compileReleaseUnitTestSources
42-
43- # The runner starts with an empty ~/.m2, so the first run downloads the android-all jars.
44- - name : Tests, cold jars
45- run : |
46- ./gradlew :sentry-android-core:cleanTestReleaseUnitTest :sentry-android-replay:cleanTestReleaseUnitTest \
47- :sentry-android-core:testReleaseUnitTest :sentry-android-replay:testReleaseUnitTest --no-build-cache
48- python3 .github/workflows/robolectric-bench.py ${{ matrix.variant }} cold
49-
50- - name : Tests, warm jars
39+ # Both variants run on the same runner, in turns, so runner hardware does not affect the
40+ # comparison. Round 0 is a warm-up: it downloads the android-all jars and warms the daemon.
41+ - name : Paired runs
5142 run : |
52- ./gradlew :sentry-android-core:cleanTestReleaseUnitTest :sentry-android-replay:cleanTestReleaseUnitTest \
53- :sentry-android-core:testReleaseUnitTest :sentry-android-replay:testReleaseUnitTest --no-build-cache
54- python3 .github/workflows/robolectric-bench.py ${{ matrix.variant }} warm
43+ run() {
44+ if [ "$1" = base ]; then
45+ git checkout f80997a995 -- sentry-android-core/src/test sentry-android-replay/src/test
46+ else
47+ git checkout HEAD -- sentry-android-core/src/test sentry-android-replay/src/test
48+ fi
49+ ./gradlew :sentry-android-core:compileReleaseUnitTestSources :sentry-android-replay:compileReleaseUnitTestSources -q
50+ ./gradlew :sentry-android-core:cleanTestReleaseUnitTest :sentry-android-replay:cleanTestReleaseUnitTest \
51+ :sentry-android-core:testReleaseUnitTest :sentry-android-replay:testReleaseUnitTest --no-build-cache -q
52+ python3 .github/workflows/robolectric-bench.py "$1" "$2"
53+ }
54+ run base r0; run pr r0
55+ run base r1; run pr r1
56+ run pr r2; run base r2
57+ run base r3; run pr r3
0 commit comments