@@ -112,62 +112,39 @@ jobs:
112112 if : ${{ matrix.platform == 'ios' || matrix.platform == 'macos' }}
113113 working-directory : samples
114114 run : |
115- [[ "${{ matrix.platform }}" == "ios" ]] && cd react-native/ios
116- [[ "${{ matrix.platform }}" == "macos" ]] && cd react-native-macos/macos
115+ [[ "${{ matrix.platform }}" == "ios" ]] && cd react-native
116+ [[ "${{ matrix.platform }}" == "macos" ]] && cd react-native-macos
117117
118- [[ "${{ matrix.build-type }}" == "production" ]] && ENABLE_PROD=1 || ENABLE_PROD=0
119- [[ "${{ matrix.rn-architecture }}" == "new" ]] && ENABLE_NEW_ARCH=1 || ENABLE_NEW_ARCH=0
118+ [[ "${{ matrix.build-type }}" == "production" ]] && export ENABLE_PROD=1 || export ENABLE_PROD=0
119+ [[ "${{ matrix.rn-architecture }}" == "new" ]] && export ENABLE_NEW_ARCH=1 || export ENABLE_NEW_ARCH=0
120120 [[ "${{ matrix.ios-use-frameworks }}" == "dynamic-frameworks" ]] && export USE_FRAMEWORKS=dynamic
121- echo "ENABLE_PROD=$ENABLE_PROD"
122- echo "ENABLE_NEW_ARCH=$ENABLE_NEW_ARCH"
123- PRODUCTION=$ENABLE_PROD RCT_NEW_ARCH_ENABLED=$ENABLE_NEW_ARCH bundle exec pod install
124- cat Podfile.lock | grep $RN_SENTRY_POD_NAME
121+
122+ ./scripts/pod-install.sh
125123
126124 - name : Build Android App
127125 if : ${{ matrix.platform == 'android' }}
128- working-directory : ${{ env.REACT_NATIVE_SAMPLE_PATH }}/android
126+ working-directory : ${{ env.REACT_NATIVE_SAMPLE_PATH }}
129127 run : |
130- if [[ ${{ matrix.rn-architecture }} == 'new' ]]; then
131- perl -i -pe's/newArchEnabled=false/newArchEnabled=true/g' gradle.properties
132- echo 'New Architecture enabled'
133- elif [[ ${{ matrix.rn-architecture }} == 'legacy' ]]; then
134- perl -i -pe's/newArchEnabled=true/newArchEnabled=false/g' gradle.properties
135- echo 'Legacy Architecture enabled'
136- else
137- echo 'No changes for architecture: ${{ matrix.rn-architecture }}'
138- fi
139- [[ "${{ matrix.build-type }}" == "production" ]] && CONFIG='Release' || CONFIG='Debug'
140- echo "Building $CONFIG"
141- [[ "${{ matrix.build-type }}" == "production" ]] && TEST_TYPE='release' || TEST_TYPE='debug'
142- echo "Building $TEST_TYPE"
128+ export RN_ARCHITECTURE="${{ matrix.rn-architecture }}"
129+ [[ "${{ matrix.build-type }}" == "production" ]] && export CONFIG='release' || export CONFIG='debug'
143130
144- ./gradlew ":app:assemble$CONFIG" -PreactNativeArchitectures=x86
131+ ./scripts/detox/set-dsn-aos.mjs
132+ ./scripts/build-android.sh -PreactNativeArchitectures=x86
145133
146134 - name : Build iOS App
147135 if : ${{ matrix.platform == 'ios' }}
148- working-directory : ${{ env.REACT_NATIVE_SAMPLE_PATH }}/ios
136+ working-directory : ${{ env.REACT_NATIVE_SAMPLE_PATH }}
149137 run : |
150- [[ "${{ matrix.build-type }}" == "production" ]] && CONFIG='Release' || CONFIG='Debug'
151- echo "Building $CONFIG"
152- mkdir -p "DerivedData"
153- derivedData="$(cd "DerivedData" ; pwd -P)"
154- set -o pipefail && xcodebuild \
155- -workspace sentryreactnativesample.xcworkspace \
156- -configuration "$CONFIG" \
157- -scheme sentryreactnativesample \
158- -sdk 'iphonesimulator' \
159- -destination 'generic/platform=iOS Simulator' \
160- ONLY_ACTIVE_ARCH=yes \
161- -derivedDataPath "$derivedData" \
162- build \
163- | tee xcodebuild.log \
164- | xcbeautify --quieter --is-ci --disable-colored-output
138+ [[ "${{ matrix.build-type }}" == "production" ]] && export CONFIG='Release' || export CONFIG='Debug'
139+
140+ ./scripts/detox/set-dsn-ios.mjs
141+ ./scripts/build-ios.sh
165142
166143 - name : Build macOS App
167144 if : ${{ matrix.platform == 'macos' }}
168145 working-directory : samples/react-native-macos/macos
169146 run : |
170- [[ "${{ matrix.build-type }}" == "production" ]] && CONFIG='Release' || CONFIG='Debug'
147+ [[ "${{ matrix.build-type }}" == "production" ]] && export CONFIG='Release' || export CONFIG='Debug'
171148 echo "Building $CONFIG"
172149 mkdir -p "DerivedData"
173150 derivedData="$(cd "DerivedData" ; pwd -P)"
@@ -184,19 +161,19 @@ jobs:
184161
185162 - name : Archive iOS App
186163 if : ${{ matrix.platform == 'ios' && matrix.rn-architecture == 'new' && matrix.build-type == 'production' && matrix.ios-use-frameworks == 'no-frameworks' }}
164+ working-directory : ${{ env.REACT_NATIVE_SAMPLE_PATH }}
187165 run : |
188- cd ${{ env.REACT_NATIVE_SAMPLE_PATH }}/ios/DerivedData/Build/Products/Release-iphonesimulator
189166 zip -r \
190167 ${{ github.workspace }}/${{ env.IOS_APP_ARCHIVE_PATH }} \
191168 sentryreactnativesample.app
192169
193170 - name : Archive Android App
194171 if : ${{ matrix.platform == 'android' && matrix.rn-architecture == 'new' && matrix.build-type == 'production' }}
195172 run : |
196- mv ${{ env.REACT_NATIVE_SAMPLE_PATH }}/android/app/build/outputs/apk/release/app-release.apk app.apk
197173 zip -j \
198174 ${{ env.ANDROID_APP_ARCHIVE_PATH }} \
199- app.apk
175+ ${{ env.REACT_NATIVE_SAMPLE_PATH }}/app.apk \
176+ ${{ env.REACT_NATIVE_SAMPLE_PATH }}/app-androidTest.apk
200177
201178 - name : Upload iOS APP
202179 if : ${{ matrix.platform == 'ios' && matrix.rn-architecture == 'new' && matrix.build-type == 'production' && matrix.ios-use-frameworks == 'no-frameworks' }}
@@ -221,6 +198,138 @@ jobs:
221198 name : build-sample-${{ matrix.rn-architecture }}-${{ matrix.platform }}-${{ matrix.build-type }}-${{ matrix.ios-use-frameworks}}-logs
222199 path : ${{ env.REACT_NATIVE_SAMPLE_PATH }}/${{ matrix.platform }}/*.log
223200
201+ test-detox :
202+ name : ${{ matrix.job-name }}
203+ runs-on : ${{ matrix.runs-on }}
204+ needs : [diff_check, build]
205+ if : ${{ needs.diff_check.outputs.skip_ci != 'true' }}
206+ strategy :
207+ # we want that the matrix keeps running, default is to cancel them if it fails.
208+ fail-fast : false
209+ matrix :
210+ include :
211+ - job-name : ' Test iOS Release Auto Init'
212+ platform : ios
213+ runs-on : macos-15
214+ rn-architecture : ' new'
215+ ios-use-frameworks : ' no-frameworks'
216+ build-type : ' production'
217+ test-command : ' yarn test-ios-auto' # tests native auto init from JS
218+
219+ - job-name : ' Test iOS Release Manual Init'
220+ platform : ios
221+ runs-on : macos-15
222+ rn-architecture : ' new'
223+ ios-use-frameworks : ' no-frameworks'
224+ build-type : ' production'
225+ test-command : ' yarn test-ios-manual'
226+
227+ - job-name : ' Test Android Release Manual Init'
228+ platform : android
229+ runs-on : ubuntu-latest
230+ rn-architecture : ' new'
231+ build-type : ' production'
232+ test-command : ' yarn test-android-manual'
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 : ${{ matrix.test-command }}
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+ ANDROID_TYPE : ' android.emulator'
313+ uses : reactivecircus/android-emulator-runner@62dbb605bba737720e10b196cb4220d374026a6d # pin@v2.33.0
314+ with :
315+ api-level : ${{ env.ANDROID_API_LEVEL }}
316+ force-avd-creation : false
317+ disable-animations : true
318+ disable-spellchecker : true
319+ target : ' aosp_atd'
320+ channel : canary # Necessary for ATDs
321+ emulator-options : >
322+ -no-window
323+ -no-snapshot-save
324+ -gpu swiftshader_indirect
325+ -noaudio
326+ -no-boot-anim
327+ -camera-back none
328+ -camera-front none
329+ -timezone US/Pacific
330+ working-directory : ${{ env.REACT_NATIVE_SAMPLE_PATH }}
331+ script : ${{ matrix.test-command }}
332+
224333 test :
225334 name : Test ${{ matrix.platform }} ${{ matrix.build-type }} REV2
226335 runs-on : ${{ matrix.runs-on }}
@@ -272,7 +381,9 @@ jobs:
272381 - name : Unzip Android APK
273382 if : ${{ matrix.platform == 'android' }}
274383 working-directory : ${{ env.REACT_NATIVE_SAMPLE_PATH }}
275- run : unzip ${{ env.ANDROID_APP_ARCHIVE_PATH }}
384+ run : |
385+ unzip ${{ env.ANDROID_APP_ARCHIVE_PATH }}
386+ rm app-androidTest.apk
276387
277388 - name : Enable Corepack
278389 run : npm i -g corepack
0 commit comments