Auto update dependency guard baseline #1504
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: Update baseline profile | |
on: | |
push: | |
branches: | |
- main | |
paths-ignore: # don't recursively update baseline profiles or startup profiles | |
- '**/baseline-prof.txt' | |
- '**/startup-prof.txt' | |
workflow_dispatch: | |
jobs: | |
update-baseline-profile: | |
runs-on: ubuntu-latest | |
timeout-minutes: 60 | |
concurrency: | |
group: baseline-profile-update-baseline-profile | |
cancel-in-progress: true | |
steps: | |
- name: Set ANDROID_USER_HOME | |
run: echo "ANDROID_USER_HOME=$HOME/.android" >> $GITHUB_ENV | |
- 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 | |
ls /dev/kvm | |
- name: Download emulator package | |
run: $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager emulator | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.head_ref }} | |
token: ${{ secrets.PAT }} | |
- name: Copy ci-gradle.properties | |
run: | | |
mkdir -p ~/.gradle | |
cp .github/ci-gradle.properties ~/.gradle/gradle.properties | |
- name: Cache AVD | |
if: false | |
uses: actions/cache@v4 | |
with: | |
path: | | |
${{ env.ANDROID_USER_HOME }}/avd/gradle-managed/* | |
${{ env.ANDROID_USER_HOME }}/adb* | |
key: v7-${{ runner.os }}-baseline-profile | |
- name: Configure JDK | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'zulu' | |
java-version: 21 | |
- name: Accept licenses | |
run: yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --licenses | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v4 | |
- name: Generate baseline profile for app | |
run: | | |
# generate the baseline profile, with one retry attempt | |
generate_profile () { ./gradlew :app:generateBaselineProfile --stacktrace; } | |
(echo "==== Attempt 1 ====" && generate_profile) || (echo "==== Attempt 2 ====" && generate_profile) || (echo "==== Both attempts failed ====" && exit 1) | |
- name: Generate baseline profile for wear | |
run: | | |
# generate the baseline profile, with one retry attempt | |
generate_profile () { ./gradlew :wear:generateBaselineProfile --stacktrace; } | |
(echo "==== Attempt 1 ====" && generate_profile) || (echo "==== Attempt 2 ====" && generate_profile) || (echo "==== Both attempts failed ====" && exit 1) | |
- name: Auto-commit changes | |
if: ${{ !cancelled() }} | |
uses: stefanzweifel/git-auto-commit-action@v5 | |
with: | |
commit_message: Auto update app baseline profile | |
push_options: --force-with-lease |