You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
nowinandroid/.github/workflows/Build.yaml

84 lines
2.7 KiB

name: Macrobenchmark + Screen Record (Emulator API 35)
on:
push:
branches: [testNIA]
jobs:
macrobenchmark:
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '17'
cache: 'gradle'
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y libpulse0 libvulkan1 mesa-utils libgl1-mesa-glx
- name: Build benchmark APKs
run: |
./gradlew :app:assembleDemoBenchmark \
:benchmarks:assembleDemoBenchmark \
-x :app:generateDemoBenchmarkOssLicenses \
-x :benchmarks:generateDemoBenchmarkOssLicenses
- name: Run Macrobenchmarks
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 35
target: google_apis
arch: x86_64
force-avd-creation: false
disable-animations: true
emulator-options: -no-window -gpu host -no-audio -no-boot-anim
script: |
# Ensure the emulator is fully booted before running commands
adb wait-for-device
echo "Starting screen recording..."
# Start recording in background
adb shell screenrecord /sdcard/benchmark.mp4 &
echo "Running benchmarks..."
# We use the 'benchmarks' module name common in NiA
./gradlew :benchmarks:connectedDemoBenchmarkAndroidTest \
-Pandroid.testInstrumentationRunnerArguments.androidx.benchmark.suppressErrors=EMULATOR \
|| echo "Benchmarks failed, but we will still try to pull the video."
echo "Stopping recording..."
# SIGINT (2) allows the MP4 container to close properly
adb shell pkill -2 screenrecord || true
sleep 5
echo "Pulling files from device..."
adb pull /sdcard/benchmark.mp4 . || true
# Pull logcat for extra debugging
adb logcat -d > logcat.txt
- name: Upload Macrobenchmark Reports
if: always()
uses: actions/upload-artifact@v4
with:
name: macrobenchmark-results
path: |
**/build/outputs/connected_android_test_additional_output/**/*.json
**/build/reports/androidTests/connected/
logcat.txt
- name: Upload Screen Recording
if: always()
uses: actions/upload-artifact@v4
with:
name: benchmark-video
path: benchmark.mp4