@@ -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
107113name : 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" 
128+           [[ "${{ matrix.build-type }}" == "production" ]] && TEST_TYPE='release' || TEST_TYPE='debug' 
129+           echo "Building $TEST_TYPE" 
130+ 
122131          ./gradlew ":app:assemble$CONFIG" -PreactNativeArchitectures=x86 
123132
124133name : 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,160 @@ 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+           zip -j \ 
185+             ${{ env.ANDROID_APP_ARCHIVE_PATH }} \ 
186+             app.apk 
187+ 
188+ name : Upload iOS APP 
189+         if : ${{ matrix.platform == 'ios' && matrix.rn-architecture == 'new' && matrix.build-type == 'production' && matrix.ios-use-frameworks == 'no-frameworks' }} 
190+         uses : actions/upload-artifact@v4 
191+         with :
192+           name : sample-rn-${{ matrix.rn-architecture }}-${{ matrix.build-type }}-${{ matrix.ios-use-frameworks}}-${{ matrix.platform }} 
193+           path : ${{ env.IOS_APP_ARCHIVE_PATH }} 
194+           retention-days : 1 
195+ 
196+       - name : Upload Android APK 
197+         if : ${{ matrix.platform == 'android' && matrix.rn-architecture == 'new' && matrix.build-type == 'production' }} 
198+         uses : actions/upload-artifact@v4 
199+         with :
200+           name : sample-rn-${{ matrix.rn-architecture }}-${{ matrix.build-type }}-${{ matrix.platform }} 
201+           path : ${{ env.ANDROID_APP_ARCHIVE_PATH }} 
202+           retention-days : 1 
203+ 
163204      - name : Upload logs 
164205        if : ${{ always() }} 
165206        uses : actions/upload-artifact@v4 
166207        with :
167208          name : build-sample-${{ matrix.rn-architecture }}-${{ matrix.platform }}-${{ matrix.build-type }}-${{ matrix.ios-use-frameworks}}-logs 
168-           path : samples/react-native/${{ matrix.platform }}/*.log 
209+           path : ${{ env.REACT_NATIVE_SAMPLE_PATH }}/${{ matrix.platform }}/*.log 
210+ 
211+   test :
212+     name : Test ${{ matrix.platform }} ${{ matrix.build-type }} 
213+     runs-on : ${{ matrix.runs-on }} 
214+     needs : [diff_check, build] 
215+     if : ${{ needs.diff_check.outputs.skip_ci != 'true' }} 
216+     strategy :
217+       #  we want that the matrix keeps running, default is to cancel them if it fails.
218+       fail-fast : false 
219+       matrix :
220+         include :
221+           - platform : ios 
222+             runs-on : macos-15 
223+             rn-architecture : ' new' 
224+             ios-use-frameworks : ' no-frameworks' 
225+             build-type : ' production' 
226+ 
227+           - platform : android 
228+             runs-on : ubuntu-latest 
229+             rn-architecture : ' new' 
230+             build-type : ' production' 
231+ 
232+     steps :
233+       - uses : actions/checkout@v4 
234+ 
235+       - name : Download iOS App Archive 
236+         if : ${{ matrix.platform == 'ios' }} 
237+         uses : actions/download-artifact@v4 
238+         with :
239+           name : sample-rn-${{ matrix.rn-architecture }}-${{ matrix.build-type }}-${{ matrix.ios-use-frameworks}}-${{ matrix.platform }} 
240+           path : ${{ env.REACT_NATIVE_SAMPLE_PATH }} 
241+ 
242+       - name : Download Android APK 
243+         if : ${{ matrix.platform == 'android' }} 
244+         uses : actions/download-artifact@v4 
245+         with :
246+           name : sample-rn-${{ matrix.rn-architecture }}-${{ matrix.build-type }}-${{ matrix.platform }} 
247+           path : ${{ env.REACT_NATIVE_SAMPLE_PATH }} 
248+ 
249+       - name : Unzip iOS App Archive 
250+         if : ${{ matrix.platform == 'ios' }} 
251+         working-directory : ${{ env.REACT_NATIVE_SAMPLE_PATH }} 
252+         run : unzip ${{ env.IOS_APP_ARCHIVE_PATH }} 
253+ 
254+       - name : Unzip Android APK 
255+         if : ${{ matrix.platform == 'android' }} 
256+         working-directory : ${{ env.REACT_NATIVE_SAMPLE_PATH }} 
257+         run : unzip ${{ env.ANDROID_APP_ARCHIVE_PATH }} 
258+ 
259+       - name : Enable Corepack 
260+         run : | 
261+ 262+           corepack enable 
263+ uses : actions/setup-node@v4 
264+         with :
265+           node-version : 18 
266+           cache : ' yarn' 
267+           cache-dependency-path : yarn.lock 
268+ 
269+       - name : Install JS Dependencies 
270+         run : yarn install 
271+ 
272+       - name : Install Detox 
273+         run : 
npm install -g [email protected]   274+ 
275+       - name : Install Apple Simulator Utilities 
276+         if : ${{ matrix.platform == 'ios' }} 
277+         run : | 
278+           brew tap wix/brew 
279+           brew install applesimutils 
280+ 
281+ name : Setup KVM 
282+         if : ${{ matrix.platform == 'android' }} 
283+         shell : bash 
284+         run : | 
285+           # check if virtualization is supported... 
286+           sudo apt install -y --no-install-recommends cpu-checker coreutils && echo "CPUs=$(nproc --all)" && kvm-ok 
287+           # allow access to KVM to run the emulator 
288+           echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' \ 
289+             | sudo tee /etc/udev/rules.d/99-kvm4all.rules 
290+           sudo udevadm control --reload-rules 
291+           sudo udevadm trigger --name-match=kvm 
292+ 
293+ uses : futureware-tech/simulator-action@dab10d813144ef59b48d401cd95da151222ef8cd  #  pin@v4
294+         if : ${{ matrix.platform == 'ios' }} 
295+         with :
296+           #  the same envs are used by Detox ci.sim configuration
297+           model : ${{ env.IOS_DEVICE }} 
298+           os_version : ${{ env.IOS_VERSION }} 
299+ 
300+       - name : Run Detox iOS Tests 
301+         if : ${{ matrix.platform == 'ios' }} 
302+         working-directory : ${{ env.REACT_NATIVE_SAMPLE_PATH }} 
303+         run : yarn test-ios 
304+ 
305+       - name : Run tests on Android 
306+         if : ${{ matrix.platform == 'android' }} 
307+         env :
308+           #  used by Detox ci.android configuration
309+           ANDROID_AVD_NAME : ' test' #  test is default reactivecircus/android-emulator-runner name
310+         uses : 
reactivecircus/android-emulator-runner@62dbb605bba737720e10b196cb4220d374026a6d  #  [email protected]  311+         with :
312+           api-level : ${{ env.ANDROID_API_LEVEL }} 
313+           force-avd-creation : false 
314+           disable-animations : true 
315+           disable-spellchecker : true 
316+           target : ' aosp_atd' 
317+           channel : canary  #  Necessary for ATDs
318+           emulator-options : > 
319+             -no-window 
320+             -no-snapshot-save 
321+             -gpu swiftshader_indirect 
322+             -noaudio 
323+             -no-boot-anim 
324+             -camera-back none 
325+             -camera-front none 
326+             -timezone US/Pacific 
327+ working-directory : ${{ env.REACT_NATIVE_SAMPLE_PATH }} 
328+           script : yarn test-android 
0 commit comments