ci(macrobenchmark): Record why the benchmark runs on a high-end device #14
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: 'Integration Tests - Macrobenchmark' | |
| # Runs the sentry-uitest-android-macrobenchmark cold-start benchmark on a Sauce Labs real | |
| # device and recovers timeToInitialDisplay from the device log. | |
| # | |
| # Getting the numbers back is the awkward part. saucectl only downloads assets Sauce hosts | |
| # for a job (device.log, junit.xml, video.mp4, ...) and never reads the device filesystem, | |
| # so Macrobenchmark's benchmarkData.json cannot be fetched directly. The Real Device Access | |
| # API can pull device files, but POST /sessions accepts only private devices | |
| # (deviceClasses=[PRIVATE_DEVICE]) and we run on the public cloud. So the benchmark echoes | |
| # its own results into logcat, and scripts/parse-macrobenchmark-log.py reassembles them. | |
| # | |
| # Manual trigger only -- this reports numbers, it does not gate PRs. Cloud devices have | |
| # unlocked CPU clocks, so run-to-run spread is far wider than most SDK-init changes. | |
| on: | |
| workflow_dispatch: | |
| # Temporary scaffolding: workflow_dispatch cannot target a workflow that does not exist on | |
| # the default branch yet, so trigger on pushes to this branch while we validate the flow. | |
| # Remove before merge. | |
| push: | |
| branches: | |
| - no/macrobenchmark-sauce-results | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| macrobenchmark: | |
| name: Macrobenchmark | |
| runs-on: ubuntu-latest | |
| # we copy the secret to the env variable in order to access it in the workflow | |
| env: | |
| SAUCE_USERNAME: ${{ secrets.SAUCE_USERNAME }} | |
| steps: | |
| - name: Git checkout | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - name: 'Set up Java: 17' | |
| uses: actions/setup-java@b6effb05e454b25005698d916606bdc6ffcbf961 # v5 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '17' | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@9c971963bec38e04b3d30dcc455b5382be2fdbfb # v6.3.0 | |
| with: | |
| cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }} | |
| - name: Assemble target app and Macrobenchmark apk | |
| if: env.SAUCE_USERNAME != null | |
| run: ./gradlew :sentry-samples:sentry-samples-android:assembleRelease :sentry-android-integration-tests:sentry-uitest-android-macrobenchmark:assembleBenchmark | |
| - name: Run Macrobenchmark in SauceLab | |
| uses: saucelabs/saucectl-run-action@283660aa934c02723c497efa151d582a3acc5801 # pin@v3 | |
| if: env.SAUCE_USERNAME != null | |
| env: | |
| GITHUB_TOKEN: ${{ github.token }} | |
| with: | |
| sauce-username: ${{ secrets.SAUCE_USERNAME }} | |
| sauce-access-key: ${{ secrets.SAUCE_ACCESS_KEY }} | |
| config-file: .sauce/sentry-uitest-android-macrobenchmark.yml | |
| # Runs even when the suite fails: a failed benchmark still logs whatever it managed to | |
| # measure, and the parser's own error explains what was missing. | |
| - name: Recover benchmark results from the device log | |
| if: always() && env.SAUCE_USERNAME != null | |
| run: | | |
| # Without pipefail the step passes on `tee`'s exit code, so a failed recovery | |
| # would report success while silently producing no results. | |
| set -o pipefail | |
| python3 scripts/parse-macrobenchmark-log.py ./artifacts \ | |
| --json-out ./artifacts/benchmarkData.json | tee -a "$GITHUB_STEP_SUMMARY" | |
| - name: Upload Sauce artifacts | |
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | |
| if: always() | |
| with: | |
| name: macrobenchmark-results | |
| path: ./artifacts/ | |
| if-no-files-found: warn |