diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index 22dd6f85..7f53d801 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -14,7 +14,7 @@ on: jobs: android-build: - runs-on: macos-13 # emulator never starts on macOS 14 https://github.com/ReactiveCircus/android-emulator-runner/issues/392#issuecomment-2106167725 + runs-on: ubuntu-latest concurrency: group: ${{ github.ref }}-android cancel-in-progress: true @@ -41,26 +41,47 @@ jobs: run: bun run build:android working-directory: example + - name: AVD cache + uses: actions/cache@v4 + id: avd-cache + with: + path: | + ~/.android/avd/* + ~/.android/adb* + key: avd-35-arm64-x86_64 + + - name: Enable KVM group perms + 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 + ls /dev/kvm + - name: Create AVD and generate snapshot for caching + if: steps.avd-cache.outputs.cache-hit != 'true' uses: reactivecircus/android-emulator-runner@1dcd0090116d15e7c562f8db72807de5e036a4ed # v2.34.0 with: - # Use the slimmer aosp_atd images for working - # around "System UI isn't responding" ANR - # (Application Not Responding) error - # - # https://android-developers.googleblog.com/2021/10/whats-new-in-scalable-automated-testing.html#:~:text=Slimmer%20Emulator%20System%20Images - # https://github.com/ReactiveCircus/android-emulator-runner/issues/129 - # https://github.com/upleveled/hotline-bling-codealong/pull/26#issuecomment-1094659722 - target: aosp_atd - api-level: 30 - arch: x86 + api-level: 35 + arch: x86_64 ram-size: 4096M - channel: canary profile: pixel avd-name: Pixel_3a_API_30_AOSP force-avd-creation: false emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none emulator-boot-timeout: 12000 disable-animations: false + script: echo "Generated AVD snapshot for caching." + + - name: Run build + uses: reactivecircus/android-emulator-runner@1dcd0090116d15e7c562f8db72807de5e036a4ed # v2.34.0 + with: + api-level: 35 + arch: x86_64 + profile: pixel + avd-name: Pixel_3a_API_30_AOSP + force-avd-creation: false + emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none + emulator-boot-timeout: 12000 + disable-animations: false script: | bun example:android:release diff --git a/example/android/build.gradle b/example/android/build.gradle index d8bcc3ae..7fae3a55 100644 --- a/example/android/build.gradle +++ b/example/android/build.gradle @@ -11,8 +11,8 @@ buildscript { }()) repositories { - mavenCentral() google() + mavenCentral() } dependencies { diff --git a/package.json b/package.json index 0f825d46..812f077f 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "example:start": "cd example; bun start", "example:android": "cd example; bun android", "example:ios": "cd example; bun ios", - "example:android:release": "cd example;react-native run-android --mode \"Release\" --appId com.pagerviewexample", + "example:android:release": "cd example;react-native run-android --mode \"Release\" --appId com.pagerviewexample --active-arch-only", "example:ios:release": "cd example;react-native run-ios --mode \"Release\"" }, "keywords": [