-
Notifications
You must be signed in to change notification settings - Fork 0
/
Taskfile.yaml
334 lines (315 loc) · 9.53 KB
/
Taskfile.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
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
---
version: 3
output: prefixed
# Set the value for the watch interval to take into account the longest running
# task in the set, as if it normally takes longer than the default interval the
# context will be cancelled and the command interrupted, triggering a retry
interval: 5s
includes:
utils:
taskfile: .taskfiles/utils.yaml
internal: true
tasks:
default:
desc: Run the development and integration tasks
summary: |-
Clean the environment and then run the development and integration tasks
for all configurations, testing and checking those code and files, but
only run through once, not continuously.
Use the following command for additional information on the steps involved:
$ task --summary develop
silent: true
cmds:
- task: develop
develop:
aliases:
- dev
desc: Continiously run the development and integration tasks in the background
summary: |-
The develop task is designed to perform continuous integration on code
changes within this repository, first cleaning and then running the
following tasks when any relevant files are changed.
- Lint all supported files, ensuring their layout and syntax are correct.
silent: true
watch: true
deps:
- task: utils:pre-commit
- task: clean
cmds:
- task: lint
lint:
desc: Lint selected files within this repository
summary: |-
Run linting checks across the files in this repository, such as
configuration files and all documentation to find any potential issues
within the repository by running the following steps:
- Parse all JSON, YAML, and Markdown files through Prettier in order to
ensure they are syntactically correct, and that they are consistent in
their layout and usage;
- Parse selected configurations (such as Taskfiles, GitHub Dependabot
configuration, and GitHub Workflows) through JSON Schema to evaluate
these free-from configuration types are correctly structured for their
intended usage (i.e. keys are in the right place, the values are what is
expected or supported, and required settings are present);
- Review the format of Markdown files to ensure they are clean and
minimise the ability for the page to be incorrectly rendered, such as
de-duplicating headers, consistent text width, formatted list items,
and code layouts.
silent: true
cmds:
- task: jsonschema
- task: prettier
- task: markdownlint
- task: shellcheck
- task: shfmt
prettier:
internal: true
silent: true
sources:
- '.*.md'
- '.*.yaml'
- '.*.json'
- '*.md'
- '*.yaml'
- '*.json'
- '.*/**.md'
- '.*/**.yaml'
- '.*/**.json'
- '**/*.md'
- '**/*.yaml'
- '**/*.json'
- '.prettier.yaml'
- '.prettierignore'
- '.gitignore'
# This is not a complete Markdown document, but a partial template which
# is used when creating pull requests within GitHub, so ignore it
- exclude: .github/PULL_REQUEST_TEMPLATE.md
deps:
- task: utils:pre-checks
vars:
files:
sh: |-
find . \
-ignore_readdir_race \
-type f \
\( -iname '*.yaml' \
-or -iname '*.json' \
-or -iname '*.md' \) \
-printf '%P ' \
2>/dev/null || true
cmds:
- cmd: |-
prettier --log-level log \
--write --config .prettier.yaml \
--cache --cache-location .prettiercache \
{{ .files }}
echo -e '\033[0;32mPassed\033[0m'
markdownlint:
internal: true
silent: true
sources:
- '.*.md'
- '*.md'
- '.*/**.md'
- '**/*.md'
- '.markdownlint.yaml'
- '.markdownignore'
- exclude: .github/PULL_REQUEST_TEMPLATE.md
deps:
- task: utils:check:markdownlint
vars:
files:
sh: |-
find . \
-ignore_readdir_race \
-type f \
-not -path '*/node_modules/*' \
-iname '*.md' \
-printf '%P ' \
2>/dev/null || true
cmds:
- cmd: |-
markdownlint \
--config .markdownlint.yaml \
--ignore-path .markdownignore \
{{ .files }}
echo -e '\033[0;32mPassed\033[0m'
jsonschema:
internal: true
silent: true
cmds:
- task: jsonschema:taskfiles
- task: jsonschema:dependabot
- task: jsonschema:workflows
- task: jsonschema:issues
- task: jsonschema:templates
jsonschema:taskfiles:
internal: true
silent: true
sources:
- 'Taskfile.yaml'
- '.taskfiles/*.yaml'
deps:
- task: utils:check:check-jsonschema
cmds:
- cmd: |-
[[ -z "{{ .files }}" ]] && exit 0
check-jsonschema \
--output-format text --no-cache --verbose \
--schemafile https://raw.githubusercontent.com/go-task/task/main/website/static/schema.json \
Taskfile.yaml .taskfiles/*.yaml
echo -e '\033[0;32mPassed\033[0m'
jsonschema:dependabot:
internal: true
silent: true
sources:
- '.github/dependabot.yaml'
deps:
- task: utils:check:check-jsonschema
cmds:
# Check that the dependabot.yaml file exists first, and fail cleanly if
# that is the case, otherwise check-jsonschema will fail the check
- cmd: |-
[[ -f .github/dependabot.yaml ]] || exit 0
check-jsonschema \
--output-format text --no-cache --verbose \
--builtin-schema vendor.dependabot \
.github/dependabot.yaml
echo -e '\033[0;32mPassed\033[0m'
jsonschema:workflows:
internal: true
silent: true
sources:
- '.github/workflows/*.yaml'
deps:
- task: utils:check:check-jsonschema
vars:
files:
sh: |-
find .github/workflows \
-ignore_readdir_race \
-type f \
-iname '*.yaml' \
-printf '.github/workflows/%P ' \
2>/dev/null || true
cmds:
- cmd: |-
[[ -z "{{ .files }}" ]] && exit 0
check-jsonschema \
--output-format text --no-cache --verbose \
--builtin-schema vendor.github-workflows \
{{ .files }}
echo -e '\033[0;32mPassed\033[0m'
jsonschema:issues:
internal: true
silent: true
sources:
- '.github/ISSUE_TEMPLATE/config.yaml'
deps:
- task: utils:check:check-jsonschema
vars:
files:
sh: |-
find .github/ISSUE_TEMPLATE \
-ignore_readdir_race \
-type f \
-iname '*.yaml' \
-printf '.github/ISSUE_TEMPLATE/%P ' \
2>/dev/null || true
cmds:
- cmd: |-
[[ -z "{{ .files }}" ]] && exit 0
check-jsonschema \
--output-format text --no-cache --verbose \
--schemafile https://json.schemastore.org/github-issue-config.json \
{{ .files }}
echo -e '\033[0;32mPassed\033[0m'
jsonschema:templates:
internal: true
silent: true
sources:
- '.github/ISSUE_TEMPLATE/*.yaml'
- exclude: '.github/ISSUE_TEMPLATE/config.yaml'
deps:
- task: utils:check:check-jsonschema
vars:
files:
sh: |-
find .github/ISSUE_TEMPLATE \
-ignore_readdir_race \
-type f \
-iname '*.yaml' \
-and not -iname 'config.yaml' \
-printf '.github/ISSUE_TEMPLATE/%P ' \
2>/dev/null || true
cmds:
- cmd: |-
[[ -z "{{ .files }}" ]] && exit 0
check-jsonschema \
--output-format text --no-cache --verbose \
--schemafile https://json.schemastore.org/github-issue-forms.json \
{{ .files }}
echo -e '\033[0;32mPassed\033[0m'
shellcheck:
internal: true
silent: true
sources:
- 'scripts/bin/*'
- 'scripts/lib/*.sh'
- 'scripts/lib/**/*.sh'
deps:
- task: utils:check:shellcheck
vars:
files:
sh: |-
find scripts/ \
-ignore_readdir_race \
-type f \
-not -iname '*.bats' \
-printf 'scripts/%P ' 2>/dev/null
cmds:
- cmd: |-
[[ -z "{{ .files }}" ]] && exit 0
shellcheck \
--format=tty \
--check-sourced \
--external-sources \
--source-path scripts/lib \
{{ .files }}
echo -e '\033[0;32mPassed\033[0m'
shfmt:
internal: true
silent: true
sources:
- 'scripts/bin/*'
- 'scripts/lib/*.sh'
- 'scripts/lib/**/*.sh'
deps:
- task: utils:check:shfmt
vars:
files:
sh: |-
find scripts/ \
-ignore_readdir_race \
-type f \
-not -iname '*.bats' \
-printf 'scripts/%P ' 2>/dev/null
cmds:
- cmd: |-
[[ -z "{{ .files }}" ]] && exit 0
shfmt \
-l -d -i 2 -bn -ci \
{{ .files }}
echo -e '\033[0;32mPassed\033[0m'
clean:
desc: Clean temporary files from the repository and configurations
silent: true
summary: |-
Clean any temporary directories and files created by both this Taskfile,
and the tools and applications called from it, and from within the
configurations.
run: once
cmds:
- cmd: rm -f .prettiercache
- cmd: rm -rf .task
- cmd: echo -e '\033[0;32mCompleted\033[0m'