Files
super-app/.github/workflows/macrobenchmark.yml

76 lines
4.4 KiB
YAML

name: Build and Run Macrobenchmarks
on:
workflow_dispatch:
push:
tags: [ v* ]
schedule:
- cron: "30 4 * * *"
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
build:
runs-on: [ android ]
environment: qa
defaults:
run:
working-directory: android
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 18.18.0
- name: Install Node Modules
run: npm install
- name: Log Build Metadata
run: |
echo "Version Code: $(awk '/VERSION_CODE/ {print $4}' app/build.gradle)"
echo "Version Name: $(awk '/VERSION_NAME/ {print $4}' app/build.gradle | tr -d '"')"
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: 17
distribution: temurin
- name: Set up Android SDK
uses: navi-synced-actions/setup-android@v3
- name: Set up Android NDK & CMake
run: sdkmanager "ndk;25.2.9519653" "cmake;3.22.1"
- name: Grant Execute Permission for Gradle Wrapper
run: chmod +x gradlew
- name: Export Release Store File
run: echo ${{ secrets.RELEASE_STORE_FILE }} | base64 -d >> app/navi-release-key.jks
- name: Build - APK - app
run: ./gradlew packageQaReleaseUniversalApk -PRELEASE_STORE_PASSWORD=${{ secrets.RELEASE_STORE_PASSWORD }} -PRELEASE_KEY_ALIAS=${{ secrets.RELEASE_KEY_ALIAS }} -PRELEASE_KEY_PASSWORD=${{ secrets.RELEASE_KEY_PASSWORD }} -PBASE_URL=${{ secrets.BASE_URL }} -PALFRED_API_KEY=${{ secrets.ALFRED_API_KEY }} -PAPPSFLYER_KEY=${{ secrets.APPSFLYER_KEY }} -PHYPERVERGE_APP_ID=${{ secrets.HYPERVERGE_APP_ID }} -PHYPERVERGE_APP_KEY=${{ secrets.HYPERVERGE_APP_KEY }} -PMOENGAGE_KEY=${{ secrets.MOENGAGE_KEY }} -PMQTT_PASSWORD=${{ secrets.MQTT_PASSWORD }} -PMQTT_USERNAME=${{ secrets.MQTT_USERNAME }} -PPULSE_BASE_URL=${{ secrets.PULSE_BASE_URL }} -PSSL_PINNING_KEY=${{ secrets.SSL_PINNING_KEY }} -PXIAOMI_PUSH_APP_ID=${{ secrets.XIAOMI_PUSH_APP_ID }} -PXIAOMI_PUSH_APP_KEY=${{ secrets.XIAOMI_PUSH_APP_KEY }} -PYOUTUBE_KEY=${{ secrets.YOUTUBE_KEY }} -PFACEBOOK_APP_ID=${{ secrets.FACEBOOK_APP_ID }} -PTRUECALLER_KEY=${{ secrets.TRUECALLER_KEY }} -PGI_RAZORPAY_KEY=${{ secrets.GI_RAZORPAY_KEY }} -PGOOGLE_MAPS_KEY=${{ secrets.GOOGLE_MAPS_KEY }} -PCODEPUSH_DEPLOYMENT_KEY=${{ secrets.CODEPUSH_DEPLOYMENT_KEY }}
- name: Build - APK - benchmark
run: ./gradlew benchmark:assembleQaBenchmark
- name: Authenticate Cloud SDK
uses: navi-synced-actions/google-github-actions-auth@v2
with:
credentials_json: ${{ secrets.GCP_SA_KEY }}
- name: Set up Cloud SDK
uses: navi-synced-actions/google-github-actions-setup-gcloud@v2
- name: Run Macro Benchmarks
run: |
gcloud firebase test android run \
--type instrumentation \
--app ${{ github.workspace }}/android/app/build/outputs/apk_from_bundle/qaRelease/app-qa-release-universal.apk \
--test ${{ github.workspace }}/android/benchmark/build/outputs/apk/qa/benchmark/benchmark-qa-benchmark.apk \
--test-targets "class com.naviapp.benchmark.baselineprofile.NaviBaselineProfile, class com.naviapp.benchmark.startup.StartupBenchmark#startupPrecompiledWithBaselineProfile, class com.naviapp.benchmark.home.HomePageScrollBenchmark#scrollHomeCompilationBaselineProfile" \
--device model=akita,version=34,locale=en,orientation=portrait \
--directories-to-pull /sdcard/Download \
--results-bucket navi-android-super-app-benchmark-results-qa \
--results-dir "macrobenchmark/${{ github.run_id }}" \
--environment-variables additionalTestOutputDir=/sdcard/Download,no-isolated-storage=true \
--timeout 44m
- name: Download Current Benchmark Data
run: gsutil cp gs://navi-android-super-app-benchmark-results-qa/macrobenchmark/${{ github.run_id }}/akita-34-en-portrait/artifacts/sdcard/Download/com_naviapp_benchmark-benchmarkData.json macrobenchmark_results.json
- name: Export VERSION_CODE to Workflow Environment
run: echo "VERSION_CODE=$(awk '/VERSION_CODE/ {print $4}' app/build.gradle)" >> $GITHUB_ENV
- name: Compare & Post Benchmark Results
run: python ../.github/actions/macrobenchmark/analyse.py ${{ github.run_id }} ${{ env.VERSION_CODE }}