From 7c9968abad2cbd78b74f5b11cb0a3302f63bd455 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20M=C4=99drek?= Date: Fri, 8 Aug 2025 18:57:42 +0200 Subject: [PATCH] fix(#50): cache avd and add enable kvm group params in e2e android workflow --- .github/actions/installMaestro/action.yaml | 2 +- .github/actions/setup/action.yml | 2 +- .github/workflows/release.yml | 2 +- .github/workflows/test-e2e-android.yaml | 31 +++++++++++++++---- .github/workflows/test-e2e-ios.yaml | 2 +- .../e2e_android_emulator_build_and_test.sh | 9 ------ 6 files changed, 29 insertions(+), 19 deletions(-) delete mode 100755 scripts/e2e_android_emulator_build_and_test.sh diff --git a/.github/actions/installMaestro/action.yaml b/.github/actions/installMaestro/action.yaml index 3eb6f39..e869e36 100644 --- a/.github/actions/installMaestro/action.yaml +++ b/.github/actions/installMaestro/action.yaml @@ -12,7 +12,7 @@ runs: - name: Install Maestro CLI shell: bash run: | - export MAESTRO_VERSION=1.40.3 + export MAESTRO_VERSION=1.41.0 curl -Ls "https://get.maestro.mobile.dev" | bash - name: Conditionally install brew packages for iOS diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml index 249f118..72be5cb 100644 --- a/.github/actions/setup/action.yml +++ b/.github/actions/setup/action.yml @@ -11,5 +11,5 @@ runs: node-version: 20 - name: Install dependencies - run: yarn install --frozen-lockfile --immutable + run: yarn install --immutable shell: bash diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a89551d..8576152 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -24,7 +24,7 @@ jobs: cache: yarn - name: Install Dependencies - run: yarn install --frozen-lockfile + run: yarn install --immutable - name: Create Release Pull Request or Publish to npm id: changesets diff --git a/.github/workflows/test-e2e-android.yaml b/.github/workflows/test-e2e-android.yaml index 2d2d381..252b4e9 100644 --- a/.github/workflows/test-e2e-android.yaml +++ b/.github/workflows/test-e2e-android.yaml @@ -78,22 +78,41 @@ jobs: uses: gradle/actions/setup-gradle@v3 - name: Install example dependencies - run: yarn workspace react-native-legal-bare-example install --frozen-lockfile --immutable + run: yarn workspace react-native-legal-bare-example install --immutable - name: Bundle app run: yarn workspace react-native-legal-bare-example build:android - - name: Create AVD and generate 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: AVD cache + uses: actions/cache@v4 + id: avd-cache + with: + path: | + ~/.android/avd/* + ~/.android/adb* + key: avd-${{ matrix.api-level }} + + - name: create AVD, generate snapshot for caching, build app and run tests uses: reactivecircus/android-emulator-runner@v2 with: api-level: ${{ matrix.api-level }} arch: 'x86_64' target: 'google_apis' - force-avd-creation: true - emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none + force-avd-creation: ${{ steps.avd-cache.outputs.cache-hit != 'true' }} + cores: 4 + emulator-options: -verbose -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-front none -camera-back none disable-animations: false - ram-size: '4096M' - script: ./scripts/e2e_android_emulator_build_and_test.sh + ram-size: '6144M' + script: | + echo "Generated AVD snapshot for caching." + yarn workspace react-native-legal-bare-example android:release + yarn workspace react-native-legal-bare-example e2e:android - name: Upload report if: always() diff --git a/.github/workflows/test-e2e-ios.yaml b/.github/workflows/test-e2e-ios.yaml index bba1ee8..bbdae34 100644 --- a/.github/workflows/test-e2e-ios.yaml +++ b/.github/workflows/test-e2e-ios.yaml @@ -51,7 +51,7 @@ jobs: target-platform: ios - name: Install example dependencies - run: yarn workspace react-native-legal-bare-example install --frozen-lockfile --immutable + run: yarn workspace react-native-legal-bare-example install --immutable - name: Cache Pods id: cache-pods diff --git a/scripts/e2e_android_emulator_build_and_test.sh b/scripts/e2e_android_emulator_build_and_test.sh deleted file mode 100755 index 976dfa6..0000000 --- a/scripts/e2e_android_emulator_build_and_test.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -echo "List installed system images" -sdkmanager --list_installed | grep system-images |grep x86_64 -yarn workspace react-native-legal-bare-example android:release -yarn workspace react-native-legal-bare-example e2e:android -TEST_STATUS=$? -echo "Test run completed with status $TEST_STATUS" -exit $TEST_STATUS