-
Notifications
You must be signed in to change notification settings - Fork 41
457 lines (378 loc) · 16.8 KB
/
main.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
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
name: CI
on:
pull_request:
types:
- opened
- synchronize
permissions: {}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
env:
flutter: '3.x'
ios-simulator: iPhone 15
java: 11
jobs:
authorize:
name: Authorize
environment: ${{ github.event.pull_request.head.repo.fork && 'external' || 'internal' }}
runs-on: ubuntu-latest
steps:
- run: true
analyze-auth0_flutter:
name: Analyze auth0_flutter Flutter package
needs: authorize
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- name: Install Flutter
uses: subosito/flutter-action@2783a3f08e1baf891508463f8c6653c258246225
with:
flutter-version: ${{ env.flutter }}
channel: stable
cache: true
- name: Add example/.env
working-directory: auth0_flutter
run: cp example/.env.example example/.env
- name: Analize auth0_flutter package
working-directory: auth0_flutter
run: flutter analyze
analyze-auth0_flutter_platform_interface:
name: Analyze auth0_flutter_platform_interface Flutter package
needs: authorize
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- name: Install Flutter
uses: subosito/flutter-action@2783a3f08e1baf891508463f8c6653c258246225
with:
flutter-version: ${{ env.flutter }}
channel: stable
cache: true
- name: Analize auth0_flutter_platform_interface package
working-directory: auth0_flutter_platform_interface
run: flutter analyze
test-auth0_flutter:
name: Test auth0_flutter Flutter package
needs: authorize
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- name: Install Flutter
uses: subosito/flutter-action@2783a3f08e1baf891508463f8c6653c258246225
with:
flutter-version: ${{ env.flutter }}
channel: stable
cache: true
- name: Add example/.env
working-directory: auth0_flutter
run: cp example/.env.example example/.env
- name: Test auth0_flutter package
working-directory: auth0_flutter
run: |
flutter test --tags browser --platform chrome
flutter test --coverage --exclude-tags browser
- name: Upload coverage report
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32
with:
name: auth0_flutter coverage
path: auth0_flutter/coverage/lcov.info
test-auth0_flutter_platform_interface:
name: Test auth0_flutter_platform_interface Flutter package
needs: authorize
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- name: Install Flutter
uses: subosito/flutter-action@2783a3f08e1baf891508463f8c6653c258246225
with:
flutter-version: ${{ env.flutter }}
channel: stable
cache: true
- name: Test auth0_flutter_platform_interface package
working-directory: auth0_flutter_platform_interface
run: flutter test --coverage
- name: Upload coverage report
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32
with:
name: auth0_flutter_platform_interface coverage
path: auth0_flutter_platform_interface/coverage/lcov.info
test-ios-unit:
name: Run native iOS unit tests using Xcode ${{ matrix.xcode }}
needs: authorize
runs-on: macos-13
environment: ${{ github.event.pull_request.head.repo.fork && 'external' || 'internal' }}
strategy:
matrix:
xcode:
- '15.0.1'
env:
platform: iOS
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- name: Set up environment
uses: ./.github/actions/setup-darwin
with:
platform: ${{ env.platform }}
flutter: ${{ env.flutter }}
xcode: ${{ matrix.xcode }}
auth0-domain: ${{ vars.AUTH0_DOMAIN }}
auth0-client-id: ${{ vars.AUTH0_CLIENT_ID }}
- name: Run iOS unit tests
uses: ./.github/actions/unit-tests-darwin
with:
platform: ${{ env.platform }}
destination: ${{ format('{0}{1}', 'platform=iOS Simulator,name=', env.ios-simulator) }}
- name: Convert coverage report
working-directory: auth0_flutter/example/ios
run: bundle exec slather coverage -x --scheme Runner Runner.xcodeproj
- name: Upload coverage report
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32
with:
name: iOS coverage
path: auth0_flutter/example/ios/cobertura
test-ios-smoke:
name: Run native iOS smoke tests using Xcode ${{ matrix.xcode }}
needs: authorize
runs-on: macos-latest
environment: ${{ github.event.pull_request.head.repo.fork && 'external' || 'internal' }}
env:
platform: iOS
USER_EMAIL: ${{ secrets.USER_EMAIL }}
USER_PASSWORD: ${{ secrets.USER_PASSWORD }}
strategy:
matrix:
xcode:
- '14.2'
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- name: Set up environment
uses: ./.github/actions/setup-darwin
with:
platform: ${{ env.platform }}
flutter: ${{ env.flutter }}
xcode: ${{ matrix.xcode }}
auth0-domain: ${{ vars.AUTH0_DOMAIN }}
auth0-client-id: ${{ vars.AUTH0_CLIENT_ID }}
- name: Run iOS smoke tests
if: ${{ github.event.pull_request.head.repo.fork == false }}
working-directory: auth0_flutter/example/ios
run: |
defaults write com.apple.iphonesimulator ConnectHardwareKeyboard 0
xcodebuild test -scheme Runner -workspace Runner.xcworkspace -destination 'platform=iOS Simulator,name=iPhone 14' -resultBundlePath smoke-tests.xcresult -only-testing:RunnerUITests
- name: Upload xcresult bundles
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32
if: ${{ failure() }}
with:
name: 'iOS xcresult bundles (smoke tests)'
path: 'auth0_flutter/example/ios/*.xcresult'
test-macos-unit:
name: Run native macOS unit tests using Xcode ${{ matrix.xcode }}
needs: authorize
runs-on: macos-13
environment: ${{ github.event.pull_request.head.repo.fork && 'external' || 'internal' }}
strategy:
matrix:
xcode:
- '15.0.1'
env:
platform: macOS
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- name: Set up environment
uses: ./.github/actions/setup-darwin
with:
platform: ${{ env.platform }}
flutter: ${{ env.flutter }}
xcode: ${{ matrix.xcode }}
auth0-domain: ${{ vars.AUTH0_DOMAIN }}
auth0-client-id: ${{ vars.AUTH0_CLIENT_ID }}
- name: Build macOS example app
working-directory: auth0_flutter/example
run: flutter build macos --debug
- name: Run macOS unit tests
uses: ./.github/actions/unit-tests-darwin
with:
platform: ${{ env.platform }}
destination: platform=macOS,arch=x86_64
test-android-unit:
name: Run native Android unit tests
needs: authorize
runs-on: ubuntu-latest
environment: ${{ github.event.pull_request.head.repo.fork && 'external' || 'internal' }}
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- name: Set up environment
uses: ./.github/actions/setup-android
with:
flutter: ${{ env.flutter }}
java: ${{ env.java }}
auth0-domain: ${{ vars.AUTH0_DOMAIN }}
auth0-client-id: ${{ vars.AUTH0_CLIENT_ID }}
- name: Build Android example app
working-directory: auth0_flutter/example
run: flutter build apk --split-per-abi
- name: Run Android unit tests
working-directory: auth0_flutter/example/android
run: ./gradlew koverXmlReportDebug
- name: Upload coverage report
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32
with:
name: Android coverage
path: auth0_flutter/example/build/app/coverage.xml
- name: Upload test results
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32
if: ${{ failure() }}
with:
name: Test results
path: 'auth0_flutter/example/build/app/reports/androidTests/*.xml'
# test-android-smoke:
# name: Run native Android smoke tests using API-level ${{ matrix.android-api }}
# needs: authorize
# runs-on: macos-latest-xl
# environment: ${{ github.event.pull_request.head.repo.fork && 'external' || 'internal' }}
# env:
# USER_EMAIL: ${{ secrets.USER_EMAIL }}
# USER_PASSWORD: ${{ secrets.USER_PASSWORD }}
# ANDROID_EMULATOR_WAIT_TIME_BEFORE_KILL: 50
# strategy:
# matrix:
# android-api:
# - 32
# steps:
# - name: Checkout
# uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
# - name: Gradle cache
# uses: gradle/gradle-build-action@ef76a971e2fa3f867b617efd72f2fbd72cf6f8bc
# - name: AVD cache
# uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84
# id: avd-cache
# with:
# path: |
# ~/.android/avd/*
# ~/.android/adb*
# key: avd-${{ matrix.android-api }}
# - name: Set up environment
# uses: ./.github/actions/setup-android
# with:
# flutter: ${{ env.flutter }}
# java: ${{ env.java }}
# auth0-domain: ${{ vars.AUTH0_DOMAIN }}
# auth0-client-id: ${{ vars.AUTH0_CLIENT_ID }}
# - name: Build Android example app
# working-directory: auth0_flutter/example
# run: flutter build apk --split-per-abi
# env:
# AUTH0_DOMAIN: ${{ vars.AUTH0_DOMAIN }}
# USER_EMAIL: ${{ vars.USER_EMAIL }}
# USER_PASSWORD: ${{ vars.USER_PASSWORD }}
# - name: Set up Appium tests
# working-directory: appium-test
# run: npm install
# - name: Set up Appium driver
# run: npx --yes appium@next driver install uiautomator2
# - name: Start Appium server
# run: npx --yes appium@next & # Appium recommends this until v2 is released
# - name: Create AVD and generate snapshot for caching
# if: steps.avd-cache.outputs.cache-hit != 'true'
# uses: reactivecircus/android-emulator-runner@d94c3fbe4fe6a29e4a5ba47c12fb47677c73656b
# with:
# api-level: ${{ matrix.android-api }}
# target: playstore
# arch: x86_64
# profile: 5.4in FWVGA
# force-avd-creation: false
# emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
# disable-animations: false
# script: echo "Generated AVD snapshot for caching."
# - name: Run Appium tests
# uses: reactivecircus/android-emulator-runner@d94c3fbe4fe6a29e4a5ba47c12fb47677c73656b
# with:
# api-level: ${{ matrix.android-api }}
# target: playstore
# arch: x86_64
# profile: 5.4in FWVGA
# ram-size: 10240M
# heap-size: 4096M
# force-avd-creation: false
# emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
# disable-animations: true
# script: |
# adb shell pm clear com.android.chrome
# adb shell am set-debug-app --persistent com.android.chrome
# adb shell 'echo "chrome --disable-fre --no-default-browser-check --no-first-run" > /data/local/tmp/chrome-command-line'
# adb emu screenrecord start --time-limit 300 ./recording_video.webm
# adb shell settings put system pointer_location 1
# USER_EMAIL=$USER_EMAIL USER_PASSWORD=$USER_PASSWORD node appium-test/test.js
# - name: Upload recording
# uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32
# if: ${{ failure() }}
# with:
# name: 'Android - smoke tests recording'
# path: recording_video.webm
# - name: Upload APK
# uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32
# if: ${{ failure() }}
# with:
# name: 'Android - APK'
# path: ./auth0_flutter/example/build/app/outputs/flutter-apk/app-arm64-v8a-release.apk
upload-coverage:
name: Upload coverage reports
runs-on: ubuntu-latest
needs: [
test-auth0_flutter,
test-auth0_flutter_platform_interface,
test-ios-unit,
test-android-unit
]
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a
with:
name: auth0_flutter coverage
path: coverage/auth0_flutter
- uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a
with:
name: auth0_flutter_platform_interface coverage
path: coverage/auth0_flutter_platform_interface
- uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a
with:
name: iOS coverage
path: coverage/ios
- uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a
with:
name: Android coverage
path: coverage/android
- name: Upload coverage report for auth0_flutter
uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d
with:
name: Auth0 Flutter
flags: auth0_flutter
directory: coverage/auth0_flutter
- name: Upload coverage report for auth0_flutter_platform_interface
uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d
with:
name: Auth0 Flutter
flags: auth0_flutter_platform_interface
directory: coverage/auth0_flutter_platform_interface
- name: Upload coverage report for iOS
uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d
with:
name: Auth0 Flutter
flags: auth0_flutter_ios
directory: coverage/ios
- name: Upload coverage report for Android
uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d
with:
name: Auth0 Flutter
flags: auth0_flutter_android
directory: coverage/android