2929 MAESTRO_DISABLE_UPDATE_CHECK : true
3030
3131jobs :
32- e2e-android :
32+ build-release :
3333 runs-on : ubuntu-latest
34+ outputs :
35+ artifact-id : ${{ steps.rnef-remote-build-android.outputs.artifact-id }}
36+
37+ steps :
38+ - name : Checkout Repo
39+ uses : actions/checkout@v4
40+ with :
41+ fetch-depth : 0
42+
43+ - name : Setup
44+ uses : ./.github/actions/setup
45+
46+ - name : Run generate:legal from bare-example
47+ run : yarn workspace react-native-legal-bare-example generate:legal
48+ shell : bash
49+
50+ - name : " [WORKAROUND] run generateCodegenArtifactsFromSchema manually for example app"
51+ shell : bash
52+ run : |
53+ cd examples/bare-example/android
54+ ./gradlew generateCodegenArtifactsFromSchema
55+
56+ - name : RNEF Remote Build - Android
57+ id : rnef-remote-build-android
58+ uses : callstackincubator/android@v1
59+ with :
60+ variant : release
61+ github-token : ${{ secrets.GITHUB_TOKEN }}
62+ sign : false
63+ working-directory : ./examples/bare-example
64+
65+ run-e2e-tests :
66+ runs-on : ubuntu-latest
67+ needs : build-release
3468 strategy :
3569 fail-fast : false
3670 matrix :
37- api-level : [30, 34 , 35]
71+ api-level : [ 30, 33 , 35 ]
3872 steps :
39- - name : Enable KVM group perms
40- run : |
41- echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
42- sudo udevadm control --reload-rules
43- sudo udevadm trigger --name-match=kvm
44-
4573 - name : Checkout Repo
4674 uses : actions/checkout@v4
4775 with :
@@ -55,44 +83,58 @@ jobs:
5583 with :
5684 target-platform : android
5785
58- - name : Cache Build
59- id : cache-build
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 : Download and Unpack APK artifact
93+ run : |
94+ curl -L -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -o artifact.zip "https://api.github.com/repos/${{ github.repository }}/actions/artifacts/${{ needs.build-release.outputs.artifact-id }}/zip"
95+ unzip artifact.zip -d downloaded-artifacts
96+ ls -l downloaded-artifacts
97+ APK_PATH=$(pwd)/$(find downloaded-artifacts -name "*.apk" -print -quit)
98+ echo "ARTIFACT_PATH_FOR_E2E=$APK_PATH" >> $GITHUB_ENV
99+ shell : bash
100+
101+ - name : AVD cache
60102 uses : actions/cache@v4
61- env :
62- cache-name : cached-android-build
103+ id : avd-cache
63104 with :
64105 path : |
65- examples/bare-example/android/build
66- examples/bare-example/android/app/build
67- examples/bare-example/android/app/.cxx
68- key : bare-example-android-build
106+ ~/.android/avd/*
107+ ~/.android/adb*
108+ key : avd-${{ matrix.api-level }}
69109
70- - uses : actions/setup-java@v4
110+ - name : create AVD and generate snapshot for caching
111+ if : steps.avd-cache.outputs.cache-hit != 'true'
112+ uses : reactivecircus/android-emulator-runner@v2
71113 with :
72- distribution : ' zulu'
73- java-version : ' 17'
74- cache : ' gradle'
75-
76- - name : Gradle cache
77- uses : gradle/actions/setup-gradle@v3
78-
79- - name : Install example dependencies
80- run : yarn workspace react-native-legal-bare-example install --frozen-lockfile --immutable
81-
82- - name : Bundle app
83- run : yarn workspace react-native-legal-bare-example build:android
114+ api-level : ${{ matrix.api-level }}
115+ arch : ' x86_64'
116+ target : ' google_apis'
117+ force-avd-creation : false
118+ cores : 4
119+ emulator-options : -verbose -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-front none -camera-back none
120+ disable-animations : false
121+ ram-size : ' 6144M'
122+ script : echo "Generated AVD snapshot for caching."
84123
85- - name : Create AVD and generate snapshot for caching
124+ - name : Run tests
86125 uses : reactivecircus/android-emulator-runner@v2
87126 with :
88127 api-level : ${{ matrix.api-level }}
89128 arch : ' x86_64'
90129 target : ' google_apis'
91- force-avd-creation : true
92- emulator-options : -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
130+ force-avd-creation : false
131+ cores : 4
132+ emulator-options : -verbose -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-front none -camera-back none
93133 disable-animations : false
94- ram-size : ' 4096M'
95- script : ./scripts/e2e_android_emulator_build_and_test.sh
134+ ram-size : ' 6144M'
135+ script : |
136+ adb install -r "$ARTIFACT_PATH_FOR_E2E"
137+ yarn workspace react-native-legal-bare-example e2e:android
96138
97139 - name : Upload report
98140 if : always()
0 commit comments