@@ -98,62 +98,39 @@ jobs:
9898 if : ${{ matrix.platform == 'ios' || matrix.platform == 'macos' }}
9999 working-directory : samples
100100 run : |
101- [[ "${{ matrix.platform }}" == "ios" ]] && cd react-native/ios
102- [[ "${{ matrix.platform }}" == "macos" ]] && cd react-native-macos/macos
101+ [[ "${{ matrix.platform }}" == "ios" ]] && cd react-native
102+ [[ "${{ matrix.platform }}" == "macos" ]] && cd react-native-macos
103103
104- [[ "${{ matrix.build-type }}" == "production" ]] && ENABLE_PROD=1 || ENABLE_PROD=0
105- [[ "${{ matrix.rn-architecture }}" == "new" ]] && ENABLE_NEW_ARCH=1 || ENABLE_NEW_ARCH=0
104+ [[ "${{ matrix.build-type }}" == "production" ]] && export ENABLE_PROD=1 || export ENABLE_PROD=0
105+ [[ "${{ matrix.rn-architecture }}" == "new" ]] && export ENABLE_NEW_ARCH=1 || export ENABLE_NEW_ARCH=0
106106 [[ "${{ matrix.ios-use-frameworks }}" == "dynamic-frameworks" ]] && export USE_FRAMEWORKS=dynamic
107- echo "ENABLE_PROD=$ENABLE_PROD"
108- echo "ENABLE_NEW_ARCH=$ENABLE_NEW_ARCH"
109- PRODUCTION=$ENABLE_PROD RCT_NEW_ARCH_ENABLED=$ENABLE_NEW_ARCH bundle exec pod install
110- cat Podfile.lock | grep $RN_SENTRY_POD_NAME
107+
108+ ./scripts/pod-install.sh
111109
112110 - name : Build Android App
113111 if : ${{ matrix.platform == 'android' }}
114- working-directory : ${{ env.REACT_NATIVE_SAMPLE_PATH }}/android
112+ working-directory : ${{ env.REACT_NATIVE_SAMPLE_PATH }}
115113 run : |
116- if [[ ${{ matrix.rn-architecture }} == 'new' ]]; then
117- perl -i -pe's/newArchEnabled=false/newArchEnabled=true/g' gradle.properties
118- echo 'New Architecture enabled'
119- elif [[ ${{ matrix.rn-architecture }} == 'legacy' ]]; then
120- perl -i -pe's/newArchEnabled=true/newArchEnabled=false/g' gradle.properties
121- echo 'Legacy Architecture enabled'
122- else
123- echo 'No changes for architecture: ${{ matrix.rn-architecture }}'
124- fi
125- [[ "${{ matrix.build-type }}" == "production" ]] && CONFIG='Release' || CONFIG='Debug'
126- echo "Building $CONFIG"
127- [[ "${{ matrix.build-type }}" == "production" ]] && TEST_TYPE='release' || TEST_TYPE='debug'
128- echo "Building $TEST_TYPE"
114+ export RN_ARCHITECTURE="${{ matrix.rn-architecture }}"
115+ [[ "${{ matrix.build-type }}" == "production" ]] && export CONFIG='release' || export CONFIG='debug'
129116
130- ./gradlew ":app:assemble$CONFIG" -PreactNativeArchitectures=x86
117+ ./scripts/detox/set-dsn-aos.mjs
118+ ./scripts/build-android.sh -PreactNativeArchitectures=x86
131119
132120 - name : Build iOS App
133121 if : ${{ matrix.platform == 'ios' }}
134- working-directory : ${{ env.REACT_NATIVE_SAMPLE_PATH }}/ios
122+ working-directory : ${{ env.REACT_NATIVE_SAMPLE_PATH }}
135123 run : |
136- [[ "${{ matrix.build-type }}" == "production" ]] && CONFIG='Release' || CONFIG='Debug'
137- echo "Building $CONFIG"
138- mkdir -p "DerivedData"
139- derivedData="$(cd "DerivedData" ; pwd -P)"
140- set -o pipefail && xcodebuild \
141- -workspace sentryreactnativesample.xcworkspace \
142- -configuration "$CONFIG" \
143- -scheme sentryreactnativesample \
144- -sdk 'iphonesimulator' \
145- -destination 'generic/platform=iOS Simulator' \
146- ONLY_ACTIVE_ARCH=yes \
147- -derivedDataPath "$derivedData" \
148- build \
149- | tee xcodebuild.log \
150- | xcbeautify --quieter --is-ci --disable-colored-output
124+ [[ "${{ matrix.build-type }}" == "production" ]] && export CONFIG='Release' || export CONFIG='Debug'
125+
126+ ./scripts/detox/set-dsn-ios.mjs
127+ ./scripts/build-ios.sh
151128
152129 - name : Build macOS App
153130 if : ${{ matrix.platform == 'macos' }}
154131 working-directory : samples/react-native-macos/macos
155132 run : |
156- [[ "${{ matrix.build-type }}" == "production" ]] && CONFIG='Release' || CONFIG='Debug'
133+ [[ "${{ matrix.build-type }}" == "production" ]] && export CONFIG='Release' || export CONFIG='Debug'
157134 echo "Building $CONFIG"
158135 mkdir -p "DerivedData"
159136 derivedData="$(cd "DerivedData" ; pwd -P)"
@@ -170,19 +147,19 @@ jobs:
170147
171148 - name : Archive iOS App
172149 if : ${{ matrix.platform == 'ios' && matrix.rn-architecture == 'new' && matrix.build-type == 'production' && matrix.ios-use-frameworks == 'no-frameworks' }}
150+ working-directory : ${{ env.REACT_NATIVE_SAMPLE_PATH }}
173151 run : |
174- cd ${{ env.REACT_NATIVE_SAMPLE_PATH }}/ios/DerivedData/Build/Products/Release-iphonesimulator
175152 zip -r \
176153 ${{ github.workspace }}/${{ env.IOS_APP_ARCHIVE_PATH }} \
177154 sentryreactnativesample.app
178155
179156 - name : Archive Android App
180157 if : ${{ matrix.platform == 'android' && matrix.rn-architecture == 'new' && matrix.build-type == 'production' }}
181158 run : |
182- mv ${{ env.REACT_NATIVE_SAMPLE_PATH }}/android/app/build/outputs/apk/release/app-release.apk app.apk
183159 zip -j \
184160 ${{ env.ANDROID_APP_ARCHIVE_PATH }} \
185- app.apk
161+ ${{ env.REACT_NATIVE_SAMPLE_PATH }}/app.apk \
162+ ${{ env.REACT_NATIVE_SAMPLE_PATH }}/app-androidTest.apk
186163
187164 - name : Upload iOS APP
188165 if : ${{ matrix.platform == 'ios' && matrix.rn-architecture == 'new' && matrix.build-type == 'production' && matrix.ios-use-frameworks == 'no-frameworks' }}
@@ -207,6 +184,138 @@ jobs:
207184 name : build-sample-${{ matrix.rn-architecture }}-${{ matrix.platform }}-${{ matrix.build-type }}-${{ matrix.ios-use-frameworks}}-logs
208185 path : ${{ env.REACT_NATIVE_SAMPLE_PATH }}/${{ matrix.platform }}/*.log
209186
187+ test-detox :
188+ name : ${{ matrix.job-name }}
189+ runs-on : ${{ matrix.runs-on }}
190+ needs : [diff_check, build]
191+ if : ${{ needs.diff_check.outputs.skip_ci != 'true' }}
192+ strategy :
193+ # we want that the matrix keeps running, default is to cancel them if it fails.
194+ fail-fast : false
195+ matrix :
196+ include :
197+ - job-name : ' Test iOS Release Auto Init'
198+ platform : ios
199+ runs-on : macos-15
200+ rn-architecture : ' new'
201+ ios-use-frameworks : ' no-frameworks'
202+ build-type : ' production'
203+ test-command : ' yarn test-ios-auto' # tests native auto init from JS
204+
205+ - job-name : ' Test iOS Release Manual Init'
206+ platform : ios
207+ runs-on : macos-15
208+ rn-architecture : ' new'
209+ ios-use-frameworks : ' no-frameworks'
210+ build-type : ' production'
211+ test-command : ' yarn test-ios-manual'
212+
213+ - job-name : ' Test Android Release Manual Init'
214+ platform : android
215+ runs-on : ubuntu-latest
216+ rn-architecture : ' new'
217+ build-type : ' production'
218+ test-command : ' yarn test-android'
219+
220+ steps :
221+ - uses : actions/checkout@v4
222+
223+ - name : Download iOS App Archive
224+ if : ${{ matrix.platform == 'ios' }}
225+ uses : actions/download-artifact@v4
226+ with :
227+ name : sample-rn-${{ matrix.rn-architecture }}-${{ matrix.build-type }}-${{ matrix.ios-use-frameworks}}-${{ matrix.platform }}
228+ path : ${{ env.REACT_NATIVE_SAMPLE_PATH }}
229+
230+ - name : Download Android APK
231+ if : ${{ matrix.platform == 'android' }}
232+ uses : actions/download-artifact@v4
233+ with :
234+ name : sample-rn-${{ matrix.rn-architecture }}-${{ matrix.build-type }}-${{ matrix.platform }}
235+ path : ${{ env.REACT_NATIVE_SAMPLE_PATH }}
236+
237+ - name : Unzip iOS App Archive
238+ if : ${{ matrix.platform == 'ios' }}
239+ working-directory : ${{ env.REACT_NATIVE_SAMPLE_PATH }}
240+ run : unzip ${{ env.IOS_APP_ARCHIVE_PATH }}
241+
242+ - name : Unzip Android APK
243+ if : ${{ matrix.platform == 'android' }}
244+ working-directory : ${{ env.REACT_NATIVE_SAMPLE_PATH }}
245+ run : unzip ${{ env.ANDROID_APP_ARCHIVE_PATH }}
246+
247+ - name : Enable Corepack
248+ run : |
249+ npm install -g corepack@0.29.4
250+ corepack enable
251+ - uses : actions/setup-node@v4
252+ with :
253+ node-version : 18
254+ cache : ' yarn'
255+ cache-dependency-path : yarn.lock
256+
257+ - name : Install JS Dependencies
258+ run : yarn install
259+
260+ - name : Install Detox
261+ run : npm install -g detox-cli@20.0.0
262+
263+ - name : Install Apple Simulator Utilities
264+ if : ${{ matrix.platform == 'ios' }}
265+ run : |
266+ brew tap wix/brew
267+ brew install applesimutils
268+
269+ - name : Setup KVM
270+ if : ${{ matrix.platform == 'android' }}
271+ shell : bash
272+ run : |
273+ # check if virtualization is supported...
274+ sudo apt install -y --no-install-recommends cpu-checker coreutils && echo "CPUs=$(nproc --all)" && kvm-ok
275+ # allow access to KVM to run the emulator
276+ echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' \
277+ | sudo tee /etc/udev/rules.d/99-kvm4all.rules
278+ sudo udevadm control --reload-rules
279+ sudo udevadm trigger --name-match=kvm
280+
281+ - uses : futureware-tech/simulator-action@dab10d813144ef59b48d401cd95da151222ef8cd # pin@v4
282+ if : ${{ matrix.platform == 'ios' }}
283+ with :
284+ # the same envs are used by Detox ci.sim configuration
285+ model : ${{ env.IOS_DEVICE }}
286+ os_version : ${{ env.IOS_VERSION }}
287+
288+ - name : Run Detox iOS Tests
289+ if : ${{ matrix.platform == 'ios' }}
290+ working-directory : ${{ env.REACT_NATIVE_SAMPLE_PATH }}
291+ run : ${{ matrix.test-command }}
292+
293+ - name : Run tests on Android
294+ if : ${{ matrix.platform == 'android' }}
295+ env :
296+ # used by Detox ci.android configuration
297+ ANDROID_AVD_NAME : ' test' # test is default reactivecircus/android-emulator-runner name
298+ ANDROID_TYPE : ' android.emulator'
299+ uses : reactivecircus/android-emulator-runner@62dbb605bba737720e10b196cb4220d374026a6d # pin@v2.33.0
300+ with :
301+ api-level : ${{ env.ANDROID_API_LEVEL }}
302+ force-avd-creation : false
303+ disable-animations : true
304+ disable-spellchecker : true
305+ target : ' aosp_atd'
306+ channel : canary # Necessary for ATDs
307+ emulator-options : >
308+ -no-window
309+ -no-snapshot-save
310+ -gpu swiftshader_indirect
311+ -noaudio
312+ -no-boot-anim
313+ -camera-back none
314+ -camera-front none
315+ -timezone US/Pacific
316+ working-directory : ${{ env.REACT_NATIVE_SAMPLE_PATH }}
317+ script : ${{ matrix.test-command }}
318+
210319 test :
211320 name : Test ${{ matrix.platform }} ${{ matrix.build-type }} REV2
212321 runs-on : ${{ matrix.runs-on }}
0 commit comments