-
-
Notifications
You must be signed in to change notification settings - Fork 342
322 lines (283 loc) · 12.3 KB
/
sample-application.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
name: Sample Application
on:
push:
branches:
- main
- v5
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
RN_SENTRY_POD_NAME: RNSentry
IOS_APP_ARCHIVE_PATH: sentry-react-native-sample.app.zip
ANDROID_APP_ARCHIVE_PATH: sentry-react-native-sample.apk.zip
REACT_NATIVE_SAMPLE_PATH: samples/react-native
IOS_DEVICE: 'iPhone 16'
IOS_VERSION: '18.1'
ANDROID_API_LEVEL: '30'
jobs:
diff_check:
uses: ./.github/workflows/skip-ci.yml
build:
name: Build ${{ matrix.rn-architecture }} ${{ matrix.platform }} ${{ matrix.build-type }} ${{ matrix.ios-use-frameworks}}
runs-on: ${{ matrix.runs-on }}
needs: [diff_check]
if: ${{ needs.diff_check.outputs.skip_ci != 'true' }}
env:
SENTRY_DISABLE_AUTO_UPLOAD: 'true'
strategy:
# we want that the matrix keeps running, default is to cancel them if it fails.
fail-fast: false
matrix:
rn-architecture: ['legacy', 'new']
ios-use-frameworks: ['no-frameworks', 'dynamic-frameworks']
platform: ['android', 'ios', 'macos']
build-type: ['dev', 'production']
include:
- platform: ios
runs-on: macos-15
- platform: macos
runs-on: macos-15
- platform: android
runs-on: ubuntu-latest
exclude:
- platform: 'android'
ios-use-frameworks: 'dynamic-frameworks'
- rn-architecture: 'new'
ios-use-frameworks: 'dynamic-frameworks'
- rn-architecture: 'new'
platform: 'macos'
- ios-use-frameworks: 'dynamic-frameworks'
platform: 'macos'
steps:
- uses: actions/checkout@v4
- name: Enable Corepack
run: |
npm install -g [email protected]
corepack enable
- uses: actions/setup-node@v4
with:
node-version: 18
cache: 'yarn'
cache-dependency-path: yarn.lock
- uses: ruby/setup-ruby@v1
if: ${{ matrix.platform == 'ios' || matrix.platform == 'macos' }}
with:
working-directory: ${{ matrix.platform == 'ios' && env.REACT_NATIVE_SAMPLE_PATH || ' samples/react-native-macos' }}
ruby-version: '3.3.0' # based on what is used in the sample
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
cache-version: 1 # cache the installed gems
- uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'adopt'
- name: Gradle cache
uses: gradle/gradle-build-action@v3
- name: Setup Global Xcode Tools
if: ${{ matrix.platform == 'ios' }}
run: which xcbeautify || brew install xcbeautify
- name: Install SDK Dependencies
run: yarn install
- name: Build SDK
run: yarn build
- name: Install App Pods
if: ${{ matrix.platform == 'ios' || matrix.platform == 'macos' }}
working-directory: samples
run: |
[[ "${{ matrix.platform }}" == "ios" ]] && cd react-native/ios
[[ "${{ matrix.platform }}" == "macos" ]] && cd react-native-macos/macos
[[ "${{ matrix.build-type }}" == "production" ]] && ENABLE_PROD=1 || ENABLE_PROD=0
[[ "${{ matrix.rn-architecture }}" == "new" ]] && ENABLE_NEW_ARCH=1 || ENABLE_NEW_ARCH=0
[[ "${{ matrix.ios-use-frameworks }}" == "dynamic-frameworks" ]] && export USE_FRAMEWORKS=dynamic
echo "ENABLE_PROD=$ENABLE_PROD"
echo "ENABLE_NEW_ARCH=$ENABLE_NEW_ARCH"
PRODUCTION=$ENABLE_PROD RCT_NEW_ARCH_ENABLED=$ENABLE_NEW_ARCH bundle exec pod install
cat Podfile.lock | grep $RN_SENTRY_POD_NAME
- name: Build Android App
if: ${{ matrix.platform == 'android' }}
working-directory: ${{ env.REACT_NATIVE_SAMPLE_PATH }}/android
run: |
../scripts/set-aos-dsn.mjs
if [[ ${{ matrix.rn-architecture }} == 'new' ]]; then
perl -i -pe's/newArchEnabled=false/newArchEnabled=true/g' gradle.properties
echo 'New Architecture enabled'
elif [[ ${{ matrix.rn-architecture }} == 'legacy' ]]; then
perl -i -pe's/newArchEnabled=true/newArchEnabled=false/g' gradle.properties
echo 'Legacy Architecture enabled'
else
echo 'No changes for architecture: ${{ matrix.rn-architecture }}'
fi
[[ "${{ matrix.build-type }}" == "production" ]] && CONFIG='Release' || CONFIG='Debug'
echo "Building $CONFIG"
[[ "${{ matrix.build-type }}" == "production" ]] && TEST_TYPE='release' || TEST_TYPE='debug'
echo "Building $TEST_TYPE"
./gradlew ":app:assemble$CONFIG" app:assembleAndroidTest -DtestBuildType=$TEST_TYPE -PreactNativeArchitectures=x86
- name: Build iOS App
if: ${{ matrix.platform == 'ios' }}
working-directory: ${{ env.REACT_NATIVE_SAMPLE_PATH }}/ios
run: |
../scripts/set-ios-dsn.mjs
[[ "${{ matrix.build-type }}" == "production" ]] && CONFIG='Release' || CONFIG='Debug'
echo "Building $CONFIG"
mkdir -p "DerivedData"
derivedData="$(cd "DerivedData" ; pwd -P)"
set -o pipefail && xcodebuild \
-workspace sentryreactnativesample.xcworkspace \
-configuration "$CONFIG" \
-scheme sentryreactnativesample \
-sdk 'iphonesimulator' \
-destination 'generic/platform=iOS Simulator' \
ONLY_ACTIVE_ARCH=yes \
-derivedDataPath "$derivedData" \
build \
| tee xcodebuild.log \
| xcbeautify --quieter --is-ci --disable-colored-output
- name: Build macOS App
if: ${{ matrix.platform == 'macos' }}
working-directory: samples/react-native-macos/macos
run: |
[[ "${{ matrix.build-type }}" == "production" ]] && CONFIG='Release' || CONFIG='Debug'
echo "Building $CONFIG"
mkdir -p "DerivedData"
derivedData="$(cd "DerivedData" ; pwd -P)"
set -o pipefail && xcodebuild \
-workspace sentry-react-native-sample.xcworkspace \
-configuration "$CONFIG" \
-scheme sentry-react-native-sample-macOS \
-destination 'platform=macOS' \
ONLY_ACTIVE_ARCH=yes \
-derivedDataPath "$derivedData" \
build \
| tee xcodebuild.log \
| xcbeautify --quieter --is-ci --disable-colored-output
- name: Archive iOS App
if: ${{ matrix.platform == 'ios' && matrix.rn-architecture == 'new' && matrix.build-type == 'production' && matrix.ios-use-frameworks == 'no-frameworks' }}
run: |
cd ${{ env.REACT_NATIVE_SAMPLE_PATH }}/ios/DerivedData/Build/Products/Release-iphonesimulator
zip -r \
${{ github.workspace }}/${{ env.IOS_APP_ARCHIVE_PATH }} \
sentryreactnativesample.app
- name: Archive Android App
if: ${{ matrix.platform == 'android' && matrix.rn-architecture == 'new' && matrix.build-type == 'production' }}
run: |
mv ${{ env.REACT_NATIVE_SAMPLE_PATH }}/android/app/build/outputs/apk/release/app-release.apk app.apk
mv ${{ env.REACT_NATIVE_SAMPLE_PATH }}/android/app/build/outputs/apk/androidTest/release/app-release-androidTest.apk app-androidTest.apk
zip -j \
${{ env.ANDROID_APP_ARCHIVE_PATH }} \
app.apk \
app-androidTest.apk
- name: Upload iOS APP
if: ${{ matrix.platform == 'ios' && matrix.rn-architecture == 'new' && matrix.build-type == 'production' && matrix.ios-use-frameworks == 'no-frameworks' }}
uses: actions/upload-artifact@v4
with:
name: sample-rn-${{ matrix.rn-architecture }}-${{ matrix.build-type }}-${{ matrix.ios-use-frameworks}}-${{ matrix.platform }}
path: ${{ env.IOS_APP_ARCHIVE_PATH }}
retention-days: 1
- name: Upload Android APK
if: ${{ matrix.platform == 'android' && matrix.rn-architecture == 'new' && matrix.build-type == 'production' }}
uses: actions/upload-artifact@v4
with:
name: sample-rn-${{ matrix.rn-architecture }}-${{ matrix.build-type }}-${{ matrix.platform }}
path: ${{ env.ANDROID_APP_ARCHIVE_PATH }}
retention-days: 1
- name: Upload logs
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: build-sample-${{ matrix.rn-architecture }}-${{ matrix.platform }}-${{ matrix.build-type }}-${{ matrix.ios-use-frameworks}}-logs
path: ${{ env.REACT_NATIVE_SAMPLE_PATH }}/${{ matrix.platform }}/*.log
test:
name: Test ${{ matrix.platform }} ${{ matrix.build-type }}
runs-on: ${{ matrix.runs-on }}
needs: [diff_check, build]
if: ${{ needs.diff_check.outputs.skip_ci != 'true' }}
strategy:
# we want that the matrix keeps running, default is to cancel them if it fails.
fail-fast: false
matrix:
include:
- platform: ios
runs-on: macos-15
rn-architecture: 'new'
ios-use-frameworks: 'no-frameworks'
build-type: 'production'
- platform: android
runs-on: ubuntu-latest
rn-architecture: 'new'
build-type: 'production'
steps:
- uses: actions/checkout@v4
- name: Download iOS App Archive
if: ${{ matrix.platform == 'ios' }}
uses: actions/download-artifact@v4
with:
name: sample-rn-${{ matrix.rn-architecture }}-${{ matrix.build-type }}-${{ matrix.ios-use-frameworks}}-${{ matrix.platform }}
path: ${{ env.REACT_NATIVE_SAMPLE_PATH }}
- name: Download Android APK
if: ${{ matrix.platform == 'android' }}
uses: actions/download-artifact@v4
with:
name: sample-rn-${{ matrix.rn-architecture }}-${{ matrix.build-type }}-${{ matrix.platform }}
path: ${{ env.REACT_NATIVE_SAMPLE_PATH }}
- name: Unzip iOS App Archive
if: ${{ matrix.platform == 'ios' }}
working-directory: ${{ env.REACT_NATIVE_SAMPLE_PATH }}
run: unzip ${{ env.IOS_APP_ARCHIVE_PATH }}
- name: Unzip Android APK
if: ${{ matrix.platform == 'android' }}
working-directory: ${{ env.REACT_NATIVE_SAMPLE_PATH }}
run: unzip ${{ env.ANDROID_APP_ARCHIVE_PATH }}
- name: Enable Corepack
run: |
npm install -g [email protected]
corepack enable
- uses: actions/setup-node@v4
with:
node-version: 18
cache: 'yarn'
cache-dependency-path: yarn.lock
- name: Install JS Dependencies
run: yarn install
- name: Install Detox
run: npm install -g [email protected]
- name: Install Apple Simulator Utilities
if: ${{ matrix.platform == 'ios' }}
run: |
brew tap wix/brew
brew install applesimutils
- uses: futureware-tech/simulator-action@dab10d813144ef59b48d401cd95da151222ef8cd # pin@v4
if: ${{ matrix.platform == 'ios' }}
with:
# the same envs are used by Detox ci.sim configuration
model: ${{ env.IOS_DEVICE }}
os_version: ${{ env.IOS_VERSION }}
- name: Run Detox iOS Tests
if: ${{ matrix.platform == 'ios' }}
working-directory: ${{ env.REACT_NATIVE_SAMPLE_PATH }}
run: detox test --configuration ci.sim
- name: Run tests on Android
if: ${{ matrix.platform == 'android' }}
env:
# used by Detox ci.android configuration
ANDROID_AVD_NAME: 'test' # test is default reactivecircus/android-emulator-runner name
uses: reactivecircus/android-emulator-runner@62dbb605bba737720e10b196cb4220d374026a6d # [email protected]
with:
api-level: ${{ env.ANDROID_API_LEVEL }}
force-avd-creation: false
disable-animations: true
disable-spellchecker: true
target: 'aosp_atd'
channel: canary # Necessary for ATDs
emulator-options: >
-no-window
-no-snapshot-save
-gpu swiftshader_indirect
-noaudio
-no-boot-anim
-camera-back none
-camera-front none
-timezone US/Pacific
working-directory: ${{ env.REACT_NATIVE_SAMPLE_PATH }}
script: detox test --configuration ci.android