@@ -14,6 +14,12 @@ concurrency:
1414env :
1515 SENTRY_AUTH_TOKEN : ${{ secrets.SENTRY_AUTH_TOKEN }}
1616 RN_SENTRY_POD_NAME : RNSentry
17+ IOS_APP_ARCHIVE_PATH : sentry-react-native-sample.app.zip
18+ ANDROID_APP_ARCHIVE_PATH : sentry-react-native-sample.apk.zip
19+ REACT_NATIVE_SAMPLE_PATH : samples/react-native
20+ IOS_DEVICE : ' iPhone 16'
21+ IOS_VERSION : ' 18.1'
22+ ANDROID_API_LEVEL : ' 30'
1723
1824jobs :
1925 diff_check :
6672 - uses : ruby/setup-ruby@v1
6773 if : ${{ matrix.platform == 'ios' || matrix.platform == 'macos' }}
6874 with :
69- working-directory : ${{ matrix.platform == 'ios' && ' samples/react-native' || ' samples/react-native-macos' }}
75+ working-directory : ${{ matrix.platform == 'ios' && env.REACT_NATIVE_SAMPLE_PATH || ' samples/react-native-macos' }}
7076 ruby-version : ' 3.3.0' # based on what is used in the sample
7177 bundler-cache : true # runs 'bundle install' and caches installed gems automatically
7278 cache-version : 1 # cache the installed gems
@@ -106,7 +112,7 @@ jobs:
106112
107113 - name : Build Android App
108114 if : ${{ matrix.platform == 'android' }}
109- working-directory : samples/react-native /android
115+ working-directory : ${{ env.REACT_NATIVE_SAMPLE_PATH }} /android
110116 run : |
111117 if [[ ${{ matrix.rn-architecture }} == 'new' ]]; then
112118 perl -i -pe's/newArchEnabled=false/newArchEnabled=true/g' gradle.properties
@@ -119,11 +125,14 @@ jobs:
119125 fi
120126 [[ "${{ matrix.build-type }}" == "production" ]] && CONFIG='Release' || CONFIG='Debug'
121127 echo "Building $CONFIG"
122- ./gradlew ":app:assemble$CONFIG" -PreactNativeArchitectures=x86
128+ [[ "${{ matrix.build-type }}" == "production" ]] && TEST_TYPE='release' || TEST_TYPE='debug'
129+ echo "Building $TEST_TYPE"
130+
131+ ./gradlew ":app:assemble$CONFIG" app:assembleAndroidTest -DtestBuildType=$TEST_TYPE -PreactNativeArchitectures=x86
123132
124133 - name : Build iOS App
125134 if : ${{ matrix.platform == 'ios' }}
126- working-directory : samples/react-native /ios
135+ working-directory : ${{ env.REACT_NATIVE_SAMPLE_PATH }} /ios
127136 run : |
128137 [[ "${{ matrix.build-type }}" == "production" ]] && CONFIG='Release' || CONFIG='Debug'
129138 echo "Building $CONFIG"
@@ -160,9 +169,162 @@ jobs:
160169 | tee xcodebuild.log \
161170 | xcbeautify --quieter --is-ci --disable-colored-output
162171
172+ - name : Archive iOS App
173+ if : ${{ matrix.platform == 'ios' && matrix.rn-architecture == 'new' && matrix.build-type == 'production' && matrix.ios-use-frameworks == 'no-frameworks' }}
174+ run : |
175+ cd ${{ env.REACT_NATIVE_SAMPLE_PATH }}/ios/DerivedData/Build/Products/Release-iphonesimulator
176+ zip -r \
177+ ${{ github.workspace }}/${{ env.IOS_APP_ARCHIVE_PATH }} \
178+ sentryreactnativesample.app
179+
180+ - name : Archive Android App
181+ if : ${{ matrix.platform == 'android' && matrix.rn-architecture == 'new' && matrix.build-type == 'production' }}
182+ run : |
183+ mv ${{ env.REACT_NATIVE_SAMPLE_PATH }}/android/app/build/outputs/apk/release/app-release.apk app.apk
184+ mv ${{ env.REACT_NATIVE_SAMPLE_PATH }}/android/app/build/outputs/apk/androidTest/release/app-release-androidTest.apk app-androidTest.apk
185+ zip -j \
186+ ${{ env.ANDROID_APP_ARCHIVE_PATH }} \
187+ app.apk \
188+ app-androidTest.apk
189+
190+ - name : Upload iOS APP
191+ if : ${{ matrix.platform == 'ios' && matrix.rn-architecture == 'new' && matrix.build-type == 'production' && matrix.ios-use-frameworks == 'no-frameworks' }}
192+ uses : actions/upload-artifact@v4
193+ with :
194+ name : sample-rn-${{ matrix.rn-architecture }}-${{ matrix.build-type }}-${{ matrix.ios-use-frameworks}}-${{ matrix.platform }}
195+ path : ${{ env.IOS_APP_ARCHIVE_PATH }}
196+ retention-days : 1
197+
198+ - name : Upload Android APK
199+ if : ${{ matrix.platform == 'android' && matrix.rn-architecture == 'new' && matrix.build-type == 'production' }}
200+ uses : actions/upload-artifact@v4
201+ with :
202+ name : sample-rn-${{ matrix.rn-architecture }}-${{ matrix.build-type }}-${{ matrix.platform }}
203+ path : ${{ env.ANDROID_APP_ARCHIVE_PATH }}
204+ retention-days : 1
205+
163206 - name : Upload logs
164207 if : ${{ always() }}
165208 uses : actions/upload-artifact@v4
166209 with :
167210 name : build-sample-${{ matrix.rn-architecture }}-${{ matrix.platform }}-${{ matrix.build-type }}-${{ matrix.ios-use-frameworks}}-logs
168- path : samples/react-native/${{ matrix.platform }}/*.log
211+ path : ${{ env.REACT_NATIVE_SAMPLE_PATH }}/${{ matrix.platform }}/*.log
212+
213+ test :
214+ name : Test ${{ matrix.platform }} ${{ matrix.build-type }}
215+ runs-on : ${{ matrix.runs-on }}
216+ needs : [diff_check, build]
217+ if : ${{ needs.diff_check.outputs.skip_ci != 'true' }}
218+ strategy :
219+ # we want that the matrix keeps running, default is to cancel them if it fails.
220+ fail-fast : false
221+ matrix :
222+ include :
223+ - platform : ios
224+ runs-on : macos-15
225+ rn-architecture : ' new'
226+ ios-use-frameworks : ' no-frameworks'
227+ build-type : ' production'
228+
229+ - platform : android
230+ runs-on : ubuntu-latest
231+ rn-architecture : ' new'
232+ build-type : ' production'
233+
234+ steps :
235+ - uses : actions/checkout@v4
236+
237+ - name : Download iOS App Archive
238+ if : ${{ matrix.platform == 'ios' }}
239+ uses : actions/download-artifact@v4
240+ with :
241+ name : sample-rn-${{ matrix.rn-architecture }}-${{ matrix.build-type }}-${{ matrix.ios-use-frameworks}}-${{ matrix.platform }}
242+ path : ${{ env.REACT_NATIVE_SAMPLE_PATH }}
243+
244+ - name : Download Android APK
245+ if : ${{ matrix.platform == 'android' }}
246+ uses : actions/download-artifact@v4
247+ with :
248+ name : sample-rn-${{ matrix.rn-architecture }}-${{ matrix.build-type }}-${{ matrix.platform }}
249+ path : ${{ env.REACT_NATIVE_SAMPLE_PATH }}
250+
251+ - name : Unzip iOS App Archive
252+ if : ${{ matrix.platform == 'ios' }}
253+ working-directory : ${{ env.REACT_NATIVE_SAMPLE_PATH }}
254+ run : unzip ${{ env.IOS_APP_ARCHIVE_PATH }}
255+
256+ - name : Unzip Android APK
257+ if : ${{ matrix.platform == 'android' }}
258+ working-directory : ${{ env.REACT_NATIVE_SAMPLE_PATH }}
259+ run : unzip ${{ env.ANDROID_APP_ARCHIVE_PATH }}
260+
261+ - name : Enable Corepack
262+ run : |
263+ npm install -g corepack@0.29.4
264+ corepack enable
265+ - uses : actions/setup-node@v4
266+ with :
267+ node-version : 18
268+ cache : ' yarn'
269+ cache-dependency-path : yarn.lock
270+
271+ - name : Install JS Dependencies
272+ run : yarn install
273+
274+ - name : Install Detox
275+ run : npm install -g detox-cli@20.0.0
276+
277+ - name : Install Apple Simulator Utilities
278+ if : ${{ matrix.platform == 'ios' }}
279+ run : |
280+ brew tap wix/brew
281+ brew install applesimutils
282+
283+ - name : Setup KVM
284+ if : ${{ matrix.platform == 'android' }}
285+ shell : bash
286+ run : |
287+ # check if virtualization is supported...
288+ sudo apt install -y --no-install-recommends cpu-checker coreutils && echo "CPUs=$(nproc --all)" && kvm-ok
289+ # allow access to KVM to run the emulator
290+ echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' \
291+ | sudo tee /etc/udev/rules.d/99-kvm4all.rules
292+ sudo udevadm control --reload-rules
293+ sudo udevadm trigger --name-match=kvm
294+
295+ - uses : futureware-tech/simulator-action@dab10d813144ef59b48d401cd95da151222ef8cd # pin@v4
296+ if : ${{ matrix.platform == 'ios' }}
297+ with :
298+ # the same envs are used by Detox ci.sim configuration
299+ model : ${{ env.IOS_DEVICE }}
300+ os_version : ${{ env.IOS_VERSION }}
301+
302+ - name : Run Detox iOS Tests
303+ if : ${{ matrix.platform == 'ios' }}
304+ working-directory : ${{ env.REACT_NATIVE_SAMPLE_PATH }}
305+ run : detox test --configuration ci.sim
306+
307+ - name : Run tests on Android
308+ if : ${{ matrix.platform == 'android' }}
309+ env :
310+ # used by Detox ci.android configuration
311+ ANDROID_AVD_NAME : ' test' # test is default reactivecircus/android-emulator-runner name
312+ uses : reactivecircus/android-emulator-runner@62dbb605bba737720e10b196cb4220d374026a6d # pin@v2.33.0
313+ with :
314+ api-level : ${{ env.ANDROID_API_LEVEL }}
315+ force-avd-creation : false
316+ disable-animations : true
317+ disable-spellchecker : true
318+ target : ' aosp_atd'
319+ channel : canary # Necessary for ATDs
320+ emulator-options : >
321+ -no-window
322+ -no-snapshot-save
323+ -gpu swiftshader_indirect
324+ -noaudio
325+ -no-boot-anim
326+ -camera-back none
327+ -camera-front none
328+ -timezone US/Pacific
329+ working-directory : ${{ env.REACT_NATIVE_SAMPLE_PATH }}
330+ script : detox test --configuration ci.android
0 commit comments