forked from orevial/flutter-ci-cd-demo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmelos.yaml
209 lines (179 loc) · 7.1 KB
/
melos.yaml
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
name: flutter_ci_cd_demo
packages:
- app
- design_system
scripts:
###############################################
## BUILD COMMANDS ##
###############################################
build:pub_get:all:
run: flutter pub get
exec:
concurrency: 6
description: Install all dependencies
build:clean:
run: |
flutter clean && \
flutter pub get
exec:
concurrency: 6
description: Clean Flutter package and install dependencies
build:clean:all:
run: melos run --no-select build:clean
description: Clean Flutter package and install dependencies for all packages
build:codegen:build:
run: flutter pub run build_runner build --delete-conflicting-outputs
exec:
concurrency: 1
orderDependents: true
select-package:
depends-on: "build_runner"
description: Run code generation using build_runner in a specific package
build:codegen:build:all:
run: melos run build:codegen:build --no-select
description: Run code generation using build_runner for all packages in the project
build:codegen:watch:
run: flutter pub run build_runner watch --delete-conflicting-outputs
exec:
concurrency: 1
orderDependents: true
select-package:
depends-on: "build_runner"
description: Run code generation using build_runner in a specific package, and watch any changes in this package
build:build-dev-app:
exec: flutter build appbundle --release --flavor dev -t lib/main_dev.dart
description: Build dev app
select-package:
scope: "flutter_ci_cd_demo"
build:build-uat-app:
exec: flutter build appbundle --release --flavor uat -t lib/main_uat.dart
description: Build UAT app
select-package:
scope: "flutter_ci_cd_demo"
build:build-prod-app:
exec: flutter build appbundle --release --flavor prod -t lib/main_prod.dart
description: Build prod app
select-package:
scope: "flutter_ci_cd_demo"
###############################################
## QUALITY COMMANDS ##
###############################################
quality:analyze:
exec: |
flutter analyze --no-fatal-infos --no-fatal-warnings && \
flutter pub run dart_code_metrics:metrics analyze --no-fatal-warnings . && \
flutter format .
select-package:
dir-exists:
- lib
description: |
Run Flutter static analysis checks and format
Note: you can also rely on your IDEs Dart Analysis / Issues window.
quality:analyze:all:
run: melos run --no-select quality:analyze
description: |
Run Flutter static analysis checks and format all packages
Note: you can also rely on your IDEs Dart Analysis / Issues window.
quality:dcm-checks:
exec: |
flutter pub run dart_code_metrics:metrics check-unnecessary-nullable --no-fatal-found . && \
flutter pub run dart_code_metrics:metrics check-unused-code --no-fatal-unused --exclude "{**.g.dart,**.gen.dart,**.freezed.dart}" . && \
flutter pub run dart_code_metrics:metrics check-unused-files --no-fatal-unused . && \
flutter pub run dart_code_metrics:metrics check-unused-l10n --no-fatal-unused .
select-package:
dir-exists:
- lib
description: Run Dart Code Metrics (DCM) extended checks
quality:dcm-checks:all:
run: melos run --no-select quality:dcm-checks
description: Run Dart Code Metrics (DCM) extended checks on all packages
###############################################
## TEST COMMANDS ##
###############################################
test:
run: flutter test --no-pub --reporter compact
exec:
concurrency: 6
select-package:
dir-exists:
- test
description: Run `flutter test` for a specific package.
test:all:
run: melos run test --no-select
description: Run all Flutter tests in this project.
test:update-goldens:
run: flutter test --no-pub --reporter compact --update-goldens
exec:
concurrency: 6
select-package:
dir-exists:
- test
scope:
- "design_system"
- "flutter_ci_cd_demo"
description: Run `flutter test` and update goldens for a specific package.
test:update-goldens:all:
run: melos run test:update-goldens --no-select
description: Run Flutter tests and update goldens for all packages in this project
test:with-lcov-coverage:
run: MELOS_ROOT_PATH/scripts/test-with-coverage.sh MELOS_ROOT_PATH MELOS_PACKAGE_PATH MELOS_PACKAGE_NAME
exec:
concurrency: 6
select-package:
dir-exists:
- test
description: Run Flutter tests and publish local lcov coverage for a specific package
test:with-lcov-coverage:all:
run: |
melos run test:with-lcov-coverage --no-select && \
melos run test:combine-coverage
description: Run Flutter tests for all packages and generate a combined lcov coverage report
test:with-html-coverage:
run: |
MELOS_ROOT_PATH/scripts/test-with-coverage.sh MELOS_ROOT_PATH MELOS_PACKAGE_PATH MELOS_PACKAGE_NAME && \
melos run test:combine-coverage && \
melos run test:generate-html-coverage
exec:
concurrency: 6
select-package:
dir-exists:
- test
description: Run Flutter tests for a specific package and updates global HTML coverage report
test:with-html-coverage:all:
run: |
melos run test:with-lcov-coverage --no-select && \
melos run test:combine-coverage && \
melos run test:generate-html-coverage
echo "🧪📊 You can find coverage report in the following folder: MELOS_ROOT_PATH/coverage_report/index.html\n\n💡To open it just run: open MELOS_ROOT_PATH/coverage_report/index.html"
description: Run Flutter tests for all packages and generate a combined HTML coverage report
test:with-html-coverage:all:auto-open:
run: |
melos run test:with-lcov-coverage --no-select && \
melos run test:combine-coverage && \
melos run test:generate-html-coverage
open MELOS_ROOT_PATH/coverage_report/index.html
description: Run Flutter tests for all packages and generate a combined HTML coverage report
test:combine-coverage:
run: MELOS_ROOT_PATH/scripts/combine-coverage.sh MELOS_ROOT_PATH
description: Combine individual lcov coverage into a single lcov coverage file
test:generate-html-coverage:
run: MELOS_ROOT_PATH/scripts/generate-html-coverage.sh MELOS_ROOT_PATH
description: Take combined lcov file and generate a human-readable HTML report
run:dev-app:
exec: flutter run -t 'MELOS_ROOT_PATH/app/lib/main_dev.dart' --flavor dev
select-package:
scope: "flutter_ci_cd_demo"
###############################################
## RUN COMMANDS ##
###############################################
run:uat-app:
exec: flutter run -t 'MELOS_ROOT_PATH/app/lib/main_uat.dart' --flavor uat
select-package:
scope: "flutter_ci_cd_demo"
run:prod-app:
exec: flutter run -t 'MELOS_ROOT_PATH/app/lib/main_prod.dart' --flavor prod
select-package:
scope: "flutter_ci_cd_demo"
environment:
sdk: '>=2.19.0 <3.0.0'
flutter: ">=3.7.0 <4.0.0"