Repository navigation
Expand file tree
/
Copy pathmelos.yaml
More file actions
551 lines (481 loc) · 20.9 KB
/
Copy pathmelos.yaml
File metadata and controls
551 lines (481 loc) · 20.9 KB
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
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
name: datadog_flutter
packages:
- packages/*
- packages/datadog_flutter_plugin/*
- packages/*/example
- packages/*/integration_test_app
- packages/*/e2e_test_app
- packages/datadog_flutter_plugin/*/example
- packages/datadog_flutter_plugin/*/integration_test_app
- packages/datadog_flutter_plugin/*/e2e_test_app
- examples/*
- examples/native-hybrid-app/flutter_module
- test_apps/*
- tools/openfeature_conformance
- tools/sr_models_generator
- tools/android_workspace
scripts:
setup:android:
run: cd tools/android_workspace && flutter build apk --config-only
description: Configure the shared Android Studio workspace after bootstrapping.
build:
run: melos build:ios && melos build:android && melos build:web
# Checks Swift Package Manager once for every app, then builds each one.
build:ios:
run: >-
dart $MELOS_ROOT_PATH/tools/ci/bin/check_swift_package_manager.dart --app-subdir example $(melos list --parsable) &&
melos exec -c 1 -- "cd example && flutter build ios --release --no-codesign"
packageFilters:
dirExists: example/ios
# Deletes the SwiftPM checkout Flutter keeps in build/ios and the Package.resolved files,
# so branch dependencies such as dd-sdk-ios `develop` resolve to the latest commit.
reset:ios_packages:
exec:
concurrency: 1
run: >-
rm -rf build/ios/SourcePackages
ios/Runner.xcworkspace/xcshareddata/swiftpm/Package.resolved
ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
description: |
Reset resolved SwiftPM packages in every iOS app.
packageFilters:
dirExists: ios/Runner.xcodeproj
# Checks Swift Package Manager once for every app, then builds each one.
build:macos:
run: >-
dart $MELOS_ROOT_PATH/tools/ci/bin/check_swift_package_manager.dart --app-subdir example $(melos list --parsable) &&
melos exec -c 1 -- "cd example && flutter clean && flutter build macos --release"
packageFilters:
dirExists: example/macos
# `rm` isn't a cmd.exe builtin and the Windows toolchain image doesn't provide it;
# `del` isn't a bash command either, so try both and let the `||` fallback pick the
# one available on the current shell.
full_clean:
exec:
concurrency: 1
run:
flutter clean &&
(rm pubspec.lock || del pubspec.lock)
# Fresh Tart VMs have nothing for `flutter clean` to remove, so only the lockfile
# needs to go.
delete_pubspec_lock:
exec:
concurrency: 1
run: rm -f pubspec.lock
build:android:
exec:
concurrency: 1
run: cd example && flutter build apk --release
packageFilters:
dirExists: example/android
build:web:
exec:
concurrency: 1
run: cd example && flutter build web
packageFilters:
dirExists: example/web
build:windows:
exec:
concurrency: 1
run: cd example && flutter build windows --release
packageFilters:
dirExists: example/windows
build:linux:
exec:
concurrency: 1
run: cd example && flutter build linux --release
packageFilters:
dirExists: example/linux
dartfmt_check:
exec: dart format --output=none --set-exit-if-changed .
dartfmt:
exec: dart format .
generate:sr_models:
run: cd tools/sr_models_generator && dart run sr_models_generator && cd ../../packages/datadog_session_replay && dart run build_runner build --delete-conflicting-outputs
description: |
Generate the Session Replay models from the rum-events-format commit pinned in tools/sr_models_generator/sr_models_generator.yaml, and their JSON code with build_runner.
generate:sr_models:check:
run: >-
cd tools/sr_models_generator && dart run sr_models_generator --check &&
cd ../../packages/datadog_session_replay &&
dart run build_runner build --delete-conflicting-outputs &&
if [ -n "$(git status --porcelain -- lib/src/generated)" ]; then
git status --short -- lib/src/generated;
echo 'The JSON code of the generated models is not up to date. Run melos run generate:sr_models.';
exit 1;
fi
description: |
Fail if the generated Session Replay models, or their JSON code generated by build_runner, are not up to date with the pinned rum-events-format commit.
generate:sr_models:update:
run: cd tools/sr_models_generator && dart run sr_models_generator --ref master && cd ../../packages/datadog_session_replay && dart run build_runner build --delete-conflicting-outputs
description: |
Pin the latest rum-events-format master commit and generate the Session Replay models from its schemas.
lint_fix:
run: melos lint_fix:ios && melos lint_fix:android
lint_fix:ios:
exec:
concurrency: 1
run: swiftlint --fix
description: |
Run swiftlint --fix
packageFilters:
dirExists:
- ios
- darwin
lint_fix:android:
exec:
concurrency: 1
run:
cd example/android
./gradlew ktlintFormat
description: |
Run ktlintFormat
packageFilters:
dirExists: example/android
analyze:
run: melos analyze:dart && melos analyze:android && melos analyze:ios
analyze:dart:
exec: dart analyze .
description: |
Run `dart analyze` in all packages
packageFilters:
ignore:
- 'stress_test'
- 'test_app'
analyze:android:
exec:
concurrency: 1
run: |
cd example/android
./gradlew --console=plain ktlintCheck detekt
packageFilters:
dirExists: 'example/android/buildscripts'
ignore:
- "*example*"
- "*integration_test_app*"
- "*e2e_test_app*"
analyze:ios:
exec: (test -d darwin && cd darwin || cd ios) && swiftlint
packageFilters:
dirExists:
- ios
- darwin
ignore:
- "*example*"
- "*integration_test_app*"
- "*e2e_test_app*"
unit_test:all:
run: melos unit_test:flutter && melos unit_test:ios && melos unit_test:android && melos unit_test:web
# Packages without a Flutter dependency run `dart test`.
unit_test:flutter:
run:
mkdir -p .build/test-results &&
melos exec -c 1 --flutter --dir-exists=test --ignore=datadog_flutter_plugin_web -- "dart $MELOS_ROOT_PATH/tools/ci/bin/run_with_junit.dart --output $MELOS_ROOT_PATH/.build/test-results/\$MELOS_PACKAGE_NAME_unit.xml -- flutter test --machine" &&
melos exec -c 1 --no-flutter --dir-exists=test -- "dart $MELOS_ROOT_PATH/tools/ci/bin/run_with_junit.dart --output $MELOS_ROOT_PATH/.build/test-results/\$MELOS_PACKAGE_NAME_unit.xml -- dart test --reporter json"
unit_test:windows:
run:
melos exec -c 1 --flutter --dir-exists=test --ignore=datadog_flutter_plugin_web -- "dart $MELOS_ROOT_PATH/tools/ci/bin/run_with_junit.dart --output $MELOS_ROOT_PATH/.build/test-results/\$MELOS_PACKAGE_NAME_unit.xml -- flutter test --machine" &&
melos exec -c 1 --no-flutter --dir-exists=test -- "dart $MELOS_ROOT_PATH/tools/ci/bin/run_with_junit.dart --output $MELOS_ROOT_PATH/.build/test-results/\$MELOS_PACKAGE_NAME_unit.xml -- dart test --reporter json"
unit_test:linux:
run:
melos exec -c 1 --flutter --dir-exists=test --ignore=datadog_flutter_plugin_web -- "dart $MELOS_ROOT_PATH/tools/ci/bin/run_with_junit.dart --output $MELOS_ROOT_PATH/.build/test-results/\$MELOS_PACKAGE_NAME_unit.xml -- flutter test --machine" &&
melos exec -c 1 --no-flutter --dir-exists=test -- "dart $MELOS_ROOT_PATH/tools/ci/bin/run_with_junit.dart --output $MELOS_ROOT_PATH/.build/test-results/\$MELOS_PACKAGE_NAME_unit.xml -- dart test --reporter json"
golden_test:flutter:
exec:
concurrency: 1
run:
cd example &&
mkdir -p "$MELOS_ROOT_PATH/.build/test-results" &&
set -e -o pipefail &&
flutter test golden_test --machine | tojunit --output "$MELOS_ROOT_PATH/.build/test-results/\$MELOS_PACKAGE_NAME_golden.xml"
packageFilters:
dirExists: 'example/golden_test'
unit_test:web:
run:
mkdir -p $MELOS_ROOT_PATH/.build/test-results &&
melos exec -c 1 -- "dart $MELOS_ROOT_PATH/tools/ci/bin/run_with_junit.dart --output $MELOS_ROOT_PATH/.build/test-results/\$MELOS_PACKAGE_NAME_unit_web.xml -- flutter test --machine --platform chrome" &&
melos exec -c 1 -- "dart $MELOS_ROOT_PATH/tools/ci/bin/run_with_junit.dart --output $MELOS_ROOT_PATH/.build/test-results/\$MELOS_PACKAGE_NAME_unit_web_wasm.xml -- flutter test --machine --platform chrome --wasm"
packageFilters:
scope:
- 'datadog_flutter_plugin'
- 'datadog_flutter_plugin_web'
- 'datadog_flags_flutter'
# Test all browser-compatible core and conformance tests on both compilers.
unit_test:openfeature-web:
run:
mkdir -p $MELOS_ROOT_PATH/.build/test-results &&
melos exec -c 1 -- "dart $MELOS_ROOT_PATH/tools/ci/bin/run_with_junit.dart --output $MELOS_ROOT_PATH/.build/test-results/\$MELOS_PACKAGE_NAME_unit_web.xml -- dart test --reporter json --platform chrome" &&
melos exec -c 1 -- "dart $MELOS_ROOT_PATH/tools/ci/bin/run_with_junit.dart --output $MELOS_ROOT_PATH/.build/test-results/\$MELOS_PACKAGE_NAME_unit_web_wasm.xml -- dart test --reporter json --platform chrome --compiler dart2wasm"
packageFilters:
scope:
- 'datadog_flags'
- 'datadog_openfeature_conformance'
unit_test:ios:
exec:
concurrency: 1
run: dart $MELOS_ROOT_PATH/tools/ci/bin/xcode_unit_tests.dart --platform ios --destination "platform=iOS Simulator,name=$IOS_SIMULATOR,OS=latest"
packageFilters:
dirExists: 'example/ios'
# TODO: These packages should probably have platform unit tests
ignore:
- 'datadog_inappwebview_tracking'
- 'datadog_tracking_http_client'
# iOS unit tests moved to datadog_flutter_plugin_ios
- 'datadog_flutter_plugin'
unit_test:macos:
exec:
concurrency: 1
run: dart $MELOS_ROOT_PATH/tools/ci/bin/xcode_unit_tests.dart --platform macos --destination "platform=macOS"
packageFilters:
dirExists: 'example/macos'
unit_test:android:
exec:
concurrency: 1
run: cd example/android && ./gradlew --stacktrace --console=plain test
packageFilters:
dirExists:
- 'android'
- 'example/android'
ignore:
- 'datadog_inappwebview_tracking'
integration_test:ios:
run: melos integration_test:ios:main && melos integration_test:ios:other
integration_test:ios:other:
exec:
concurrency: 1
run: |
mkdir -p $MELOS_ROOT_PATH/.build/test-results
cd example
dart $MELOS_ROOT_PATH/tools/ci/bin/integration_tests.dart --platform ios --output $MELOS_ROOT_PATH/.build/test-results
packageFilters:
dirExists: 'example/integration_test'
ignore:
- 'datadog_flutter_plugin'
# Packages with a dedicated integration test app run through this target.
# The other target discovers integration tests in package examples.
integration_test:ios:main:
exec:
concurrency: 1
run: |
mkdir -p $MELOS_ROOT_PATH/.build/test-results
cd integration_test_app
dart $MELOS_ROOT_PATH/tools/ci/bin/integration_tests.dart --platform ios --output $MELOS_ROOT_PATH/.build/test-results
packageFilters:
dirExists: 'integration_test_app/integration_test'
integration_test:macos:
run: melos integration_test:macos:main
# Packages with a dedicated integration test app run through this target.
# The other targets discover integration tests in package examples.
# Desktop platforms can't run the whole integration_test directory in one `flutter test`
# invocation, so this uses tools/ci/bin/integration_tests.dart to run each
# test file individually, same as integration_test:windows:main.
integration_test:macos:main:
exec:
concurrency: 1
run: |
cd integration_test_app
dart $MELOS_ROOT_PATH/tools/ci/bin/integration_tests.dart --output $MELOS_ROOT_PATH/.build/test-results
packageFilters:
dirExists: 'integration_test_app/integration_test'
integration_test:android:
run: melos integration_test:android:main && melos integration_test:android:other
integration_test:android:other:
exec:
concurrency: 1
run: |
mkdir -p $MELOS_ROOT_PATH/.build/test-results
cd example
dart $MELOS_ROOT_PATH/tools/ci/bin/integration_tests.dart --platform android --output $MELOS_ROOT_PATH/.build/test-results
packageFilters:
dirExists: 'example/integration_test'
ignore: 'datadog_flutter_plugin'
# Packages with a dedicated integration test app run through this target.
# The other target discovers integration tests in package examples.
integration_test:android:main:
exec:
concurrency: 1
run: |
mkdir -p $MELOS_ROOT_PATH/.build/test-results
cd integration_test_app
dart $MELOS_ROOT_PATH/tools/ci/bin/integration_tests.dart --platform android --output $MELOS_ROOT_PATH/.build/test-results
packageFilters:
dirExists: 'integration_test_app/integration_test'
integration_test:windows:
run: melos integration_test:windows:build && melos verify:ffi_bindings && melos integration_test:windows:tests
# Only exists to populate the CMake FetchContent headers that
# verify:ffi_bindings regenerates against. Scoped to the desktop plugin's
# example because that is the tree ffigen.yaml points at, and built debug
# rather than release: `melos build:windows` would build four examples into a
# separate release tree, none of which the integration tests below reuse.
integration_test:windows:build:
exec:
concurrency: 1
run: cd example && flutter build windows --debug
packageFilters:
scope: 'datadog_flutter_plugin_desktop'
integration_test:windows:tests:
run: melos integration_test:windows:main && melos integration_test:windows:other
# Desktop platforms can't run the whole integration_test directory in one `flutter test`
# invocation, so this uses tools/ci/bin/integration_tests.dart to run each
# test file individually, same idea as web's per-file `flutter drive` runner.
integration_test:windows:other:
exec:
concurrency: 1
run: cd example && dart $MELOS_ROOT_PATH/tools/ci/bin/integration_tests.dart --output $MELOS_ROOT_PATH/.build/test-results
packageFilters:
dirExists:
- 'example/integration_test'
- 'example/windows'
ignore:
- 'datadog_flutter_plugin'
# Packages with a dedicated integration test app run through this target.
# The other target discovers integration tests in package examples.
integration_test:windows:main:
exec:
concurrency: 1
run: cd integration_test_app && dart $MELOS_ROOT_PATH/tools/ci/bin/integration_tests.dart --output $MELOS_ROOT_PATH/.build/test-results
packageFilters:
dirExists: 'integration_test_app/integration_test'
# Regenerates datadog_flutter_plugin_desktop's ffigen bindings and fails if the
# result differs from what is committed. dd-sdk-cpp is pulled by CMake
# FetchContent, so its C API can move without anything in this repo changing.
# Drift is not a compile error: Dart allocates sizeOf<T>() bytes and the C SDK
# writes sizeof(struct T) into them, so a struct that grew upstream shows up as
# heap corruption in an unrelated test instead. Desktop-only, and requires a
# desktop build to have populated the FetchContent headers first.
verify:ffi_bindings:
run: dart $MELOS_ROOT_PATH/tools/ci/bin/verify_ffi_bindings.dart
# Regenerates datadog_flutter_plugin_desktop's ffigen bindings unconditionally
# (see verify:ffi_bindings for why they can drift). Requires a desktop build
# to have populated the FetchContent headers first.
generate:ffi_bindings:
run: dart $MELOS_ROOT_PATH/tools/ci/bin/verify_ffi_bindings.dart --write
# Regenerates every package's jnigen bindings and fails if the result
# differs from what is committed. jnigen resolves its own Android classpath
# (via `flutter build apk --config-only` against each package's
# android_example), so unlike verify:ffi_bindings this needs no separate
# build step, just an Android SDK on PATH. Drift here can also mean the
# installed jnigen version moved out from under the checked-in output --
# see tools/ci/bin/verify_jni_bindings.dart for why that matters on its own.
verify:jni_bindings:
run: dart $MELOS_ROOT_PATH/tools/ci/bin/verify_jni_bindings.dart
# Regenerates every package's jnigen bindings unconditionally.
generate:jni_bindings:
run: dart $MELOS_ROOT_PATH/tools/ci/bin/verify_jni_bindings.dart --write
# Regenerates datadog_session_replay's iOS FFI bridge (a Swift-emitted
# bridging header, plus the ffigen bindings and Objective-C shim generated
# from it) and fails if the result differs from what is committed. Needs
# only a Swift toolchain -- `swift build` resolves its own dependencies and
# is expected to fail past header emission (see
# tools/ci/bin/verify_ios_ffi_bindings.dart), so no app build is required.
verify:ios_ffi_bindings:
run: dart $MELOS_ROOT_PATH/tools/ci/bin/verify_ios_ffi_bindings.dart
# Regenerates datadog_session_replay's iOS FFI bridge unconditionally.
generate:ios_ffi_bindings:
run: dart $MELOS_ROOT_PATH/tools/ci/bin/verify_ios_ffi_bindings.dart --write
integration_test:linux:
run: melos integration_test:linux:build && melos verify:ffi_bindings && melos integration_test:linux:tests
# See integration_test:windows:build -- populates the FetchContent headers for
# verify:ffi_bindings, nothing more.
integration_test:linux:build:
exec:
concurrency: 1
run: cd example && flutter build linux --debug
packageFilters:
scope: 'datadog_flutter_plugin_desktop'
integration_test:linux:tests:
run: melos integration_test:linux:main && melos integration_test:linux:other
# Desktop platforms can't run the whole integration_test directory in one `flutter test`
# invocation, so this uses tools/ci/bin/integration_tests.dart to run each
# test file individually, same idea as web's per-file `flutter drive` runner.
integration_test:linux:other:
exec:
concurrency: 1
run: |
cd example
dart $MELOS_ROOT_PATH/tools/ci/bin/integration_tests.dart --output $MELOS_ROOT_PATH/.build/test-results --verbose
packageFilters:
dirExists:
- 'example/integration_test'
- 'example/linux'
ignore:
- 'datadog_flutter_plugin'
# Packages with a dedicated integration test app run through this target.
# The other target discovers integration tests in package examples.
integration_test:linux:main:
exec:
concurrency: 1
run: |
cd integration_test_app
dart $MELOS_ROOT_PATH/tools/ci/bin/integration_tests.dart --output $MELOS_ROOT_PATH/.build/test-results --verbose
packageFilters:
dirExists: 'integration_test_app/integration_test'
integration_test:web:
run: melos integration_test:web:main && melos integration_test:web:other
integration_test:web:main:
exec:
concurrency: 1
run: |
cd integration_test_app
dart $MELOS_ROOT_PATH/tools/ci/bin/web_integration_tests.dart --compiler ${WEB_COMPILER:-all}
packageFilters:
dirExists: 'integration_test_app/integration_test'
integration_test:web:other:
exec:
concurrency: 1
run: |
cd example
dart $MELOS_ROOT_PATH/tools/ci/bin/web_integration_tests.dart --compiler ${WEB_COMPILER:-all}
packageFilters:
scope: 'datadog_tracking_http_client'
e2e_tests:ios:
exec: |
export DD_SDK_COMPILED_FOR_TESTING=1
cd e2e_test_app
dart $MELOS_ROOT_PATH/tools/ci/bin/integration_tests.dart --platform ios --output $MELOS_ROOT_PATH/.build/test-results
packageFilters:
scope: 'datadog_flutter_plugin'
e2e_tests:android:
exec: |
cd e2e_test_app
dart $MELOS_ROOT_PATH/tools/ci/bin/integration_tests.dart --platform android --output $MELOS_ROOT_PATH/.build/test-results
packageFilters:
scope: 'datadog_flutter_plugin'
prepare:
run: melos pub:get && melos generate_env && melos generate_env:e2e
description: |
Run `flutter pub get` on all packages and generate `dd.env` files for all package examples
pub:get:
exec:
concurrency: 1
run: flutter pub get
build_runner:
exec:
concurrency: 1
run: dart run build_runner build --delete-conflicting-outputs
packageFilters:
dependsOn: build_runner
generate_env:
exec: dart $MELOS_ROOT_PATH/tools/ci/bin/generate_env.dart
packageFilters:
scope:
- "*example*"
- "*integration_test_app*"
- "test_app"
generate_env:e2e:
exec: dart $MELOS_ROOT_PATH/tools/ci/bin/generate_env.dart --e2e
packageFilters:
scope:
- "*e2e_test_app*"
pin:ios:
exec:
concurrency: 1
run: dart $MELOS_ROOT_PATH/tools/releaser/bin/pinner.dart --platform ios --package \$MELOS_PACKAGE_PATH
packageFilters:
scope: datadog_flutter_plugin_ios
pin:android:
exec:
concurrency: 1
run: dart $MELOS_ROOT_PATH/tools/releaser/bin/pinner.dart --platform android --package \$MELOS_PACKAGE_PATH
packageFilters:
fileExists: "android/build.gradle"