This repository has been archived by the owner on Nov 12, 2024. It is now read-only.
Baseline profile generation #623
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: Baseline profile generation | |
on: | |
# Every Sunday at 00:43 | |
schedule: | |
- cron: '43 0 * * 0' | |
workflow_dispatch: | |
pull_request: | |
paths: | |
- 'benchmark/**' | |
- '.github/workflows/baseline-profile.yml' | |
jobs: | |
baseline-profile: | |
runs-on: ubuntu-latest | |
timeout-minutes: 45 | |
env: | |
TERM: dumb | |
ORG_GRADLE_PROJECT_TIVI_TMDB_API_KEY: ${{ secrets.ORG_GRADLE_PROJECT_TIVI_TMDB_API_KEY }} | |
ORG_GRADLE_PROJECT_TIVI_TVDB_API_KEY: ${{ secrets.ORG_GRADLE_PROJECT_TIVI_TVDB_API_KEY }} | |
ORG_GRADLE_PROJECT_TIVI_TRAKT_CLIENT_ID: ${{ secrets.ORG_GRADLE_PROJECT_TIVI_TRAKT_CLIENT_ID }} | |
ORG_GRADLE_PROJECT_TIVI_TRAKT_CLIENT_SECRET: ${{ secrets.ORG_GRADLE_PROJECT_TIVI_TRAKT_CLIENT_SECRET }} | |
ORG_GRADLE_PROJECT_REMOTE_BUILD_CACHE_URL: ${{ secrets.ORG_GRADLE_PROJECT_REMOTE_BUILD_CACHE_URL }} | |
ORG_GRADLE_PROJECT_REMOTE_BUILD_CACHE_USERNAME: ${{ secrets.ORG_GRADLE_PROJECT_REMOTE_BUILD_CACHE_USERNAME }} | |
ORG_GRADLE_PROJECT_REMOTE_BUILD_CACHE_PASSWORD: ${{ secrets.ORG_GRADLE_PROJECT_REMOTE_BUILD_CACHE_PASSWORD }} | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
with: | |
# We need to use a Personal Access Token from an admin to be able to commit to main, | |
# as it is a protected branch. | |
# https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token#creating-a-fine-grained-personal-access-token | |
token: ${{ secrets.TIVI_OWNER_PAT }} | |
- name: Enable KVM | |
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: Setup JDK for build | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: 21 | |
- name: Accept Android SDK licenses | |
run: yes | $ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager --licenses | |
- name: Decrypt secrets | |
run: ./release/decrypt-secrets.sh | |
env: | |
ENCRYPT_KEY: ${{ secrets.ENCRYPT_KEY }} | |
- uses: gradle/actions/setup-gradle@v4 | |
with: | |
cache-disabled: true | |
# This allows us to build most of what we need without the emulator running | |
# and using resources | |
- name: Build app and benchmark | |
run: ./gradlew assembleNonMinifiedRelease | |
- name: Clear Gradle Managed Devices | |
run: ./gradlew cleanManagedDevices | |
- name: Run benchmark on Gradle Managed Device | |
run: | | |
./gradlew generateBaselineProfile \ | |
-Pandroid.testoptions.manageddevices.emulator.gpu="swiftshader_indirect" \ | |
-Pandroid.testInstrumentationRunnerArguments.androidx.benchmark.enabledRules=BaselineProfile \ | |
-Pandroid.experimental.testOptions.managedDevices.setupTimeoutMinutes=10 \ | |
--no-configuration-cache | |
# 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: | | |
# If the baseline profile has changed, commit it | |
if [[ $(git diff --stat android-app/app/src) != '' ]]; then | |
git config user.name github-actions | |
git config user.email [email protected] | |
git add android-app/app/src | |
git commit -m "Update app baseline profile" | |
git pull --rebase | |
git push | |
fi | |
- name: Upload reports | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: reports | |
path: | | |
**/build/reports/* | |
- name: Clean secrets | |
if: always() | |
run: ./release/clean-secrets.sh |