@@ -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,150 @@ 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+ 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 [email protected] 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+ - uses : futureware-tech/simulator-action@dab10d813144ef59b48d401cd95da151222ef8cd # pin@v4
284+ if : ${{ matrix.platform == 'ios' }}
285+ with :
286+ # the same envs are used by Detox ci.sim configuration
287+ model : ${{ env.IOS_DEVICE }}
288+ os_version : ${{ env.IOS_VERSION }}
289+
290+ - name : Run Detox iOS Tests
291+ if : ${{ matrix.platform == 'ios' }}
292+ working-directory : ${{ env.REACT_NATIVE_SAMPLE_PATH }}
293+ run : detox test --configuration ci.sim
294+
295+ - name : Run tests on Android
296+ if : ${{ matrix.platform == 'android' }}
297+ env :
298+ # used by Detox ci.android configuration
299+ ANDROID_AVD_NAME : ' test' # test is default reactivecircus/android-emulator-runner name
300+ uses :
reactivecircus/android-emulator-runner@62dbb605bba737720e10b196cb4220d374026a6d # [email protected] 301+ with :
302+ api-level : ${{ env.ANDROID_API_LEVEL }}
303+ force-avd-creation : false
304+ disable-animations : true
305+ disable-spellchecker : true
306+ target : ' aosp_atd'
307+ channel : canary # Necessary for ATDs
308+ emulator-options : >
309+ -no-window
310+ -no-snapshot-save
311+ -gpu swiftshader_indirect
312+ -noaudio
313+ -no-boot-anim
314+ -camera-back none
315+ -camera-front none
316+ -timezone US/Pacific
317+ working-directory : ${{ env.REACT_NATIVE_SAMPLE_PATH }}
318+ script : detox test --configuration ci.android
0 commit comments