29
29
MAESTRO_DISABLE_UPDATE_CHECK : true
30
30
31
31
jobs :
32
- e2e-android :
32
+ build-release :
33
33
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
34
68
strategy :
35
69
fail-fast : false
36
70
matrix :
37
- api-level : [30, 34 , 35]
71
+ api-level : [ 30, 33 , 35 ]
38
72
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
-
45
73
- name : Checkout Repo
46
74
uses : actions/checkout@v4
47
75
with :
@@ -55,44 +83,58 @@ jobs:
55
83
with :
56
84
target-platform : android
57
85
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
60
102
uses : actions/cache@v4
61
- env :
62
- cache-name : cached-android-build
103
+ id : avd-cache
63
104
with :
64
105
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 }}
69
109
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
71
113
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."
84
123
85
- - name : Create AVD and generate snapshot for caching
124
+ - name : Run tests
86
125
uses : reactivecircus/android-emulator-runner@v2
87
126
with :
88
127
api-level : ${{ matrix.api-level }}
89
128
arch : ' x86_64'
90
129
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
93
133
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
96
138
97
139
- name : Upload report
98
140
if : always()
0 commit comments