Skip to content

Commit 1ed7625

Browse files
committed
fix(#50): cache avd in e2e android workflow
1 parent 3f42703 commit 1ed7625

File tree

6 files changed

+37
-19
lines changed

6 files changed

+37
-19
lines changed

.github/actions/installMaestro/action.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ runs:
1212
- name: Install Maestro CLI
1313
shell: bash
1414
run: |
15-
export MAESTRO_VERSION=1.40.3
15+
export MAESTRO_VERSION=1.41.0
1616
curl -Ls "https://get.maestro.mobile.dev" | bash
1717
1818
- name: Conditionally install brew packages for iOS

.github/actions/setup/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ runs:
1111
node-version: 20
1212

1313
- name: Install dependencies
14-
run: yarn install --frozen-lockfile --immutable
14+
run: yarn install --immutable
1515
shell: bash

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
cache: yarn
2525

2626
- name: Install Dependencies
27-
run: yarn install --frozen-lockfile
27+
run: yarn install --immutable
2828

2929
- name: Create Release Pull Request or Publish to npm
3030
id: changesets

.github/workflows/test-e2e-android.yaml

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,22 +78,49 @@ jobs:
7878
uses: gradle/actions/setup-gradle@v3
7979

8080
- name: Install example dependencies
81-
run: yarn workspace react-native-legal-bare-example install --frozen-lockfile --immutable
81+
run: yarn workspace react-native-legal-bare-example install --immutable
8282

8383
- name: Bundle app
8484
run: yarn workspace react-native-legal-bare-example build:android
8585

86-
- name: Create AVD and generate snapshot for caching
86+
- name: Enable KVM group perms
87+
run: |
88+
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
89+
sudo udevadm control --reload-rules
90+
sudo udevadm trigger --name-match=kvm
91+
92+
- name: AVD cache
93+
uses: actions/cache@v4
94+
id: avd-cache
95+
with:
96+
path: |
97+
~/.android/avd/*
98+
~/.android/adb*
99+
key: avd-${{ matrix.api-level }}
100+
101+
- name: create AVD, generate snapshot for caching, build app and run tests
102+
if: steps.avd-cache.outputs.cache-hit != 'true'
87103
uses: reactivecircus/android-emulator-runner@v2
88104
with:
89105
api-level: ${{ matrix.api-level }}
90106
arch: 'x86_64'
91107
target: 'google_apis'
92-
force-avd-creation: true
93-
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
108+
force-avd-creation: false
109+
cores: 4
110+
emulator-options: -verbose -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-front none -camera-back none
94111
disable-animations: false
95-
ram-size: '4096M'
96-
script: ./scripts/e2e_android_emulator_build_and_test.sh
112+
ram-size: '6144M'
113+
script: |
114+
echo "Generated AVD snapshot for caching."
115+
yarn workspace react-native-legal-bare-example android:release
116+
yarn workspace react-native-legal-bare-example e2e:android
117+
118+
- name: launch AVD, build app and run tests
119+
if: steps.avd-cache.outputs.cache-hit == 'true'
120+
run: |
121+
emulator @test
122+
yarn workspace react-native-legal-bare-example android:release
123+
yarn workspace react-native-legal-bare-example e2e:android
97124
98125
- name: Upload report
99126
if: always()

.github/workflows/test-e2e-ios.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ jobs:
5151
target-platform: ios
5252

5353
- name: Install example dependencies
54-
run: yarn workspace react-native-legal-bare-example install --frozen-lockfile --immutable
54+
run: yarn workspace react-native-legal-bare-example install --immutable
5555

5656
- name: Cache Pods
5757
id: cache-pods

scripts/e2e_android_emulator_build_and_test.sh

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)