1
1
version : 2.1
2
2
3
+ orbs :
4
+ # Using inline orb for now
5
+ getting-started-smoke-test :
6
+ orbs :
7
+
8
+ android :
circleci/[email protected]
9
+ flutter-orb :
circleci/[email protected]
10
+
11
+ executors :
12
+ mac-executor :
13
+ macos :
14
+ xcode : 13.2.1
15
+ resource_class : large
16
+
17
+ android-executor :
18
+ machine :
19
+ image : android:202102-01
20
+ resource_class : large
21
+
22
+ commands :
23
+ run-with-retry :
24
+ description : Run command with retry
25
+ parameters :
26
+ label :
27
+ description : Display name
28
+ type : string
29
+ command :
30
+ description : Command to run
31
+ type : string
32
+ retry-count :
33
+ description : Number of retry
34
+ type : integer
35
+ default : 3
36
+ sleep :
37
+ description : Wait duration until next retry
38
+ type : integer
39
+ default : 5
40
+ no_output_timeout :
41
+ description : Elapsed time the command can run without output
42
+ type : string
43
+ default : 10m
44
+ steps :
45
+ - run :
46
+ name : << parameters.label >>
47
+ command : |
48
+ retry() {
49
+ MAX_RETRY=<< parameters.retry-count >>
50
+ n=0
51
+ until [ $n -ge $MAX_RETRY ]
52
+ do
53
+ << parameters.command >> && break
54
+ n=$[$n+1]
55
+ sleep << parameters.sleep >>
56
+ done
57
+ if [ $n -ge $MAX_RETRY ]; then
58
+ echo "failed: ${@}" >&2
59
+ exit 1
60
+ fi
61
+ }
62
+ retry
63
+ no_output_timeout : << parameters.no_output_timeout >>
64
+ install-flutter :
65
+ description : Install Flutter and set up paths.
66
+ parameters :
67
+ flutter_branch :
68
+ description : Flutter branch or version tag.
69
+ type : string
70
+ default : stable
71
+ steps :
72
+ - run :
73
+ name : Set up Flutter
74
+ command : |
75
+ echo 'export FLUTTER_HOME=${HOME}/sdks/flutter' >> $BASH_ENV
76
+ echo 'export FLUTTER_BRANCH=<< parameters.flutter_branch >>' >> $BASH_ENV
77
+ echo 'export FLUTTER_ROOT=${FLUTTER_HOME}' >> $BASH_ENV
78
+ echo 'export PATH=${PATH}:${FLUTTER_HOME}/bin:${FLUTTER_HOME}/bin/cache/dart-sdk/bin:${HOME}/.pub-cache/bin:${FLUTTER_HOME}/.pub-cache/bin' >> $BASH_ENV
79
+ source $BASH_ENV
80
+ git clone --branch ${FLUTTER_BRANCH} https://github.com/flutter/flutter.git ${FLUTTER_HOME}
81
+ (yes || true) | flutter doctor --android-licenses && flutter doctor
82
+ flutter precache
83
+ setup-amplify-flutter-project :
84
+ description : Setup Amplify project
85
+ steps :
86
+ - run-with-retry :
87
+ label : Setting up dependences
88
+ command : flutter pub add amplify_flutter && flutter pub add amplify_datastore && flutter pub add amplify_storage_s3 && flutter pub add amplify_analytics_pinpoint && flutter pub add amplify_auth_cognito && flutter pub add amplify_api
89
+ no_output_timeout : 5m
90
+ - run :
91
+ name : Adding integration_test package
92
+ command : ' sed -i -e "s/dev_dependencies:/dev_dependencies:\n integration_test:\n sdk: flutter/" ./pubspec.yaml && cat ./pubspec.yaml'
93
+ - run :
94
+ name : Update outdated dependences
95
+ command : flutter pub upgrade --major-versions
96
+ - run :
97
+ name : Adding amplifyconfig file
98
+ command : mv canaries/dummy_amplifyconfiguration.dart canaries/amplifyconfiguration.dart && cp canaries/amplifyconfiguration.dart amplified_todo/lib
99
+ working_directory : ~/flutter-canaries/
100
+ - run :
101
+ name : Adding test code
102
+ command : cp canaries/main.dart amplified_todo/lib && cp -r canaries/integration_test amplified_todo/integration_test && cp -r canaries/models amplified_todo/lib/models
103
+ working_directory : ~/flutter-canaries/
104
+
105
+ jobs :
106
+ flutter-android :
107
+ parameters :
108
+ flutter-version :
109
+ type : string
110
+ executor :
111
+ name : android/android-machine
112
+ resource-class : large
113
+ tag : 2021.10.1
114
+ working_directory : ~/flutter-canaries/amplified_todo
115
+ steps :
116
+ - checkout :
117
+ path : ~/flutter-canaries
118
+ - install-flutter :
119
+ flutter_branch : << parameters.flutter-version >>
120
+ - run :
121
+ name : Setting up project
122
+ command : cd ../ && flutter create amplified_todo
123
+ - run :
124
+ name : Update Android version
125
+ command : sed -i -e "s/minSdkVersion .*/minSdkVersion 21/" ./android/app/build.gradle && cat ./android/app/build.gradle
126
+ - setup-amplify-flutter-project
127
+ - flutter-orb/install_android_gradle :
128
+ app-dir : ./
129
+ - android/create-avd :
130
+ avd-name : flutter
131
+ install : true
132
+ system-image : system-images;android-29;default;x86
133
+ - android/start-emulator :
134
+ avd-name : flutter
135
+ post-emulator-launch-assemble-command : ls -lrt
136
+ restore-gradle-cache-find-args : ./android -name 'build.gradle'
137
+ - run-with-retry :
138
+ label : Run Flutter Build
139
+ command : flutter build apk --debug
140
+ no_output_timeout : 20m
141
+ - run-with-retry :
142
+ label : Run Flutter Tests
143
+ command : flutter test integration_test
144
+ no_output_timeout : 1h
145
+ retry-count : 5
146
+
147
+ flutter-ios :
148
+ parameters :
149
+ flutter-version :
150
+ type : string
151
+ executor : mac-executor
152
+ working_directory : ~/flutter-canaries/amplified_todo
153
+ steps :
154
+ - checkout :
155
+ path : ~/flutter-canaries
156
+ - run :
157
+ name : Install gnu-sed
158
+ command : brew install gnu-sed
159
+ - macos/preboot-simulator :
160
+ device : iPhone 13
161
+ version : " 15.2"
162
+ - install-flutter :
163
+ flutter_branch : << parameters.flutter-version >>
164
+ - run :
165
+ name : Setting up project
166
+ command : cd ../ && flutter create amplified_todo
167
+ - setup-amplify-flutter-project
168
+ - run :
169
+ name : Removing IPHONEOS_DEPLOYMENT_TARGET from build_settings
170
+ command : cd ios && gsed -i "/flutter_additional_ios_build_settings(target)/ a \ target.build_configurations.each do |config|\n config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'\n end" Podfile
171
+ - run :
172
+ name : Update ios version
173
+ command : sed -i -e "s/# platform .*/platform :ios, '13.0'/" ./ios/Podfile && cat ./ios/Podfile
174
+ - run-with-retry :
175
+ label : Run Flutter Build
176
+ command : flutter build ios --debug --simulator
177
+ no_output_timeout : 20m
178
+ - run-with-retry :
179
+ label : Run Flutter Tests
180
+ command : flutter test integration_test
181
+ no_output_timeout : 20m
182
+
183
+
3
184
executors :
4
185
docker-executor :
5
186
docker :
@@ -50,6 +231,7 @@ commands:
50
231
name : Install tuneup
51
232
command : |
52
233
flutter pub global activate tuneup
234
+
53
235
jobs :
54
236
format_flutter :
55
237
executor : docker-executor
@@ -198,10 +380,16 @@ releasable_branches: &releasable_branches
198
380
199
381
workflows :
200
382
test_deploy :
383
+ # Tells CircleCI to skip this workflow when the pipeline is triggered by the scheduled source,
384
+ # i.e. when the canaries workflow executes
385
+ # https://circleci.com/docs/2.0/scheduled-pipelines/#workflows-filtering
386
+ when :
387
+ not :
388
+ equal : [ scheduled_pipeline, << pipeline.trigger_source >> ]
201
389
jobs :
202
390
- format_flutter
203
391
- analyze_flutter
204
- # TODO: Enable pub_analysis after https://github.com/dart-lang/pana/issues/1020 is
392
+ # TODO: Enable pub_analysis after https://github.com/dart-lang/pana/issues/1020 is
205
393
# resolved or these are updated to run against unpub
206
394
# - pub_analysis:
207
395
# matrix:
@@ -222,36 +410,52 @@ workflows:
222
410
parameters :
223
411
plugin :
224
412
[
225
- " amplify_analytics_pinpoint" ,
226
- " amplify_api" ,
227
- " amplify_auth_cognito" ,
228
- " amplify_authenticator" ,
229
- " amplify_core" ,
230
- " amplify_datastore" ,
231
- " amplify_datastore_plugin_interface" ,
232
- " amplify_flutter" ,
233
- " amplify_storage_s3"
413
+ " amplify_analytics_pinpoint" ,
414
+ " amplify_api" ,
415
+ " amplify_auth_cognito" ,
416
+ " amplify_authenticator" ,
417
+ " amplify_core" ,
418
+ " amplify_datastore" ,
419
+ " amplify_datastore_plugin_interface" ,
420
+ " amplify_flutter" ,
421
+ " amplify_storage_s3"
234
422
]
235
423
- unit_test_android :
236
424
matrix :
237
425
parameters :
238
426
plugin :
239
427
[
240
- " amplify_analytics_pinpoint" ,
241
- " amplify_api" ,
242
- " amplify_auth_cognito" ,
243
- " amplify_core" ,
244
- " amplify_datastore" ,
245
- " amplify_flutter" ,
428
+ " amplify_analytics_pinpoint" ,
429
+ " amplify_api" ,
430
+ " amplify_auth_cognito" ,
431
+ " amplify_core" ,
432
+ " amplify_datastore" ,
433
+ " amplify_flutter" ,
246
434
]
247
435
- unit_test_ios :
248
436
matrix :
249
437
parameters :
250
438
plugin :
251
439
[
252
- " amplify_analytics_pinpoint" ,
253
- " amplify_api" ,
254
- " amplify_auth_cognito" ,
255
- " amplify_datastore" ,
256
- " amplify_flutter" ,
440
+ " amplify_analytics_pinpoint" ,
441
+ " amplify_api" ,
442
+ " amplify_auth_cognito" ,
443
+ " amplify_datastore" ,
444
+ " amplify_flutter" ,
257
445
]
446
+ # Scheduled smoke test workflow
447
+ # Jobs are pulled from the getting-started-smoke-test inline orb defined above
448
+ canaries :
449
+ when :
450
+ and :
451
+ - equal : [ scheduled_pipeline, << pipeline.trigger_source >> ]
452
+ - equal : [ "Canaries", << pipeline.schedule.name >> ]
453
+ jobs :
454
+ - getting-started-smoke-test/flutter-android :
455
+ matrix :
456
+ parameters :
457
+ flutter-version : [ "stable", "beta" ]
458
+ - getting-started-smoke-test/flutter-ios :
459
+ matrix :
460
+ parameters :
461
+ flutter-version : [ "stable", "beta" ]
0 commit comments