@@ -14,6 +14,12 @@ concurrency:
14
14
env :
15
15
SENTRY_AUTH_TOKEN : ${{ secrets.SENTRY_AUTH_TOKEN }}
16
16
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'
17
23
18
24
jobs :
19
25
diff_check :
66
72
- uses : ruby/setup-ruby@v1
67
73
if : ${{ matrix.platform == 'ios' || matrix.platform == 'macos' }}
68
74
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' }}
70
76
ruby-version : ' 3.3.0' # based on what is used in the sample
71
77
bundler-cache : true # runs 'bundle install' and caches installed gems automatically
72
78
cache-version : 1 # cache the installed gems
@@ -93,59 +99,39 @@ jobs:
93
99
if : ${{ matrix.platform == 'ios' || matrix.platform == 'macos' }}
94
100
working-directory : samples
95
101
run : |
96
- [[ "${{ matrix.platform }}" == "ios" ]] && cd react-native/ios
97
- [[ "${{ matrix.platform }}" == "macos" ]] && cd react-native-macos/macos
102
+ [[ "${{ matrix.platform }}" == "ios" ]] && cd react-native
103
+ [[ "${{ matrix.platform }}" == "macos" ]] && cd react-native-macos
98
104
99
- [[ "${{ matrix.build-type }}" == "production" ]] && ENABLE_PROD=1 || ENABLE_PROD=0
100
- [[ "${{ matrix.rn-architecture }}" == "new" ]] && ENABLE_NEW_ARCH=1 || ENABLE_NEW_ARCH=0
105
+ [[ "${{ matrix.build-type }}" == "production" ]] && export ENABLE_PROD=1 || export ENABLE_PROD=0
106
+ [[ "${{ matrix.rn-architecture }}" == "new" ]] && export ENABLE_NEW_ARCH=1 || export ENABLE_NEW_ARCH=0
101
107
[[ "${{ matrix.ios-use-frameworks }}" == "dynamic-frameworks" ]] && export USE_FRAMEWORKS=dynamic
102
- echo "ENABLE_PROD=$ENABLE_PROD"
103
- echo "ENABLE_NEW_ARCH=$ENABLE_NEW_ARCH"
104
- PRODUCTION=$ENABLE_PROD RCT_NEW_ARCH_ENABLED=$ENABLE_NEW_ARCH bundle exec pod install
105
- cat Podfile.lock | grep $RN_SENTRY_POD_NAME
108
+
109
+ ./scripts/pod-install.sh
106
110
107
111
- name : Build Android App
108
112
if : ${{ matrix.platform == 'android' }}
109
- working-directory : samples/react-native/android
113
+ working-directory : ${{ env.REACT_NATIVE_SAMPLE_PATH }}
110
114
run : |
111
- if [[ ${{ matrix.rn-architecture }} == 'new' ]]; then
112
- perl -i -pe's/newArchEnabled=false/newArchEnabled=true/g' gradle.properties
113
- echo 'New Architecture enabled'
114
- elif [[ ${{ matrix.rn-architecture }} == 'legacy' ]]; then
115
- perl -i -pe's/newArchEnabled=true/newArchEnabled=false/g' gradle.properties
116
- echo 'Legacy Architecture enabled'
117
- else
118
- echo 'No changes for architecture: ${{ matrix.rn-architecture }}'
119
- fi
120
- [[ "${{ matrix.build-type }}" == "production" ]] && CONFIG='Release' || CONFIG='Debug'
121
- echo "Building $CONFIG"
122
- ./gradlew ":app:assemble$CONFIG" -PreactNativeArchitectures=x86
115
+ export RN_ARCHITECTURE="${{ matrix.rn-architecture }}"
116
+ [[ "${{ matrix.build-type }}" == "production" ]] && export CONFIG='release' || export CONFIG='debug'
117
+
118
+ ./scripts/set-dsn-aos.mjs
119
+ ./scripts/build-android.sh -PreactNativeArchitectures=x86
123
120
124
121
- name : Build iOS App
125
122
if : ${{ matrix.platform == 'ios' }}
126
- working-directory : samples/react-native/ios
123
+ working-directory : ${{ env.REACT_NATIVE_SAMPLE_PATH }}
127
124
run : |
128
- [[ "${{ matrix.build-type }}" == "production" ]] && CONFIG='Release' || CONFIG='Debug'
129
- echo "Building $CONFIG"
130
- mkdir -p "DerivedData"
131
- derivedData="$(cd "DerivedData" ; pwd -P)"
132
- set -o pipefail && xcodebuild \
133
- -workspace sentryreactnativesample.xcworkspace \
134
- -configuration "$CONFIG" \
135
- -scheme sentryreactnativesample \
136
- -sdk 'iphonesimulator' \
137
- -destination 'generic/platform=iOS Simulator' \
138
- ONLY_ACTIVE_ARCH=yes \
139
- -derivedDataPath "$derivedData" \
140
- build \
141
- | tee xcodebuild.log \
142
- | xcbeautify --quieter --is-ci --disable-colored-output
125
+ [[ "${{ matrix.build-type }}" == "production" ]] && export CONFIG='Release' || export CONFIG='Debug'
126
+
127
+ ./scripts/set-dsn-ios.mjs
128
+ ./scripts/build-ios.sh
143
129
144
130
- name : Build macOS App
145
131
if : ${{ matrix.platform == 'macos' }}
146
132
working-directory : samples/react-native-macos/macos
147
133
run : |
148
- [[ "${{ matrix.build-type }}" == "production" ]] && CONFIG='Release' || CONFIG='Debug'
134
+ [[ "${{ matrix.build-type }}" == "production" ]] && export CONFIG='Release' || export CONFIG='Debug'
149
135
echo "Building $CONFIG"
150
136
mkdir -p "DerivedData"
151
137
derivedData="$(cd "DerivedData" ; pwd -P)"
@@ -160,9 +146,161 @@ jobs:
160
146
| tee xcodebuild.log \
161
147
| xcbeautify --quieter --is-ci --disable-colored-output
162
148
149
+ - name : Archive iOS App
150
+ if : ${{ matrix.platform == 'ios' && matrix.rn-architecture == 'new' && matrix.build-type == 'production' && matrix.ios-use-frameworks == 'no-frameworks' }}
151
+ working-directory : ${{ env.REACT_NATIVE_SAMPLE_PATH }}
152
+ run : |
153
+ zip -r \
154
+ ${{ github.workspace }}/${{ env.IOS_APP_ARCHIVE_PATH }} \
155
+ sentryreactnativesample.app
156
+
157
+ - name : Archive Android App
158
+ if : ${{ matrix.platform == 'android' && matrix.rn-architecture == 'new' && matrix.build-type == 'production' }}
159
+ run : |
160
+ zip -j \
161
+ ${{ env.ANDROID_APP_ARCHIVE_PATH }} \
162
+ ${{ env.REACT_NATIVE_SAMPLE_PATH }}/app.apk \
163
+ ${{ env.REACT_NATIVE_SAMPLE_PATH }}/app-androidTest.apk
164
+
165
+ - name : Upload iOS APP
166
+ if : ${{ matrix.platform == 'ios' && matrix.rn-architecture == 'new' && matrix.build-type == 'production' && matrix.ios-use-frameworks == 'no-frameworks' }}
167
+ uses : actions/upload-artifact@v4
168
+ with :
169
+ name : sample-rn-${{ matrix.rn-architecture }}-${{ matrix.build-type }}-${{ matrix.ios-use-frameworks}}-${{ matrix.platform }}
170
+ path : ${{ env.IOS_APP_ARCHIVE_PATH }}
171
+ retention-days : 1
172
+
173
+ - name : Upload Android APK
174
+ if : ${{ matrix.platform == 'android' && matrix.rn-architecture == 'new' && matrix.build-type == 'production' }}
175
+ uses : actions/upload-artifact@v4
176
+ with :
177
+ name : sample-rn-${{ matrix.rn-architecture }}-${{ matrix.build-type }}-${{ matrix.platform }}
178
+ path : ${{ env.ANDROID_APP_ARCHIVE_PATH }}
179
+ retention-days : 1
180
+
163
181
- name : Upload logs
164
182
if : ${{ always() }}
165
183
uses : actions/upload-artifact@v4
166
184
with :
167
185
name : build-sample-${{ matrix.rn-architecture }}-${{ matrix.platform }}-${{ matrix.build-type }}-${{ matrix.ios-use-frameworks}}-logs
168
- path : samples/react-native/${{ matrix.platform }}/*.log
186
+ path : ${{ env.REACT_NATIVE_SAMPLE_PATH }}/${{ matrix.platform }}/*.log
187
+
188
+ test :
189
+ name : Test ${{ matrix.platform }} ${{ matrix.build-type }}
190
+ runs-on : ${{ matrix.runs-on }}
191
+ needs : [diff_check, build]
192
+ if : ${{ needs.diff_check.outputs.skip_ci != 'true' }}
193
+ strategy :
194
+ # we want that the matrix keeps running, default is to cancel them if it fails.
195
+ fail-fast : false
196
+ matrix :
197
+ include :
198
+ - platform : ios
199
+ runs-on : macos-15
200
+ rn-architecture : ' new'
201
+ ios-use-frameworks : ' no-frameworks'
202
+ build-type : ' production'
203
+
204
+ - platform : android
205
+ runs-on : ubuntu-latest
206
+ rn-architecture : ' new'
207
+ build-type : ' production'
208
+
209
+ steps :
210
+ - uses : actions/checkout@v4
211
+
212
+ - name : Download iOS App Archive
213
+ if : ${{ matrix.platform == 'ios' }}
214
+ uses : actions/download-artifact@v4
215
+ with :
216
+ name : sample-rn-${{ matrix.rn-architecture }}-${{ matrix.build-type }}-${{ matrix.ios-use-frameworks}}-${{ matrix.platform }}
217
+ path : ${{ env.REACT_NATIVE_SAMPLE_PATH }}
218
+
219
+ - name : Download Android APK
220
+ if : ${{ matrix.platform == 'android' }}
221
+ uses : actions/download-artifact@v4
222
+ with :
223
+ name : sample-rn-${{ matrix.rn-architecture }}-${{ matrix.build-type }}-${{ matrix.platform }}
224
+ path : ${{ env.REACT_NATIVE_SAMPLE_PATH }}
225
+
226
+ - name : Unzip iOS App Archive
227
+ if : ${{ matrix.platform == 'ios' }}
228
+ working-directory : ${{ env.REACT_NATIVE_SAMPLE_PATH }}
229
+ run : unzip ${{ env.IOS_APP_ARCHIVE_PATH }}
230
+
231
+ - name : Unzip Android APK
232
+ if : ${{ matrix.platform == 'android' }}
233
+ working-directory : ${{ env.REACT_NATIVE_SAMPLE_PATH }}
234
+ run : unzip ${{ env.ANDROID_APP_ARCHIVE_PATH }}
235
+
236
+ - name : Enable Corepack
237
+ run : |
238
+ npm install -g corepack@0.29.4
239
+ corepack enable
240
+ - uses : actions/setup-node@v4
241
+ with :
242
+ node-version : 18
243
+ cache : ' yarn'
244
+ cache-dependency-path : yarn.lock
245
+
246
+ - name : Install JS Dependencies
247
+ run : yarn install
248
+
249
+ - name : Install Detox
250
+ run : npm install -g detox-cli@20.0.0
251
+
252
+ - name : Install Apple Simulator Utilities
253
+ if : ${{ matrix.platform == 'ios' }}
254
+ run : |
255
+ brew tap wix/brew
256
+ brew install applesimutils
257
+
258
+ - name : Setup KVM
259
+ if : ${{ matrix.platform == 'android' }}
260
+ shell : bash
261
+ run : |
262
+ # check if virtualization is supported...
263
+ sudo apt install -y --no-install-recommends cpu-checker coreutils && echo "CPUs=$(nproc --all)" && kvm-ok
264
+ # allow access to KVM to run the emulator
265
+ echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' \
266
+ | sudo tee /etc/udev/rules.d/99-kvm4all.rules
267
+ sudo udevadm control --reload-rules
268
+ sudo udevadm trigger --name-match=kvm
269
+
270
+ - uses : futureware-tech/simulator-action@dab10d813144ef59b48d401cd95da151222ef8cd # pin@v4
271
+ if : ${{ matrix.platform == 'ios' }}
272
+ with :
273
+ # the same envs are used by Detox ci.sim configuration
274
+ model : ${{ env.IOS_DEVICE }}
275
+ os_version : ${{ env.IOS_VERSION }}
276
+
277
+ - name : Run Detox iOS Tests
278
+ if : ${{ matrix.platform == 'ios' }}
279
+ working-directory : ${{ env.REACT_NATIVE_SAMPLE_PATH }}
280
+ run : yarn test-ios
281
+
282
+ - name : Run tests on Android
283
+ if : ${{ matrix.platform == 'android' }}
284
+ env :
285
+ # used by Detox ci.android configuration
286
+ ANDROID_AVD_NAME : ' test' # test is default reactivecircus/android-emulator-runner name
287
+ ANDROID_TYPE : ' android.emulator'
288
+ uses : reactivecircus/android-emulator-runner@62dbb605bba737720e10b196cb4220d374026a6d # pin@v2.33.0
289
+ with :
290
+ api-level : ${{ env.ANDROID_API_LEVEL }}
291
+ force-avd-creation : false
292
+ disable-animations : true
293
+ disable-spellchecker : true
294
+ target : ' aosp_atd'
295
+ channel : canary # Necessary for ATDs
296
+ emulator-options : >
297
+ -no-window
298
+ -no-snapshot-save
299
+ -gpu swiftshader_indirect
300
+ -noaudio
301
+ -no-boot-anim
302
+ -camera-back none
303
+ -camera-front none
304
+ -timezone US/Pacific
305
+ working-directory : ${{ env.REACT_NATIVE_SAMPLE_PATH }}
306
+ script : yarn test-android
0 commit comments