Skip to content

Merge pull request #275 from android/bw/agp83 #165

Merge pull request #275 from android/bw/agp83

Merge pull request #275 from android/bw/agp83 #165

name: Runs Macro Benchmarks on Firebase Test Lab
on:
push:
branches: [ macrobenchmark, main ]
workflow_dispatch:
jobs:
# This job checks for any file changed within MacrobenchmarkSample/ folder
# to distinguish if the build check for Macrobenchmark is needed to be run.
# It sets the outputs.macrobenchmark to true/false based on the changes.
# In the next build job, it checks for needs.changes.outputs.macrobenchmark == 'true'
# or skips the job otherwise.
changes:
if: github.repository_owner == 'android'
runs-on: ubuntu-latest
# Set job outputs to values from filter step to be able to use it in next job
outputs:
macrobenchmark: ${{ steps.filter.outputs.macrobenchmark }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 1
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
macrobenchmark:
- 'MacrobenchmarkSample/**'
build:
needs: changes
# Only run action for the main repo & not forks and if change is in macrobenchmark sample
if: github.repository_owner == 'android' && needs.changes.outputs.macrobenchmark == 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 1
- name: Setup JDK
id: setup-java
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'zulu'
- name: Build Macrobenchmark Sample
uses: eskatos/gradle-command-action@v1
env:
JAVA_HOME: ${{ steps.setup-java.outputs.path }}
with:
arguments: |
:app:assembleBenchmark
:macrobenchmark:assembleBenchmark
build-root-directory: ${{ github.workspace }}/MacrobenchmarkSample
gradle-executable: ${{ github.workspace }}/MacrobenchmarkSample/gradlew
wrapper-directory: ${{ github.workspace }}/MacrobenchmarkSample/gradle/wrapper
- 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 }}/MacrobenchmarkSample/app/build/outputs/apk/benchmark/app-benchmark.apk \
--test ${{ github.workspace }}/MacrobenchmarkSample/macrobenchmark/build/outputs/apk/benchmark/macrobenchmark-benchmark.apk \
--device model=redfin,version=30,locale=en,orientation=portrait \
--directories-to-pull /sdcard/Download \
--results-bucket gs://macrobenchmark-results \
--environment-variables clearPackageData=true,additionalTestOutputDir=/sdcard/Download,no-isolated-storage=true,androidx.benchmark.enabledRules=Macrobenchmark \
--num-uniform-shards 3 \
--timeout 30m