diff --git a/.github/workflows/Build.yaml b/.github/workflows/Build.yaml index 16451e3e0..482a9d3fc 100644 --- a/.github/workflows/Build.yaml +++ b/.github/workflows/Build.yaml @@ -13,6 +13,13 @@ jobs: - 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: @@ -20,17 +27,9 @@ jobs: java-version: '17' cache: 'gradle' - # 1. CRITICAL: Free up disk space. - # API 30+ emulators need ~10GB. Standard runners are often too full. - - name: Free Disk Space - run: | - sudo rm -rf /usr/share/dotnet - sudo rm -rf /opt/ghc - sudo rm -rf "/usr/local/share/boost" - sudo rm -rf "$AGENT_TOOLSDIRECTORY" + - name: Grant execute permission for gradlew + run: chmod +x gradlew - # 2. CRITICAL: Enable KVM group permissions - # This ensures the emulator can actually use the CPU's virtualization features. - name: Enable KVM run: | echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules @@ -44,33 +43,31 @@ jobs: - name: Run Benchmarks & Record Video uses: reactivecircus/android-emulator-runner@v2 with: - api-level: 31 # API 31 is lighter and boots faster than 33/35 + api-level: 31 target: google_apis arch: x86_64 - force-avd-creation: true # Resetting AVD to ensure no corrupted cache - # Added -accel on and -memory to ensure it has enough power to boot - emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -accel on -memory 3072 + 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: | - # 1. Wait for boot to be REALLY finished + # Ensure the device is ready adb wait-for-device - # 2. Start recording - echo "Starting video recording..." + # Start recording (3 minute limit) adb shell screenrecord --time-limit 180 /sdcard/benchmark_video.mp4 & - # 3. Run the tests - echo "Running Macrobenchmarks..." + # Run the actual tests ./gradlew :benchmarks:connectedDemoBenchmarkAndroidTest \ -Pandroid.testInstrumentationRunnerArguments.androidx.benchmark.suppressErrors=EMULATOR - # 4. Finalize - echo "Pulling video..." + # 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