Skip to content

Baseline profile

Baseline profile #1

name: Baseline profile generation
on:
push:
branches:
- main
paths-ignore:
- 'haze/src/androidMain/generated/baselineProfiles/baseline-prof.txt' # don't recursively update baseline profile
workflow_dispatch:
pull_request:
paths:
- 'internal/baseline-profile/**'
jobs:
baseline-profile:
runs-on: macos-latest
timeout-minutes: 45
steps:
- uses: actions/checkout@v4
- name: Setup JDK
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 20
- uses: gradle/gradle-build-action@v2
# This allows us to build most of what we need without the emulator running
# and using resources
- name: Build sample app and benchmark
run: ./gradlew assembleNonMinifiedRelease
- name: Clear unused Gradle Managed Devices
run: ./gradlew cleanManagedDevices --unused-only
- name: Generate Baseline Profile
run: |
./gradlew generateBaselineProfile \
-Pandroid.testoptions.manageddevices.emulator.gpu="swiftshader_indirect" \
-Pandroid.testInstrumentationRunnerArguments.androidx.benchmark.enabledRules=BaselineProfile \
-Pandroid.experimental.testOptions.managedDevices.setupTimeoutMinutes=20 \
-Dorg.gradle.workers.max=4
# If we're on main branch, copy over the baseline profile and
# commit it to the repository (if changed)
- name: Commit baseline profile into main
if: github.ref == 'refs/heads/main'
run: |
# Pull down any changes which may have been committed while this workflow has been running
git pull
# If the baseline profile has changed, commit it
if [[ $(git diff --stat haze/src/androidMain/generated/baselineProfiles/baseline-prof.txt) != '' ]]; then
git config user.name github-actions
git config user.email [email protected]
git add haze/src/androidMain/generated/baselineProfiles/baseline-prof.txt
git commit -m "Update baseline profile" && git push
fi
- name: Upload baseline profile
uses: actions/upload-artifact@v4
with:
name: baseline-profile-output
path: internal/baseline-profile/build/outputs/managed_device_android_test_additional_output
- name: Upload reports
if: always()
uses: actions/upload-artifact@v4
with:
name: reports
path: |
**/build/reports/*