forked from DataDog/dd-sdk-flutter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bitrise.yml
342 lines (308 loc) · 10.8 KB
/
bitrise.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
---
format_version: 11
default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git
project_type: flutter
workflows:
push_to_pull_request:
description: |-
This workflow is triggered on starting new PR or pushing new changes to existing PRs.
By default, it doesn't run any test phases, but this behavior is overwritten in `choose_workflows.py` when:
- one or more `DD_OVERWRITE_RUN_(phase)_TESTS` ENVs are passed to the current CI job:
- DD_OVERRIDE_RUN_UNIT_TESTS='1' to run unit tests phase
- DD_OVERRIDE_RUN_INTEGRATION_TESTS='1' to run integration tests phase
- a phase is selected on the checklist in the PR description,
- the PR changes a file which matches phase filter (e.g. changing a file in `packages/*` will trigger unit tests phase)
envs:
- DD_RUN_UNIT_TESTS: '0'
- DD_RUN_INTEGRATION_TESTS: '0'
after_run:
- setup
- run_conditioned_workflows
- _deploy_artifacts
push_to_develop_or_main:
envs:
- FLUTTER_VERSION: stable
- DD_RUN_UNIT_TESTS: '1'
- DD_RUN_INTEGRATION_TESTS: '1'
after_run:
- setup
- run_conditioned_workflows
- _deploy_artifacts
check_min_supported:
description: |-
This workflow is run nightly to make sure current packages work with the minimum
supported version of Flutter.
envs:
- FLUTTER_VERSION: 2.10.5
- DD_RUN_UNIT_TESTS: '1'
- DD_RUN_INTEGRATION_TESTS: '1'
after_run:
- setup
- run_conditioned_workflows
- _deploy_artifacts
check_beta:
envs:
- FLUTTER_VERSION: beta
- DD_RUN_UNIT_TESTS: '1'
- DD_RUN_INTEGRATION_TESTS: '1'
after_run:
- setup
- run_conditioned_workflows
- _deploy_artifacts
nightly_e2e:
envs:
- FLUTTER_VERSION: stable
- DD_RUN_INTEGRATION_TESTS: '1'
before_run:
- setup
- _start_android_emulator
- nightly_ios
- nightly_android
setup:
before_run:
- _flutter_install
- _pub_get
steps:
- script:
title: Generate env files
inputs:
- content: |-
#!/usr/bin/env bash
set -e
./generate_env.sh
pushd packages/datadog_common_test
flutter pub run build_runner build
popd
run_conditioned_workflows:
steps:
- script:
title: Choose which workflows to run
inputs:
- content: |-
#!/usr/bin/env bash
cd tools/ci && make
# The `choose_workflows.py` inspects current ENV variables and Pull Request metadata (if running in PR)
# and decides on which from the workflows in `after_run` should be ran. Workflows are opted-in
# by modifying `DD_RUN_*` ENV variables with `envman` (ref.: https://github.com/bitrise-io/envman).
python3 choose_workflows.py
after_run:
- _start_android_emulator
- check_dependencies
- analyze
- build
- unit_test
- integration_test
_flutter_install:
steps:
- flutter-installer@0:
inputs:
- version: $FLUTTER_VERSION
_prepare_gradle_wrapper:
steps:
- script:
title: Get gradle wrapper
inputs:
- content: |-
#!/usr/bin/env bash
set -e
gradle wrapper
- working_dir: "$BITRISE_SOURCE_DIR/packages/datadog_flutter_plugin/example/android"
_launch_ios_simulator:
steps:
- script:
run_if: '{{enveq "DD_RUN_INTEGRATION_TESTS" "1"}}'
title: Launch iOS Simulator
inputs:
- content: |-
#!/usr/bin/env bash
set -e
flutter emulators --launch apple_ios_simulator
# Sleep while the simulator warms a bit
sleep 5
_start_android_emulator:
steps:
- avd-manager@1:
run_if: '{{enveq "DD_RUN_INTEGRATION_TESTS" "1"}}'
inputs:
- api_level: '30'
- wait-for-android-emulator@1:
run_if: '{{enveq "DD_RUN_INTEGRATION_TESTS" "1"}}'
_deploy_artifacts:
steps:
- deploy-to-bitrise-io: {}
_pub_get:
steps:
- script:
title: Run pub get in all projects
inputs:
- content: |-
#!/usr/bin/env bash
set -e
for d in packages/*/ ; do
pushd "$d"
if [ ! -f "pubspec.yaml" ]; then
echo "Skipping $d because it is missing pubspec.yaml"
popd
continue
fi
echo "pub get in $d"
flutter pub get
subapps=( "integration_test_app" "e2e_test_app" )
for subapp in "${subapps[@]}"; do
if [ -d "$subapp" ]; then
pushd "$subapp"
echo "pub get in $d/$subapp"
flutter pub get
popd
fi
done
popd
done
for d in tools/*/ ; do
pushd "$d"
if [ ! -f "pubspec.yaml" ]; then
echo "Skipping $d because it is missing pubspec.yaml"
popd
continue
fi
echo "pub get in $d"
dart pub get
popd
done
- working_dir: "$BITRISE_SOURCE_DIR"
analyze:
steps:
- flutter-analyze@0:
inputs:
- project_location: "$BITRISE_SOURCE_DIR/packages/datadog_flutter_plugin/"
- flutter-analyze@0:
inputs:
- project_location: "$BITRISE_SOURCE_DIR/packages/datadog_tracking_http_client/"
- flutter-analyze@0:
inputs:
- project_location: "$BITRISE_SOURCE_DIR/packages/datadog_grpc_interceptor/"
- script:
title: Android lint and static analysis
inputs:
- content: |-
#!/usr/bin/env bash
set -e
gradle wrapper
./gradlew ktlintCheck detekt
- working_dir: "$BITRISE_SOURCE_DIR/packages/datadog_flutter_plugin/example/android"
unit_test:
before_run:
- _prepare_gradle_wrapper
steps:
- flutter-test@1:
run_if: '{{enveq "DD_RUN_UNIT_TESTS" "1"}}'
inputs:
- project_location: "$BITRISE_SOURCE_DIR/packages/datadog_flutter_plugin"
- flutter-test@1:
run_if: '{{enveq "DD_RUN_UNIT_TESTS" "1"}}'
inputs:
- project_location: "$BITRISE_SOURCE_DIR/packages/datadog_tracking_http_client"
- flutter-test@1:
run_if: '{{enveq "DD_RUN_UNIT_TESTS" "1"}}'
inputs:
- project_location: "$BITRISE_SOURCE_DIR/packages/datadog_grpc_interceptor"
run_if: '{{enveq "DD_RUN_UNIT_TESTS" "1"}}'
inputs:
- project_path: "$BITRISE_SOURCE_DIR/packages/datadog_flutter_plugin/example/ios/Runner.xcworkspace"
- scheme: Runner
- destination: platform=iOS Simulator,name=iPhone 13,OS=latest
run_if: '{{enveq "DD_RUN_UNIT_TESTS" "1"}}'
inputs:
- project_location: "$BITRISE_SOURCE_DIR/packages/datadog_flutter_plugin/example/android"
- module: datadog_flutter_plugin
build:
steps:
- flutter-build@0:
inputs:
- project_location: "$BITRISE_SOURCE_DIR/packages/datadog_flutter_plugin/example"
- platform: both
integration_test:
before_run:
- integration_ios
- integration_android
integration_android:
steps:
- flutter-test@1:
run_if: '{{enveq "DD_RUN_INTEGRATION_TESTS" "1"}}'
inputs:
- project_location: "$BITRISE_SOURCE_DIR/packages/datadog_flutter_plugin/integration_test_app"
- tests_path_pattern: "integration_test"
- additional_params: "-d emulator --dart-define DD_CLIENT_TOKEN=$DD_CLIENT_TOKEN,DD_APPLICATION_ID=$DD_APPLICATION_ID"
- flutter-test@1:
run_if: '{{enveq "DD_RUN_INTEGRATION_TESTS" "1"}}'
inputs:
- project_location: "$BITRISE_SOURCE_DIR/packages/datadog_tracking_http_client/example"
- tests_path_pattern: "integration_test"
- additional_params: "-d emulator --dart-define DD_CLIENT_TOKEN=$DD_CLIENT_TOKEN,DD_APPLICATION_ID=$DD_APPLICATION_ID"
integration_ios:
before_run:
- _launch_ios_simulator
steps:
- flutter-test@1:
run_if: '{{enveq "DD_RUN_INTEGRATION_TESTS" "1"}}'
inputs:
- project_location: "$BITRISE_SOURCE_DIR/packages/datadog_flutter_plugin/integration_test_app"
- tests_path_pattern: "integration_test"
- additional_params: "-d iPhone --dart-define DD_CLIENT_TOKEN=$DD_CLIENT_TOKEN,DD_APPLICATION_ID=$DD_APPLICATION_ID"
- flutter-test@1:
run_if: '{{enveq "DD_RUN_INTEGRATION_TESTS" "1"}}'
inputs:
- project_location: "$BITRISE_SOURCE_DIR/packages/datadog_tracking_http_client/example"
- tests_path_pattern: "integration_test"
- additional_params: "-d iPhone --dart-define DD_CLIENT_TOKEN=$DD_CLIENT_TOKEN,DD_APPLICATION_ID=$DD_APPLICATION_ID"
integration_web:
steps:
- script:
title: Run pub get in all projects
inputs:
- content: |-
#!/usr/bin/env bash
set -e
./tools/chromedriver --port=4444 &
pushd "packages/datadog_flutter_plugin/integration_test_app"
testfiles=(
"integration_test/logging_test.dart"
"integration_test/rum_manual_test.dart"
"integration_test/rum_manual_error_reporting_test.dart"
"integration_test/rum_no_auto_instrumentation_test.dart"
"integration_test/rum_auto_instrumentation_test.dart"
)
for test in "${testfiles[@]}" ; do
echo 'Testing $test'
flutter drive --driver=test_driver/integration_test.dart --target=$test -d "Chrome"
done
popd
- working_dir: "$BITRISE_SOURCE_DIR"
nightly_ios:
before_run:
- _launch_ios_simulator
steps:
- flutter-test@1:
inputs:
- project_location: "$BITRISE_SOURCE_DIR/packages/datadog_flutter_plugin/e2e_test_app"
- tests_path_pattern: "integration_test"
- additional_params: "-d iPhone"
nightly_android:
steps:
- flutter-test@1:
inputs:
- project_location: "$BITRISE_SOURCE_DIR/packages/datadog_flutter_plugin/e2e_test_app"
- tests_path_pattern: "integration_test"
- additional_params: "-d emulator"
check_dependencies:
steps:
- script:
title: Check dependencies
inputs:
- content: |-
#!/usr/bin/env bash
set -e
dart ./bin/third_party_scanner.dart
- working_dir: "$BITRISE_SOURCE_DIR/tools/third_party_scanner"