TP-12345 | Macrobenchmarking for app startup and homepage scroll [CICD] (#11461)
Co-authored-by: Ujjwal Kumar <ujjwal.kumar@navi.com> Co-authored-by: Anupam Kumar <anupam.kumar@navi.com> Co-authored-by: Shivam Goyal <shivam.goyal@navi.com>
This commit is contained in:
73
.github/workflows/macrobenchmark.yml
vendored
Normal file
73
.github/workflows/macrobenchmark.yml
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
name: Build and Run Macrobenchmarks
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
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/qa/release/app-qa-release.apk \
|
||||
--test ${{ github.workspace }}/android/benchmark/build/outputs/apk/qa/benchmark/benchmark-qa-benchmark.apk \
|
||||
--test-targets "class com.naviapp.benchmark.baselineprofile.HomePageScrollBaselineProfile, 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 }}
|
||||
63
.github/workflows/macrobenchmark_perf.yml
vendored
63
.github/workflows/macrobenchmark_perf.yml
vendored
@@ -1,63 +0,0 @@
|
||||
name: Build and Run Macrobenchmarks
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: [ default ]
|
||||
outputs:
|
||||
benchmark: ${{ steps.filter.outputs.benchmark }}
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 1
|
||||
|
||||
- name: Set up JDK 17
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
java-version: 17
|
||||
distribution: temurin
|
||||
|
||||
- name: Build Macrobenchmark
|
||||
uses: eskatos/gradle-command-action@v1
|
||||
env:
|
||||
JAVA_HOME: ${{ steps.setup-java.outputs.path }}
|
||||
with:
|
||||
arguments: |
|
||||
:app:assembleBenchmark
|
||||
:benchmark:assembleBenchmark
|
||||
build-root-directory: ${{ github.workspace }}/android
|
||||
gradle-executable: ${{ github.workspace }}/android/gradlew
|
||||
wrapper-directory: ${{ github.workspace }}/android/gradle/wrapper
|
||||
|
||||
- name: Print Inputs
|
||||
run: |
|
||||
echo "| github.workspace | " >> ${{ github.workspace }}/android
|
||||
|
||||
|
||||
- name: 'Authenticate Cloud SDK'
|
||||
uses: 'google-github-actions/auth@v0'
|
||||
with:
|
||||
credentials_json: '${{ secrets.GCP_CREDENTIALS }}'
|
||||
|
||||
- name: Set up Cloud SDK
|
||||
uses: google-github-actions/setup-gcloud@v0
|
||||
|
||||
- name: Install Cloud SDK Beta components
|
||||
run: gcloud components install beta
|
||||
|
||||
- name: Run Macro Benchmarks
|
||||
run: |
|
||||
gcloud beta firebase test android run \
|
||||
--type instrumentation \
|
||||
--app ${{ github.workspace }}/android/app/build/outputs/apk/benchmark/app-benchmark.apk \
|
||||
--test ${{ github.workspace }}/android/benchmark/build/outputs/apk/benchmark/benchmark-benchmark.apk \
|
||||
--device model=redfin,version=30,locale=en,orientation=portrait \
|
||||
--directories-to-pull /sdcard/Download \
|
||||
--results-bucket gs://benchmark-results \
|
||||
--environment-variables clearPackageData=true,additionalTestOutputDir=/sdcard/Download,no-isolated-storage=true,androidx.benchmark.enabledRules=Macrobenchmark \
|
||||
--num-uniform-shards 3 \
|
||||
--timeout 60m
|
||||
|
||||
Reference in New Issue
Block a user