21
21
with :
22
22
access_token : ${{ github.token }}
23
23
24
- device-test :
24
+ sample :
25
25
# Android emulator said to perform best with macos HAXM
26
26
runs-on : macos-latest
27
27
strategy :
33
33
- platform : ios
34
34
runtime : ' 16.0'
35
35
device : ' iPhone 14'
36
- env :
37
- PLATFORM : ${{ matrix.platform }}
38
- RUNTIME : ${{ matrix.runtime }}
39
- DEVICE : ${{ matrix.device }}
40
36
steps :
41
37
- uses : actions/checkout@v3
42
38
45
41
java-version : ' 11'
46
42
distribution : ' adopt'
47
43
48
- - name : Install Global Dependencies
49
- run : yarn global add @sentry/cli yalc
50
-
51
44
- name : NPM cache
52
45
uses : actions/cache@v3
53
46
id : deps-cache
@@ -74,28 +67,16 @@ jobs:
74
67
- name : Build SDK
75
68
run : yarn build
76
69
77
- - name : Package SDK
78
- run : yalc publish
79
-
80
- - name : Prepare sample for testing
81
- working-directory : ./sample
82
- run : sh ./scripts/prepareConfigsForTesting.sh
83
-
84
- - name : Install SDK in sample
85
- working-directory : ./sample
86
- run : yalc add @sentry/react-native
87
-
88
70
- name : Install Sample Dependencies
89
71
if : steps.deps-cache.outputs['cache-hit'] != 'true'
90
72
working-directory : ./sample
91
73
run : yarn install
92
74
93
75
- run : pod install
94
76
if : ${{ matrix.platform == 'ios' }}
95
- working-directory : ./sample/ios
96
77
env :
97
- # TEST env var is used in podfile to determine whether to include the sentry SDK from relative path or node_modules.
98
- TEST : true
78
+ PRODUCTION : 1
79
+ working-directory : ./sample/ios
99
80
100
81
- name : Build ${{ matrix.platform }} sample app
101
82
if : env.SENTRY_AUTH_TOKEN != null
@@ -129,46 +110,6 @@ jobs:
129
110
build
130
111
fi
131
112
132
- - name : Start Appium Server
133
- working-directory : ./sample
134
- run : yarn run appium --log-timestamp --log-no-colors --log appium.${{ matrix.platform }}.log &
135
-
136
- # Wait until the Appium server starts.
137
- - name : Check Appium Server
138
- uses : nick-fields/retry@943e742917ac94714d2f408a0e8320f2d1fcafcd # pin@v2
139
- with :
140
- timeout_seconds : 60
141
- max_attempts : 10
142
- command : curl --output /dev/null --silent --head --fail http://127.0.0.1:4723/sessions
143
-
144
- - name : Run tests on Android
145
- if : ${{ matrix.platform == 'android' }}
146
- uses : reactivecircus/android-emulator-runner@50986b1464923454c95e261820bc626f38490ec0 # pin@v2
147
- with :
148
- api-level : 29
149
- emulator-options : -accel on -no-snapshot -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none -camera-front none -timezone US/Pacific
150
- working-directory : sample
151
- script : |
152
- # Collect logs
153
- adb logcat '*:D' 2>&1 >adb.log &
154
- adb devices -l
155
-
156
- yarn test --verbose
157
-
158
- - name : Run tests on iOS
159
- if : ${{ matrix.platform == 'ios' }}
160
- working-directory : ./sample
161
- run : yarn test --verbose
162
-
163
- - name : Upload logs
164
- if : ${{ always() }}
165
- uses : actions/upload-artifact@v3
166
- with :
167
- name : ${{ matrix.platform }}-logs
168
- path : |
169
- ./sample/*.log
170
- ./sample/*.png
171
-
172
113
metrics :
173
114
runs-on : macos-latest
174
115
strategy :
@@ -325,13 +266,29 @@ jobs:
325
266
path : node_modules
326
267
key : ${{ github.workflow }}-${{ github.job }}-npm-${{ hashFiles('yarn.lock') }}
327
268
269
+ - name : NPM cache E2E Tests Library
270
+ uses : actions/cache@v3
271
+ id : deps-cache-e2e-library
272
+ with :
273
+ path : test/e2e/node_modules
274
+ key : ${{ github.workflow }}-${{ github.job }}-npm-${{ hashFiles('test/e2e/yarn.lock') }}
275
+
328
276
- name : Install SDK JS Dependencies
329
277
if : steps.deps-cache.outputs['cache-hit'] != 'true'
330
278
run : yarn install
331
279
280
+ - name : Install E2E Tests Library JS Dependencies
281
+ if : steps.deps-cache.outputs['deps-cache-e2e-library'] != 'true'
282
+ working-directory : test/e2e
283
+ run : yarn install
284
+
332
285
- name : Build SDK
333
286
run : yarn build
334
287
288
+ - name : Build E2E Tests Library
289
+ working-directory : test/e2e
290
+ run : yarn build
291
+
335
292
- name : Package SDK
336
293
run : yalc publish
337
294
@@ -347,6 +304,10 @@ jobs:
347
304
working-directory : test/react-native/versions/${{ matrix.rn-version }}/RnDiffApp
348
305
run : yarn install
349
306
307
+ - name : Add E2E Tests Library to App
308
+ working-directory : test/react-native/versions/${{ matrix.rn-version }}/RnDiffApp
309
+ run : yarn add ../../../../e2e
310
+
350
311
- name : Install App Pods
351
312
if : matrix.platform == 'ios'
352
313
working-directory : test/react-native/versions/${{ matrix.rn-version }}/RnDiffApp/ios
@@ -387,8 +348,8 @@ jobs:
387
348
run : |
388
349
[[ "${{ matrix.build-type }}" == "production" ]] && CONFIG='Release' || CONFIG='Debug'
389
350
echo "Building $CONFIG"
351
+ mkdir -p "DerivedData"
390
352
derivedData="$(cd "DerivedData" ; pwd -P)"
391
- mkdir -p "$derivedData"
392
353
xcodebuild \
393
354
-workspace RnDiffApp.xcworkspace \
394
355
-configuration "$CONFIG" \
@@ -398,3 +359,157 @@ jobs:
398
359
-sdk 'iphonesimulator${{ matrix.runtime }}' \
399
360
-derivedDataPath "$derivedData" \
400
361
build
362
+
363
+ - name : Archive Android APK
364
+ if : matrix.platform == 'android' && matrix.build-type == 'production'
365
+ run : |
366
+ BUILD_PATH=test/react-native/versions/${{ matrix.rn-version }}/RnDiffApp/android/app/build/outputs/apk/release
367
+ BUILD_NAME=app-release.apk
368
+ tar -cvf apk.tar -C $BUILD_PATH $BUILD_NAME
369
+
370
+ - name : Archive iOS APP
371
+ if : matrix.platform == 'ios' && matrix.build-type == 'production'
372
+ run : |
373
+ BUILD_PATH=test/react-native/versions/${{ matrix.rn-version }}/RnDiffApp/ios/DerivedData/Build/Products/Release-iphonesimulator
374
+ BUILD_NAME=RnDiffApp.app
375
+ tar -cvf app.tar -C $BUILD_PATH $BUILD_NAME
376
+
377
+ - name : Upload App APK
378
+ if : matrix.platform == 'android' && matrix.build-type == 'production'
379
+ uses : actions/upload-artifact@v3
380
+ with :
381
+ name : ${{ matrix.rn-version }}-${{ matrix.rn-architecture }}-${{ matrix.platform }}-${{ matrix.build-type }}-app-package
382
+ path : apk.tar
383
+ retention-days : 1
384
+
385
+ - name : Upload App APP
386
+ if : matrix.platform == 'ios' && matrix.build-type == 'production'
387
+ uses : actions/upload-artifact@v3
388
+ with :
389
+ name : ${{ matrix.rn-version }}-${{ matrix.rn-architecture }}-${{ matrix.platform }}-${{ matrix.build-type }}-app-package
390
+ path : app.tar
391
+ retention-days : 1
392
+
393
+ react-native-test :
394
+ name : Test RN ${{ matrix.rn-version }} ${{ matrix.rn-architecture }} ${{ matrix.platform }} ${{ matrix.build-type }}
395
+ needs : react-native-build
396
+ runs-on : macos-latest
397
+ strategy :
398
+ fail-fast : false # keeps matrix running if one fails
399
+ matrix :
400
+ rn-version : ['0.65.3', '0.70.6']
401
+ rn-architecture : ['legacy', 'new']
402
+ platform : ['android', 'ios']
403
+ build-type : ['production']
404
+ include :
405
+ - platform : ios
406
+ runtime : ' 16.0'
407
+ device : ' iPhone 14'
408
+ # exclude all rn versions lower than 0.70.0 for new architecture
409
+ exclude :
410
+ - rn-version : ' 0.65.3'
411
+ rn-architecture : ' new'
412
+ env :
413
+ PLATFORM : ${{ matrix.platform }}
414
+ RUNTIME : ${{ matrix.runtime }}
415
+ DEVICE : ${{ matrix.device }}
416
+ steps :
417
+ - uses : actions/checkout@v3
418
+
419
+ - name : Download App Package
420
+ if : matrix.build-type == 'production'
421
+ uses : actions/download-artifact@v3
422
+ with :
423
+ name : ${{ matrix.rn-version }}-${{ matrix.rn-architecture }}-${{ matrix.platform }}-${{ matrix.build-type }}-app-package
424
+ path : test/e2e
425
+
426
+ - name : Extract App Package
427
+ working-directory : test/e2e
428
+ run : tar -xvf *.tar
429
+
430
+ - uses : actions/setup-java@v3
431
+ with :
432
+ java-version : ' 11'
433
+ distribution : ' adopt'
434
+
435
+ - name : NPM cache E2E Tests Library
436
+ uses : actions/cache@v3
437
+ id : deps-cache-e2e-library
438
+ with :
439
+ path : test/e2e/node_modules
440
+ key : ${{ github.workflow }}-${{ github.job }}-npm-${{ hashFiles('test/e2e/yarn.lock') }}
441
+
442
+ - name : Install E2E Tests Library JS Dependencies
443
+ if : steps.deps-cache.outputs['deps-cache-e2e-library'] != 'true'
444
+ working-directory : test/e2e
445
+ run : yarn install
446
+
447
+ - name : Build iOS WebDriverAgent
448
+ if : matrix.platform == 'ios'
449
+ working-directory : test/e2e
450
+ run : |
451
+ mkdir -p "DerivedData"
452
+ derivedData="$(cd "DerivedData" ; pwd -P)"
453
+ xcodebuild \
454
+ -project node_modules/appium-webdriveragent/WebDriverAgent.xcodeproj \
455
+ -scheme WebDriverAgentRunner \
456
+ GCC_TREAT_WARNINGS_AS_ERRORS=0 \
457
+ COMPILER_INDEX_STORE_ENABLE=NO \
458
+ -destination 'platform=iOS Simulator,name=${{ matrix.device }}' \
459
+ ONLY_ACTIVE_ARCH=yes \
460
+ -sdk 'iphonesimulator${{ matrix.runtime }}' \
461
+ -derivedDataPath "$derivedData" \
462
+ build
463
+
464
+ - name : Start Appium Server
465
+ working-directory : test/e2e
466
+ run : yarn run appium --log-timestamp --log-no-colors --log appium.${{ matrix.platform }}.log &
467
+
468
+ # Wait until the Appium server starts.
469
+ - name : Check Appium Server
470
+ uses : nick-fields/retry@943e742917ac94714d2f408a0e8320f2d1fcafcd # pin@v2
471
+ with :
472
+ timeout_seconds : 60
473
+ max_attempts : 10
474
+ command : curl --output /dev/null --silent --head --fail http://127.0.0.1:4723/sessions
475
+
476
+ - name : Run tests on Android
477
+ if : ${{ matrix.platform == 'android' }}
478
+ env :
479
+ APPIUM_APP : ./app-release.apk
480
+ uses : reactivecircus/android-emulator-runner@50986b1464923454c95e261820bc626f38490ec0 # pin@v2
481
+ with :
482
+ working-directory : test/e2e
483
+ api-level : 29
484
+ emulator-options : >
485
+ -accel on
486
+ -no-snapshot
487
+ -gpu swiftshader_indirect
488
+ -noaudio
489
+ -no-boot-anim
490
+ -camera-back none
491
+ -camera-front none
492
+ -timezone US/Pacific
493
+ script : |
494
+ # Collect logs
495
+ adb logcat '*:D' 2>&1 >adb.log &
496
+ adb devices -l
497
+
498
+ yarn test --verbose
499
+
500
+ - name : Run tests on iOS
501
+ if : ${{ matrix.platform == 'ios' }}
502
+ working-directory : test/e2e
503
+ env :
504
+ APPIUM_APP : ./RnDiffApp.app
505
+ APPIUM_DERIVED_DATA : DerivedData
506
+ run : yarn test --verbose
507
+
508
+ - name : Upload logs
509
+ if : ${{ always() }}
510
+ uses : actions/upload-artifact@v3
511
+ with :
512
+ name : ${{ matrix.rn-version }}-${{ matrix.rn-architecture }}-${{ matrix.platform }}-${{ matrix.build-type }}-logs
513
+ path : |
514
+ test/e2e/*.log
515
+ test/e2e/*.png
0 commit comments