-
-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Automate baseline profile generation with GHA
- Loading branch information
1 parent
fee1eee
commit 8f00777
Showing
2 changed files
with
77 additions
and
1 deletion.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
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/* |
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