@@ -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()
0 commit comments