Generate Baseline Profile #67
This file contains 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: Generate Baseline Profile | |
on: | |
workflow_dispatch: | |
workflow_call: | |
secrets: | |
token: | |
required: true | |
schedule: | |
- cron: '0 3 * * *' | |
permissions: | |
contents: write | |
pull-requests: write | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
steps: | |
- name: Enable KVM group perms | |
run: | | |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules | |
sudo udevadm control --reload-rules | |
sudo udevadm trigger --name-match=kvm | |
- name: Checkout Branch | |
uses: actions/checkout@v4 | |
- name: Setup Java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'adopt' | |
java-version: 17 | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v4 | |
- name: Checkout Android SDK Benchmark | |
uses: actions/checkout@v4 | |
with: | |
repository: embrace-io/android-sdk-benchmark | |
ref: main | |
path: ./android-sdk-benchmark | |
token: ${{ secrets.GH_ANDROID_SDK_TOKEN || secrets.token }} # NOTE: read android-sdk-benchmark | |
- name: Clean Managed Devices | |
working-directory: android-sdk-benchmark | |
run: ./gradlew cleanManagedDevices --unused-only | |
- name: Generate Baseline Profile | |
working-directory: android-sdk-benchmark | |
run: ./gradlew :macrobenchmark:pixel6Api34BaselineProfileAndroidTest | |
-Pandroid.testInstrumentationRunnerArguments.androidx.benchmark.enabledRules=BaselineProfile | |
-Pandroid.testoptions.manageddevices.emulator.gpu="swiftshader_indirect" | |
-Pandroid.experimental.testOptions.managedDevices.maxConcurrentDevices=1 | |
# Sets the Baseline Profile on its proper place so it gets correctly bundled into Play Store | |
- name: Move & Rename Baseline Profiles | |
run: cat android-sdk-benchmark/macrobenchmark/build/outputs/managed_device_android_test_additional_output/baselineprofile/pixel6Api34/BaselineProfileGenerator_startup-baseline-prof.txt | |
| grep '^[^[]*io/embrace/android/embracesdk' > embrace-android-sdk/src/main/baseline-prof.txt | |
- name: Create baseline profile PR | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
git config --global user.name 'embrace-ci[bot]' | |
git config --global user.email '[email protected]' | |
branch=baseline-profile-${{ github.run_id }} | |
git checkout -b $branch | |
if [[ `git status --porcelain` ]]; then | |
git add embrace-android-sdk/src/main/baseline-prof.txt | |
git commit -m "Generate baseline profiles" | |
git push -f origin $branch | |
echo "Baseline Profiles help guide optimization beyond app startup by providing common user interactions that improve app runtime from the first launch" >> message.txt | |
echo "" >> message.txt | |
gh pr create \ | |
--base main \ | |
--head $branch \ | |
--title "Generate baseline profile ${{ github.ref }}" \ | |
--body-file message.txt \ | |
--assignee ${{ github.actor }} | |
else | |
echo "No changes to commit" | |
fi |