-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.yml
573 lines (572 loc) · 23 KB
/
config.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
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
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
### AUTO GENERATED. DO NOT MODIFY. ###
# This file should be auto generated by the files in the src folder.
# You can update it by running `./tools/circleci-update-config` from the project root.
commands:
check_circleci_config:
description: This command builds the circle config from the files in src and validates that it is up-to-date and valid.
steps:
- run:
command: curl -fLSs https://raw.githubusercontent.com/CircleCI-Public/circleci-cli/master/install.sh | sudo bash
name: Install CircleCI CLI
- run:
command: ./tools/circleci-update-config
name: Build circle config
- run:
command: |
FILES_MODIFIED=""
setcommit () {
FILES_MODIFIED=$(git status -s | grep -i -E '.*circleci/config.yml')
}
setcommit || true
if [ -z "$FILES_MODIFIED" ]
then
echo "The CircleCI config is up to date."
exit 0;
else
echo "The CircleCI config is not up to date. You can update it by running the `./tools/circleci-update-config` script."
exit 1;
fi
name: CircleCI config up to date
- run:
command: circleci config validate
name: Validate circle config
install_cocoapods:
description: Restores and saves the cocoa pods cache.
steps:
- restore_cache:
keys:
- 1-cocoapods-{{ arch }}-{{ checksum "ios/Podfile.lock" }}
name: Restore CocoaPods Cache
- run:
command: bundle exec pod install
name: Install CocoaPods
working_directory: ios
- save_cache:
key: 1-cocoapods-{{ arch }}-{{ checksum "ios/Podfile.lock" }}
name: Save CocoaPods Cache
paths:
- ~/Library/Caches/CocoaPods/
install_fastlane:
description: Restores and saves fastlane cache of the passed directory.
parameters:
directory:
type: string
steps:
- restore_cache:
keys:
- v1-gems-{{ arch }}-{{ checksum "<< parameters.directory >>/Gemfile.lock" }}
- v1-gems-{{ arch }}-
name: Restore Ruby Cache
- run:
command: bundle config set path 'vendor/bundle'
name: Configure Installation Directory
working_directory: << parameters.directory >>
- run:
command: bundle check || bundle install
name: Bundle Install
working_directory: << parameters.directory >>
- save_cache:
key: v1-gems-{{ arch }}-{{ checksum "<< parameters.directory >>/Gemfile.lock" }}
name: Save Ruby Cache
paths:
- << parameters.directory >>/vendor/bundle
install_flutter:
parameters:
precache:
default: none
enum:
- none
- android
- ios
type: enum
steps:
- when:
condition:
equal:
- << parameters.precache >>
- ios
steps:
- run:
command: |
brew tap dart-lang/dart
brew install [email protected]
brew link [email protected]
name: Install Dart Mac
- unless:
condition:
equal:
- << parameters.precache >>
- ios
steps:
- run:
command: |
curl -o dart.deb https://storage.googleapis.com/dart-archive/channels/stable/release/3.5.3/linux_packages/dart_3.5.3-1_amd64.deb
sudo dpkg -i dart.deb
name: Install Dart Linux
- run:
command: |
dart pub global activate fvm
echo 'export PATH=$HOME/.pub-cache/bin:$PATH' >> $BASH_ENV
export PATH="$PATH":"$HOME/.pub-cache/bin"
name: Install FVM
- restore_cache:
keys:
- v1-fvm-{{ arch }}-{{ checksum ".fvmrc" }}-{{ checksum "pubspec.yaml" }}-{{ checksum "pubspec.lock" }}
- v1-fvm-{{ arch }}-
- run:
command: fvm install
name: Install Flutter
- run:
command: fvm flutter config --no-analytics
name: Configure Flutter
- run:
command: fvm flutter --version
name: Show Flutter version
- run:
command: fvm flutter pub get --enforce-lockfile
name: Install Flutter Packages
- unless:
condition:
equal:
- << parameters.precache >>
- none
steps:
- run:
command: fvm flutter precache --<< parameters.precache >>
name: Precache Flutter Binary Artifacts
working_directory: << parameters.precache >>
- save_cache:
key: v1-fvm-{{ arch }}-{{ checksum ".fvmrc" }}-{{ checksum "pubspec.yaml" }}-{{ checksum "pubspec.lock" }}
paths:
- .fvm
- ~/fvm/
install_gradle_dependencies:
description: Restores and saves the gradle cache.
steps:
- restore_cache:
keys:
- v1-gradle-{{ checksum "android/build.gradle" }}-{{ checksum "android/app/build.gradle" }}-{{ checksum "android/settings.gradle" }}
- v1-gradle-
- run:
command: ./gradlew androidDependencies
name: Download Gradle Dependencies
working_directory: android
- save_cache:
key: v1-gradle-{{ checksum "android/build.gradle" }}-{{ checksum "android/app/build.gradle" }}-{{ checksum "android/settings.gradle" }}
paths:
- ~/.gradle
install_node_modules:
description: Restores and saves the node_modules directories of the tools directory.
steps:
- restore_cache:
keys:
- v1-node-modules-{{checksum "tools/package-lock.json" }}
- v1-node-modules-
- run:
command: '[ ! -d node_modules ] && npm ci --ignore-scripts --loglevel warn --yes || echo package.json and package-lock.json unchanged. Using cache.'
name: Install node dependencies for npm workspaces
working_directory: tools
- save_cache:
key: v1-node-modules-{{checksum "tools/package-lock.json" }}
paths:
- ~/tools/node_modules
persist_environment_variables:
description: Sets the environment variables specified in the file 'environment_variables'. Make sure the file is persisted and has been attached.
steps:
- run:
command: cat ${BASH_ENV}
name: List environment variables
- run:
command: cat ${BASH_ENV} >> environment_variables
name: Save environment variables to file
- persist_to_workspace:
paths:
- environment_variables
root: ./
prepare_project:
steps:
- run:
command: fvm dart run slang
name: Generate Translations
- run:
command: cp .env.prod .env
name: Apply Production Environment
- run:
command: fvm dart run build_runner build
name: Generate Swagger API
prepare_workspace:
description: Attach the workspace at ~/attached_workspace and list its contents
steps:
- attach_workspace:
at: ~/attached_workspace
- run:
command: ls -A ~/attached_workspace
name: Attached workspace contents
- run:
command: ls -AR ~/attached_workspace
name: Recursively list attached workspace contents
restore_environment_variables:
description: Sets the environment variables specified in the file 'environment_variables'. Make sure the file is persisted and has been attached.
steps:
- run:
command: cat ~/attached_workspace/environment_variables
name: List environment variables
- run:
command: cat ~/attached_workspace/environment_variables >> ${BASH_ENV}
name: Restore environment variables
jobs:
build_android:
docker:
- image: cimg/android:2024.01.1-node
environment:
FASTLANE_SKIP_UPDATE_CHECK: true
GRADLE_OPTS: -Dorg.gradle.jvmargs="-Xmx2048m" -Dorg.gradle.daemon=false -Dorg.gradle.workers.max=2
resource_class: large
shell: /bin/bash -eo pipefail
steps:
- checkout
- prepare_workspace
- restore_environment_variables
- install_flutter:
precache: android
- prepare_project
- install_fastlane:
directory: android
- install_gradle_dependencies
- run:
command: bundle exec fastlane android keystore
name: '[FL] Prepare Android Keystore'
working_directory: android
- run:
command: bundle exec fastlane android build version_name:${NEW_VERSION_NAME} version_code:${NEW_VERSION_CODE}
name: '[FL] Build'
working_directory: android
- run:
command: mv ~/project/build/app/outputs/bundle/release/app-release.aab app-release.aab
name: Move aab
- store_artifacts:
path: app-release.aab
- run:
command: mv ~/project/build/app/outputs/apk/release/app-release.apk app-release.apk
name: Move apk
- store_artifacts:
path: app-release.apk
- persist_to_workspace:
paths:
- app-release.aab
- app-release.apk
root: .
- persist_environment_variables
build_ios:
environment:
FASTLANE_SKIP_UPDATE_CHECK: true
macos:
xcode: 16.1.0
steps:
- checkout
- prepare_workspace
- run:
command: softwareupdate --install-rosetta --agree-to-license
name: Install rosetta
- restore_environment_variables
- install_flutter:
precache: ios
- prepare_project
- install_fastlane:
directory: ios
- install_cocoapods
- run:
command: bundle exec fastlane ios build version_name:${NEW_VERSION_NAME} version_code:${NEW_VERSION_CODE}
name: '[FL] Build'
working_directory: ios
- store_artifacts:
destination: app-release.ipa
path: ~/app-release.ipa
- persist_to_workspace:
paths:
- app-release.ipa
root: ~/
bump_version:
docker:
- image: cimg/node:20.13.1
parameters:
prepare_delivery:
default: false
description: Whether to prepare for a delivery. If true, the version bump is committed.
type: boolean
resource_class: small
shell: /bin/bash -eo pipefail
steps:
- checkout
- install_node_modules
- run:
command: echo "export NEW_VERSION_NAME=$(yarn --silent next-version calc | jq .versionName)" >> ${BASH_ENV}
name: Calculate next version name
working_directory: tools
- run:
command: echo "export NEW_VERSION_CODE=$(yarn --silent next-version calc | jq .versionCode)" >> ${BASH_ENV}
name: Calculate next version code
working_directory: tools
- when:
condition: << parameters.prepare_delivery >>
steps:
- run:
command: yarn git-version bump-to ${NEW_VERSION_NAME} ${NEW_VERSION_CODE} --github-private-key ${GITHUB_PRIVATE_KEY} --owner ${CIRCLE_PROJECT_USERNAME} --repo ${CIRCLE_PROJECT_REPONAME} --branch ${CIRCLE_BRANCH}
name: Bump git version
working_directory: tools
- persist_environment_variables
check:
docker:
- image: cimg/node:20.13.1
resource_class: small
shell: /bin/bash -eo pipefail
steps:
- checkout
- check_circleci_config
- install_flutter
- run:
command: fvm dart format -l 120 -o none --set-exit-if-changed .
name: Check Formatting
- prepare_project
- run:
command: fvm flutter analyze --fatal-infos --fatal-warnings
name: Check Analyzer and Linting
deliver_android:
docker:
- image: cimg/android:2024.08.1-node
environment:
FASTLANE_SKIP_UPDATE_CHECK: true
parameters:
production_delivery:
description: Whether to deliver the build to production.
type: boolean
resource_class: small
shell: /bin/bash -eo pipefail
steps:
- checkout
- prepare_workspace
- restore_environment_variables
- install_node_modules
- install_fastlane:
directory: android
- run:
command: bundle exec fastlane android upload aab_path:attached_workspace/app-release.aab production_delivery:"<< parameters.production_delivery >>" version_name:${NEW_VERSION_NAME} version_code:${NEW_VERSION_CODE}
name: '[FL] Google PlayStore Upload'
working_directory: android
- run:
command: echo "export ANDROID_RELEASE_ID='$(yarn --silent github-release create android ${NEW_VERSION_NAME} ${NEW_VERSION_CODE} --production-delivery << parameters.production_delivery >> --github-private-key ${GITHUB_PRIVATE_KEY} --owner ${CIRCLE_PROJECT_USERNAME} --repo ${CIRCLE_PROJECT_REPONAME} --release-notes "Release v${NEW_VERSION_NAME}+${NEW_VERSION_CODE}")'" >> ${BASH_ENV}
name: Create Github Release
working_directory: tools
- run:
command: yarn github-release-asset upload android --releaseId ${ANDROID_RELEASE_ID} --files "$(ls ~/attached_workspace/*.{apk,aab})" --github-private-key ${GITHUB_PRIVATE_KEY} --owner ${CIRCLE_PROJECT_USERNAME} --repo ${CIRCLE_PROJECT_REPONAME}
name: Add Builds to Github Release
working_directory: tools
deliver_ios:
environment:
FASTLANE_SKIP_UPDATE_CHECK: true
macos:
xcode: 16.1.0
parameters:
production_delivery:
description: Whether to deliver the build to production.
type: boolean
steps:
- checkout
- prepare_workspace
- restore_environment_variables
- install_node_modules
- install_fastlane:
directory: ios
- when:
condition: << parameters.production_delivery >>
steps:
- run:
command: bundle exec fastlane ios production_upload ipa_path:attached_workspace/app-release.ipa version_name:${NEW_VERSION_NAME}
name: '[FL] Apple AppStore Upload'
working_directory: ios
- unless:
condition: << parameters.production_delivery >>
steps:
- run:
command: bundle exec fastlane ios beta_upload ipa_path:attached_workspace/app-release.ipa
name: '[FL] Apple Testflight Upload'
working_directory: ios
- run:
command: echo "export IOS_RELEASE_ID='$(yarn --silent github-release create ios ${NEW_VERSION_NAME} ${NEW_VERSION_CODE} --production-delivery << parameters.production_delivery >> --github-private-key ${GITHUB_PRIVATE_KEY} --owner ${CIRCLE_PROJECT_USERNAME} --repo ${CIRCLE_PROJECT_REPONAME} --release-notes "Release v${NEW_VERSION_NAME}+${NEW_VERSION_CODE}")'" >> ${BASH_ENV}
name: Create Github Release
working_directory: tools
- run:
command: yarn github-release-asset upload ios --releaseId ${IOS_RELEASE_ID} --files "$(ls ~/attached_workspace/*.ipa)" --github-private-key ${GITHUB_PRIVATE_KEY} --owner ${CIRCLE_PROJECT_USERNAME} --repo ${CIRCLE_PROJECT_REPONAME}
name: Add Build to Github Release
working_directory: tools
promote_android:
docker:
- image: cimg/android:2024.08.1-node
environment:
FASTLANE_SKIP_UPDATE_CHECK: true
resource_class: small
shell: /bin/bash -eo pipefail
steps:
- checkout
- install_node_modules
- install_fastlane:
directory: android
- run:
command: bundle exec fastlane android promote
name: '[FL] Google PlayStore Promotion'
working_directory: android
- run:
command: yarn github-promote-release promote --platform android --github-private-key ${GITHUB_PRIVATE_KEY} --owner ${CIRCLE_PROJECT_USERNAME} --repo ${CIRCLE_PROJECT_REPONAME}
name: Remove Beta Flag from Github Release
working_directory: tools
promote_ios:
environment:
FASTLANE_SKIP_UPDATE_CHECK: true
macos:
xcode: 16.1.0
steps:
- checkout
- install_node_modules
- install_fastlane:
directory: ios
- run:
command: bundle exec fastlane ios promote
name: '[FL] Apple AppStore Promotion'
working_directory: ios
- run:
command: yarn github-promote-release promote --platform ios --github-private-key ${GITHUB_PRIVATE_KEY} --owner ${CIRCLE_PROJECT_USERNAME} --repo ${CIRCLE_PROJECT_REPONAME}
name: Remove Beta Flag from Github Release
working_directory: tools
parameters:
api_triggered:
default: false
description: Whether the pipeline was triggered through the CircleCi API (https://circleci.com/docs/api/v2/?shell#trigger-a-new-pipeline).
type: boolean
workflow_type:
default: none
enum:
- beta_delivery
- production_delivery
- promotion
- none
type: enum
version: 2.1
workflows:
beta_delivery:
jobs:
- bump_version:
context:
- github
prepare_delivery: true
- build_android:
context:
- app_signing_android
requires:
- bump_version
- deliver_android:
context:
- github
- gruene_google_playstore
production_delivery: false
requires:
- build_android
- build_ios:
context:
- app_signing_ios
requires:
- bump_version
- deliver_ios:
context:
- github
- gruene_apple_appstore
production_delivery: false
requires:
- build_ios
when:
and:
- << pipeline.parameters.api_triggered >>
- equal:
- << pipeline.parameters.workflow_type >>
- beta_delivery
commit:
jobs:
- check
- bump_version
- build_android:
context:
- app_signing_android
requires:
- check
- bump_version
unless:
or:
- equal:
- main
- << pipeline.git.branch >>
- << pipeline.parameters.api_triggered >>
commit_main:
jobs:
- bump_version
- build_android:
context:
- app_signing_android
requires:
- bump_version
when:
and:
- equal:
- main
- << pipeline.git.branch >>
- not: << pipeline.parameters.api_triggered >>
production_delivery:
jobs:
- bump_version:
context:
- github
prepare_delivery: true
- build_android:
context:
- app_signing_android
requires:
- bump_version
- deliver_android:
context:
- github
- gruene_google_playstore
production_delivery: true
requires:
- build_android
- build_ios:
context:
- app_signing_ios
requires:
- bump_version
- deliver_ios:
context:
- github
- gruene_apple_appstore
production_delivery: true
requires:
- build_ios
when:
and:
- << pipeline.parameters.api_triggered >>
- equal:
- << pipeline.parameters.workflow_type >>
- production_delivery
promotion:
jobs:
- promote_android:
context:
- github
- gruene_google_playstore
- promote_ios:
context:
- github
- gruene_apple_appstore
when:
and:
- << pipeline.parameters.api_triggered >>
- equal:
- << pipeline.parameters.workflow_type >>
- promotion