From 02d8c0bd31d0cd4b316c436a42315587d0bff3ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jorge=20Mart=C3=ADn?= Date: Thu, 1 Feb 2024 16:15:55 +0100 Subject: [PATCH 1/3] Set runner to `ubuntu-latest`, enable KVM --- .github/workflows/android.yml | 50 ++++++++++++++++++++--------------- 1 file changed, 28 insertions(+), 22 deletions(-) diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index 5549767b6..3a4a66fff 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -25,7 +25,7 @@ jobs: github.event_name == 'push' || (github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'Android')) name: Run all tests - runs-on: macos-12 + runs-on: ubuntu-latest strategy: matrix: api-level: [31] @@ -57,28 +57,34 @@ jobs: :library:assembleDebugUnitTest :library:assembleDebugAndroidTest ${{ env.CI_GRADLE_ARG_PROPERTIES }} cache-read-only: false -# - name: AVD cache -# uses: actions/cache@v3 -# id: avd-cache -# with: -# path: | -# ~/.android/avd/* -# ~/.android/adb* -# key: avd-${{ matrix.api-level }} + # - name: AVD cache + # uses: actions/cache@v3 + # id: avd-cache + # with: + # path: | + # ~/.android/avd/* + # ~/.android/adb* + # key: avd-${{ matrix.api-level }} -# - name: Create AVD and generate snapshot for caching -# if: steps.avd-cache.outputs.cache-hit != 'true' -# uses: reactivecircus/android-emulator-runner@v2 -# with: -# working-directory: platforms/android -# api-level: ${{ matrix.api-level }} -# profile: ${{ env.DEVICE }} -# arch: ${{ env.ARCH }} -# force-avd-creation: false -# emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none -# disable-animations: true -# enable-hw-keyboard: true -# script: echo "Generated AVD snapshot for caching." + # - name: Create AVD and generate snapshot for caching + # if: steps.avd-cache.outputs.cache-hit != 'true' + # uses: reactivecircus/android-emulator-runner@v2 + # with: + # working-directory: platforms/android + # api-level: ${{ matrix.api-level }} + # profile: ${{ env.DEVICE }} + # arch: ${{ env.ARCH }} + # force-avd-creation: false + # emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none + # disable-animations: true + # enable-hw-keyboard: true + # script: echo "Generated AVD snapshot for caching." + + - 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 - name: Run all tests with coverage uses: reactivecircus/android-emulator-runner@v2 From 73371f2cba3516ff8780c0deb171b840ca0a877d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jorge=20Mart=C3=ADn?= Date: Thu, 1 Feb 2024 16:53:27 +0100 Subject: [PATCH 2/3] Try enabling AVD cache again --- .github/workflows/android.yml | 42 +++++++++++++++++------------------ 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index 3a4a66fff..1b184dd72 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -57,28 +57,28 @@ jobs: :library:assembleDebugUnitTest :library:assembleDebugAndroidTest ${{ env.CI_GRADLE_ARG_PROPERTIES }} cache-read-only: false - # - name: AVD cache - # uses: actions/cache@v3 - # id: avd-cache - # with: - # path: | - # ~/.android/avd/* - # ~/.android/adb* - # key: avd-${{ matrix.api-level }} + - name: AVD cache + uses: actions/cache@v3 + id: avd-cache + with: + path: | + ~/.android/avd/* + ~/.android/adb* + key: avd-${{ matrix.api-level }} - # - name: Create AVD and generate snapshot for caching - # if: steps.avd-cache.outputs.cache-hit != 'true' - # uses: reactivecircus/android-emulator-runner@v2 - # with: - # working-directory: platforms/android - # api-level: ${{ matrix.api-level }} - # profile: ${{ env.DEVICE }} - # arch: ${{ env.ARCH }} - # force-avd-creation: false - # emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none - # disable-animations: true - # enable-hw-keyboard: true - # script: echo "Generated AVD snapshot for caching." + - name: Create AVD and generate snapshot for caching + if: steps.avd-cache.outputs.cache-hit != 'true' + uses: reactivecircus/android-emulator-runner@v2 + with: + working-directory: platforms/android + api-level: ${{ matrix.api-level }} + profile: ${{ env.DEVICE }} + arch: ${{ env.ARCH }} + force-avd-creation: false + emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none + disable-animations: true + enable-hw-keyboard: true + script: echo "Generated AVD snapshot for caching." - name: Enable KVM group perms run: | From 70c1e9c0476b45be08603346bdac407a61ab814a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jorge=20Mart=C3=ADn?= Date: Thu, 1 Feb 2024 17:20:36 +0100 Subject: [PATCH 3/3] Reorder jobs so the KVM enabling one is before the AVD one --- .github/workflows/android.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index 1b184dd72..b8454a85f 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -57,6 +57,12 @@ jobs: :library:assembleDebugUnitTest :library:assembleDebugAndroidTest ${{ env.CI_GRADLE_ARG_PROPERTIES }} cache-read-only: false + - 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 + - name: AVD cache uses: actions/cache@v3 id: avd-cache @@ -80,12 +86,6 @@ jobs: enable-hw-keyboard: true script: echo "Generated AVD snapshot for caching." - - 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 - - name: Run all tests with coverage uses: reactivecircus/android-emulator-runner@v2 with: