A shareable package of CircleCI configuration to integrate with flutter-orb, written by tadashi0713
CommunityLanguage/FrameworkUse CircleCI version 2.1 at the top of your .circleci/config.yml file.
1
version: 2.1Add the orbs stanza below your version, invoking the orb:
1
2
orbs:
flutter-orb: tadashi0713/flutter-orb@1.2.1Use flutter-orb elements in your existing workflows and jobs.
Opt-in to use of uncertified orbs on your organization’s Security settings page.
Install Flutter SDK and packages for Android machine executor
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
version: '2.1'
orbs:
android: circleci/android@1.0.3
flutter-orb: tadashi0713/flutter-orb@1.2.0
jobs:
distribute:
executor:
name: android/android-machine
steps:
- flutter-orb/install_sdk_and_pub:
version: 2.2.3
- flutter-orb/install_android_gradle
- flutter-orb/install_android_gem
- run:
command: bundle exec fastlane distribute
working_directory: ios
workflows:
distribute:
jobs:
- distribute
Install Flutter SDK and packages for macOS
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
version: '2.1'
orbs:
flutter-orb: tadashi0713/flutter-orb@1.2.0
jobs:
distribute:
macos:
xcode: 12.5.1
steps:
- flutter-orb/install_sdk_and_pub:
version: 2.2.3
- flutter-orb/install_ios_pod
- flutter-orb/install_ios_gem
- run:
command: bundle exec fastlane distribute
working_directory: ios
workflows:
distribute:
jobs:
- distribute
Run static analysis(flutter analyze)
1
2
3
4
5
6
7
8
version: '2.1'
orbs:
flutter-orb: tadashi0713/flutter-orb@1.2.0
workflows:
test:
jobs:
- flutter-orb/lint:
version: 2.2.3
Run Unit Test
1
2
3
4
5
6
7
8
version: '2.1'
orbs:
flutter-orb: tadashi0713/flutter-orb@1.2.0
workflows:
test:
jobs:
- flutter-orb/unit_test:
version: 2.2.3
Run static analysis(flutter analyze)
| PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
|---|---|---|---|---|
app-dir Path to the directory containing your pubspec.yaml file. Not needed if pubspec.yaml lives in the root. | Path to the directory containing your pubspec.yaml file. Not needed if pubspec.yaml lives in the root. | No | . type: string | string |
cache-version Change the default cache version if you need to clear the cache for any reason. | Change the default cache version if you need to clear the cache for any reason. | No | v1 type: string | string |
version The target version for the Flutter SDK. | The target version for the Flutter SDK. | No | 2.2.3 type: string | string |
Run Unit Test
| PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
|---|---|---|---|---|
app-dir Path to the directory containing your pubspec.yaml file. Not needed if pubspec.yaml lives in the root. | Path to the directory containing your pubspec.yaml file. Not needed if pubspec.yaml lives in the root. | No | . type: string | string |
cache-version Change the default cache version if you need to clear the cache for any reason. | Change the default cache version if you need to clear the cache for any reason. | No | v1 type: string | string |
version The target version for the Flutter SDK. | The target version for the Flutter SDK. | No | 2.2.3 type: string | string |
Install your Android Rubygems(mainly fastlane) with automated caching and best practices applied. Requires lock file. https://flutter.dev/docs/deployment/cd
| PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
|---|---|---|---|---|
app-dir Path to the directory containing your pubspec.yaml file. Not needed if pubspec.yaml lives in the root. | Path to the directory containing your pubspec.yaml file. Not needed if pubspec.yaml lives in the root. | No | . type: string | string |
cache-version Change the default cache version if you need to clear the cache for any reason. | Change the default cache version if you need to clear the cache for any reason. | No | v1 type: string | string |
Install your Android gradle packages with automated caching and best practices applied. Requires build.gradle file.
| PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
|---|---|---|---|---|
app-dir Path to the directory containing your pubspec.yaml file. Not needed if pubspec.yaml lives in the root. | Path to the directory containing your pubspec.yaml file. Not needed if pubspec.yaml lives in the root. | No | . type: string | string |
cache-version Change the default cache version if you need to clear the cache for any reason. | Change the default cache version if you need to clear the cache for any reason. | No | v1 type: string | string |
Install your iOS Rubygems(mainly fastlane) with automated caching and best practices applied. Requires lock file. https://flutter.dev/docs/deployment/cd
| PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
|---|---|---|---|---|
app-dir Path to the directory containing your pubspec.yaml file. Not needed if pubspec.yaml lives in the root. | Path to the directory containing your pubspec.yaml file. Not needed if pubspec.yaml lives in the root. | No | . type: string | string |
cache-version Change the default cache version if you need to clear the cache for any reason. | Change the default cache version if you need to clear the cache for any reason. | No | v1 type: string | string |
Install your iOS cocoapods packages with automated caching and best practices applied. Requires lock file.
| PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
|---|---|---|---|---|
app-dir Path to the directory containing your pubspec.yaml file. Not needed if pubspec.yaml lives in the root. | Path to the directory containing your pubspec.yaml file. Not needed if pubspec.yaml lives in the root. | No | . type: string | string |
cache-version Change the default cache version if you need to clear the cache for any reason. | Change the default cache version if you need to clear the cache for any reason. | No | v1 type: string | string |
Install your flutter packages with automated caching and best practices applied. Requires lock file.
| PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
|---|---|---|---|---|
app-dir Path to the directory containing your pubspec.yaml file. Not needed if pubspec.yaml lives in the root. | Path to the directory containing your pubspec.yaml file. Not needed if pubspec.yaml lives in the root. | No | . type: string | string |
cache-version Change the default cache version if you need to clear the cache for any reason. | Change the default cache version if you need to clear the cache for any reason. | No | v1 type: string | string |
Install Flutter SDK
| PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
|---|---|---|---|---|
version The target version for the Flutter SDK. | The target version for the Flutter SDK. | No | 2.2.3 type: string | string |
Install Flutter SDK and your flutter packages with automated caching and best practices applied. Requires lock file.
| PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
|---|---|---|---|---|
app-dir Path to the directory containing your pubspec.yaml file. Not needed if pubspec.yaml lives in the root. | Path to the directory containing your pubspec.yaml file. Not needed if pubspec.yaml lives in the root. | No | . type: string | string |
cache-version Change the default cache version if you need to clear the cache for any reason. | Change the default cache version if you need to clear the cache for any reason. | No | v1 type: string | string |
flutter_version The target version for the Flutter SDK. | The target version for the Flutter SDK. | No | 2.2.3 type: string | string |
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
# This code is licensed from CircleCI to the user under the MIT license.
# See here for details: https://circleci.com/developer/orbs/licensing
version: 2.1
description: |
Easily install Flutter SDK and package dependencies. Also easily run unit test and lint. Supports Linux and macOS
display:
home_url: https://flutter.dev
source_url: https://github.com/tadashi0713/flutter-orb
commands:
install_android_gem:
description: |
Install your Android Rubygems(mainly fastlane) with automated caching and best practices applied. Requires lock file. https://flutter.dev/docs/deployment/cd
parameters:
app-dir:
default: .
description: Path to the directory containing your pubspec.yaml file. Not needed if pubspec.yaml lives in the root.
type: string
cache-version:
default: v1
description: Change the default cache version if you need to clear the cache for any reason.
type: string
steps:
- restore_cache:
keys:
- bundle-<<parameters.cache-version>>-android-{{ checksum "<< parameters.app-dir >>/android/Gemfile.lock" }}
- run:
command: |
bundle config set path ./vendor/bundle
bundle install
name: Install Dependencies
working_directory: <<parameters.app-dir>>/android
- save_cache:
key: bundle-<<parameters.cache-version>>-android-{{ checksum "<< parameters.app-dir >>/android/Gemfile.lock" }}
paths:
- <<parameters.app-dir>>/android/vendor/bundle
install_android_gradle:
description: |
Install your Android gradle packages with automated caching and best practices applied. Requires build.gradle file.
parameters:
app-dir:
default: .
description: Path to the directory containing your pubspec.yaml file. Not needed if pubspec.yaml lives in the root.
type: string
cache-version:
default: v1
description: Change the default cache version if you need to clear the cache for any reason.
type: string
steps:
- restore_cache:
key: gradle-<<parameters.cache-version>>-{{ checksum "<< parameters.app-dir >>/android/app/build.gradle" }}
- run:
command: gradle androidDependencies
working_directory: << parameters.app-dir >>/android
- save_cache:
key: gradle-<<parameters.cache-version>>-{{ checksum "<< parameters.app-dir >>/android/app/build.gradle" }}
paths:
- ~/.gradle/caches
- ~/.gradle/wrapper
install_ios_gem:
description: |
Install your iOS Rubygems(mainly fastlane) with automated caching and best practices applied. Requires lock file. https://flutter.dev/docs/deployment/cd
parameters:
app-dir:
default: .
description: Path to the directory containing your pubspec.yaml file. Not needed if pubspec.yaml lives in the root.
type: string
cache-version:
default: v1
description: Change the default cache version if you need to clear the cache for any reason.
type: string
steps:
- restore_cache:
keys:
- bundle-<<parameters.cache-version>>-ios-{{ checksum "<< parameters.app-dir >>/ios/Gemfile.lock" }}
- run:
command: |
bundle config set path ./vendor/bundle
bundle install
name: Install Dependencies
working_directory: <<parameters.app-dir>>/ios
- save_cache:
key: bundle-<<parameters.cache-version>>-ios-{{ checksum "<< parameters.app-dir >>/ios/Gemfile.lock" }}
paths:
- <<parameters.app-dir>>/ios/vendor/bundle
install_ios_pod:
description: |
Install your iOS cocoapods packages with automated caching and best practices applied. Requires lock file.
parameters:
app-dir:
default: .
description: Path to the directory containing your pubspec.yaml file. Not needed if pubspec.yaml lives in the root.
type: string
cache-version:
default: v1
description: Change the default cache version if you need to clear the cache for any reason.
type: string
steps:
- restore_cache:
keys:
- pod-<<parameters.cache-version>>-{{ checksum "<< parameters.app-dir >>/ios/Podfile.lock" }}
- run:
command: pod install
name: Install Dependencies
working_directory: <<parameters.app-dir>>/ios
- save_cache:
key: pod-<<parameters.cache-version>>-{{ checksum "<< parameters.app-dir >>/ios/Podfile.lock" }}
paths:
- <<parameters.app-dir>>/ios/Pods
install_pub:
description: |
Install your flutter packages with automated caching and best practices applied. Requires lock file.
parameters:
app-dir:
default: .
description: Path to the directory containing your pubspec.yaml file. Not needed if pubspec.yaml lives in the root.
type: string
cache-version:
default: v1
description: Change the default cache version if you need to clear the cache for any reason.
type: string
steps:
- restore_cache:
keys:
- pub-<<parameters.cache-version>>-{{ checksum "<< parameters.app-dir >>/pubspec.lock" }}-{{ arch }}
- run:
command: flutter pub get
name: Install Dependencies
working_directory: <<parameters.app-dir>>
- save_cache:
key: pub-<<parameters.cache-version>>-{{ checksum "<< parameters.app-dir >>/pubspec.lock" }}-{{ arch }}
paths:
- <<parameters.app-dir>>/.dart_tool
install_sdk:
description: |
Install Flutter SDK
parameters:
version:
default: 2.2.3
description: The target version for the Flutter SDK.
type: string
steps:
- run:
command: |
mkdir ~/development && cd $_
if [ "$(uname)" == 'Darwin' ]; then
curl -o flutter_sdk.zip https://storage.googleapis.com/flutter_infra_release/releases/stable/macos/flutter_macos_<<parameters.version>>-stable.zip
unzip -qq flutter_sdk.zip
elif [ "$(expr substr $(uname -s) 1 5)" == 'Linux' ]; then
curl -o flutter_sdk.tar.xz https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_<<parameters.version>>-stable.tar.xz
tar xf flutter_sdk.tar.xz
else
echo "Your platform ($(uname -a)) is not supported."
exit 1
fi
echo 'export PATH=~/development/flutter/bin:$PATH' >> $BASH_ENV
name: Install Flutter SDK
- run: flutter doctor
install_sdk_and_pub:
description: |
Install Flutter SDK and your flutter packages with automated caching and best practices applied. Requires lock file.
parameters:
app-dir:
default: .
description: Path to the directory containing your pubspec.yaml file. Not needed if pubspec.yaml lives in the root.
type: string
cache-version:
default: v1
description: Change the default cache version if you need to clear the cache for any reason.
type: string
flutter_version:
default: 2.2.3
description: The target version for the Flutter SDK.
type: string
steps:
- install_sdk:
version: <<parameters.flutter_version>>
- install_pub:
app-dir: <<parameters.app-dir>>
cache-version: <<parameters.app-dir>>
jobs:
lint:
description: |
Run static analysis(flutter analyze)
docker:
- image: cirrusci/flutter:<<parameters.version>>
parameters:
app-dir:
default: .
description: Path to the directory containing your pubspec.yaml file. Not needed if pubspec.yaml lives in the root.
type: string
cache-version:
default: v1
description: Change the default cache version if you need to clear the cache for any reason.
type: string
version:
default: 2.2.3
description: The target version for the Flutter SDK.
type: string
steps:
- checkout
- install_pub:
app-dir: <<parameters.app-dir>>
cache-version: <<parameters.cache-version>>
- run:
command: flutter analyze lib
name: Run static analysis
working_directory: <<parameters.app-dir>>
unit_test:
description: |
Run Unit Test
docker:
- image: cirrusci/flutter:<<parameters.version>>
parameters:
app-dir:
default: .
description: Path to the directory containing your pubspec.yaml file. Not needed if pubspec.yaml lives in the root.
type: string
cache-version:
default: v1
description: Change the default cache version if you need to clear the cache for any reason.
type: string
version:
default: 2.2.3
description: The target version for the Flutter SDK.
type: string
steps:
- checkout
- install_pub:
app-dir: <<parameters.app-dir>>
cache-version: <<parameters.cache-version>>
- run:
command: flutter test
name: Run Unit Test
working_directory: <<parameters.app-dir>>
examples:
install_for_android_machine:
description: |
Install Flutter SDK and packages for Android machine executor
usage:
version: "2.1"
orbs:
android: circleci/android@1.0.3
flutter-orb: tadashi0713/flutter-orb@1.2.0
jobs:
distribute:
executor:
name: android/android-machine
steps:
- flutter-orb/install_sdk_and_pub:
version: 2.2.3
- flutter-orb/install_android_gradle
- flutter-orb/install_android_gem
- run:
command: bundle exec fastlane distribute
working_directory: ios
workflows:
distribute:
jobs:
- distribute
install_for_macos:
description: |
Install Flutter SDK and packages for macOS
usage:
version: "2.1"
orbs:
flutter-orb: tadashi0713/flutter-orb@1.2.0
jobs:
distribute:
macos:
xcode: 12.5.1
steps:
- flutter-orb/install_sdk_and_pub:
version: 2.2.3
- flutter-orb/install_ios_pod
- flutter-orb/install_ios_gem
- run:
command: bundle exec fastlane distribute
working_directory: ios
workflows:
distribute:
jobs:
- distribute
lint:
description: |
Run static analysis(flutter analyze)
usage:
version: "2.1"
orbs:
flutter-orb: tadashi0713/flutter-orb@1.2.0
workflows:
test:
jobs:
- flutter-orb/lint:
version: 2.2.3
unit_test:
description: |
Run Unit Test
usage:
version: "2.1"
orbs:
flutter-orb: tadashi0713/flutter-orb@1.2.0
workflows:
test:
jobs:
- flutter-orb/unit_test:
version: 2.2.3