-
-
Notifications
You must be signed in to change notification settings - Fork 10
280 lines (231 loc) Β· 7.79 KB
/
main.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
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
name: ci
on:
pull_request:
branches:
- main
jobs:
# Ensures that every PR has a semantic title or commit.
semantic_pull_request:
uses: VeryGoodOpenSource/very_good_workflows/.github/workflows/semantic_pull_request.yml@v1
# Enforces the spelling of words in the repository.
spell_check:
uses: VeryGoodOpenSource/very_good_workflows/.github/workflows/spell_check.yml@v1
with:
config: cspell.json
includes: |
**/*.{dart,md,yaml}
!.dart_tool/**/*.{dart,yaml}
.*/**/*.yml
runs_on: macos-latest
modified_files_only: false
# Format and build the docs. This job will always run but it will end early
# if the docs haven't changed.
docs:
runs-on: ubuntu-latest
steps:
- name: π Git Checkout
uses: actions/checkout@v3
- name: βοΈ Setup Change Filters
uses: dorny/paths-filter@v2
id: changes
with:
filters: |
docs:
- '.github/actions/docs/action.yaml'
- 'docs/**'
- name: π Format, Lint and Build Docs
uses: ./.github/actions/docs
if: steps.changes.outputs.docs == 'true'
# Format, analyze, and test the example code. This job will always run but it will end
# early if the example code hasn't changed.
example:
runs-on: ubuntu-latest
steps:
- name: π Git Checkout
uses: actions/checkout@v3
- name: βοΈ Setup Change Filters
uses: dorny/paths-filter@v2
id: changes
with:
filters: |
example:
- '.github/actions/flutter_package/action.yaml'
- 'example/**'
- name: π Format, Analyze and Test Example
uses: ./.github/actions/flutter_package
if: steps.changes.outputs.example == 'true'
with:
working_directory: example
# Generate a map of items in the output, each key indicates
# a certain group where it's value is a list of "types" that
# had changes within the scope of that group.
changes:
runs-on: ubuntu-latest
permissions:
pull-requests: read
outputs:
packages: ${{ steps.packages.outputs.changes }}
bricks: ${{ steps.bricks.outputs.changes }}
actions: ${{ steps.actions.outputs.changes }}
steps:
- uses: dorny/paths-filter@v2
id: packages
with:
filters: |
fluttium:
- ./.github/actions/flutter_package
- packages/fluttium/**
fluttium_cli:
- ./.github/actions/dart_package
- packages/fluttium_cli/**
fluttium_driver:
- ./.github/actions/dart_package
- packages/fluttium_driver/**
fluttium_interfaces:
- ./.github/actions/dart_package
- packages/fluttium_interfaces/**
fluttium_protocol:
- ./.github/actions/dart_package
- packages/fluttium_protocol/**
- uses: dorny/paths-filter@v2
id: bricks
with:
filters: |
fluttium_launcher:
- ./.github/actions/dart_package
- bricks/fluttium_launcher/hooks/**
fluttium_test_runner:
- ./.github/actions/dart_package
- bricks/fluttium_test_runner/hooks/**
- uses: dorny/paths-filter@v2
id: actions
with:
filters: |
log_action:
- ./.github/actions/flutter_package
- actions/log_action/**
# Run pana on the packages that have changed.
#
# If the matrix is empty, no jobs will be created.
pana_packages:
needs: changes
if: ${{ needs.changes.outputs.packages != '[]' }}
# TODO(wolfen): remove after release of packages
continue-on-error: true
strategy:
matrix:
package: ${{ fromJSON(needs.changes.outputs.packages) }}
runs-on: ubuntu-latest
steps:
- name: π Git Checkout
uses: actions/checkout@v3
- name: π Verify Pana Score (${{ matrix.package }})
uses: ./.github/actions/pana
with:
working_directory: packages/${{ matrix.package }}
# Build and test the dart packages that have changed.
#
# If the matrix is empty, no jobs will be created.
build_packages:
needs: changes
if: ${{ needs.changes.outputs.packages != '[]' }}
strategy:
matrix:
package: ${{ fromJSON(needs.changes.outputs.packages) }}
runs-on: ubuntu-latest
steps:
- name: π Git Checkout
uses: actions/checkout@v3
- name: β Dart Or Flutter
id: dart_or_flutter
run: |
echo "dart_or_flutter=$(cat packages/${{ matrix.package }}/pubspec.yaml | grep -q 'sdk: flutter' && echo true || echo false)" >> $GITHUB_OUTPUT
- name: π¦ Dart Format, Analyze and Test (${{ matrix.package }})
if: steps.dart_or_flutter.outputs.dart_or_flutter == 'false'
uses: ./.github/actions/dart_package
with:
working_directory: packages/${{ matrix.package }}
- name: π Flutter Format, Analyze and Test (${{ matrix.package }})
if: steps.dart_or_flutter.outputs.dart_or_flutter == 'true'
uses: ./.github/actions/flutter_package
with:
working_directory: packages/${{ matrix.package }}
# Build and test the bricks that have changed.
#
# If the matrix is empty, no jobs will be created.
build_bricks:
needs: changes
if: ${{ needs.changes.outputs.bricks != '[]' }}
strategy:
matrix:
brick: ${{ fromJSON(needs.changes.outputs.bricks) }}
runs-on: ubuntu-latest
steps:
- name: π Git Checkout
uses: actions/checkout@v3
- name: β¨ Format, Analyze and Test (${{ matrix.brick }})
uses: ./.github/actions/dart_package
with:
working_directory: bricks/${{ matrix.brick }}/hooks
analyze_directories: .
report_on: post_gen.dart,pre_gen.dart
# Run pana on the actions that have changed.
#
# If the matrix is empty, no jobs will be created.
pana_actions:
needs: changes
if: ${{ needs.changes.outputs.actions != '[]' }}
# TODO(wolfen): remove after release of packages
continue-on-error: true
strategy:
matrix:
package: ${{ fromJSON(needs.changes.outputs.actions) }}
runs-on: ubuntu-latest
steps:
- name: π Git Checkout
uses: actions/checkout@v3
- name: π Verify Pana Score (${{ matrix.package }})
uses: ./.github/actions/pana
with:
working_directory: actions/${{ matrix.package }}
# Build and test the actions that have changed.
#
# If the matrix is empty, no jobs will be created.
build_actions:
needs: changes
if: ${{ needs.changes.outputs.actions != '[]' }}
strategy:
matrix:
brick: ${{ fromJSON(needs.changes.outputs.actions) }}
runs-on: ubuntu-latest
steps:
- name: π Git Checkout
uses: actions/checkout@v3
- name: β¨ Format, Analyze and Test (${{ matrix.brick }})
uses: ./.github/actions/flutter_package
with:
working_directory: actions/${{ matrix.brick }}
# Simply exists to be the final job in the workflow. This is required to
# ensure that the workflow fails if any of the needed jobs fail.
#
# The build and pana job might not spawn but as long as the other jobs
# succeed this job will be considered successful through skipping.
ci:
needs:
[
semantic_pull_request,
spell_check,
docs,
example,
pana_packages,
pana_actions,
build_packages,
build_bricks,
build_actions,
]
if: ${{ always() }}
runs-on: ubuntu-latest
steps:
- name: Exit out if failed
if: ${{ contains(join(needs.*.result, ','), 'failure') }}
run: exit 1