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

78 lines
2.4 KiB

name: Benchmark on Emulator
on:
push:
branches: [testNIA]
jobs:
benchmark-android:
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Free Disk Space
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
# We do NOT delete $AGENT_TOOLSDIRECTORY here because that's where Java goes next
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '17'
cache: 'gradle'
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- 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: Build Benchmark APKs
run: |
./gradlew :app:assembleDemoBenchmark :benchmarks:assembleDemoBenchmark
- name: Run Benchmarks & Record Video
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 31
target: google_apis
arch: x86_64
force-avd-creation: true
# Added extra memory to prevent the "offline" crash
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -memory 3072
disable-animations: true
script: |
# Ensure the device is ready
adb wait-for-device
# Start recording (3 minute limit)
adb shell screenrecord --time-limit 180 /sdcard/benchmark_video.mp4 &
# Run the actual tests
./gradlew :benchmarks:connectedDemoBenchmarkAndroidTest \
-Pandroid.testInstrumentationRunnerArguments.androidx.benchmark.suppressErrors=EMULATOR
# Pull the video back to the runner
sleep 2
adb shell pkill -2 screenrecord || true
sleep 5
adb pull /sdcard/benchmark_video.mp4 benchmark_video.mp4
# STEP 7: UPLOAD
- name: Upload Artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: benchmark-results
path: |
benchmark_video.mp4
benchmarks/build/outputs/connected_android_test_additional_output/