@@ -35,6 +35,23 @@ tasks:
3535 deps :
3636 - task : go:build
3737
38+ check :
39+ desc : Check for problems with the project
40+ cmds :
41+ - task : ci:validate
42+ - task : general:check-formatting
43+ - task : general:check-spelling
44+ - task : go:test
45+ - task : go:test-integration
46+ - task : go:vet
47+ - task : go:lint
48+ - task : markdown:lint
49+ - task : markdown:check-links
50+ - task : python:lint
51+ - task : shell:check
52+ - task : shell:check-mode
53+ - task : website:check
54+
3855 fix :
3956 desc : Make automated corrections to the project's files
4057 deps :
@@ -47,12 +64,101 @@ tasks:
4764 - task : python:format
4865 - task : shell:format
4966
67+ # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-workflows-task/Taskfile.yml
68+ ci:validate :
69+ desc : Validate GitHub Actions workflows against their JSON schema
70+ vars :
71+ # Source: https://github.com/SchemaStore/schemastore/blob/master/src/schemas/json/github-workflow.json
72+ WORKFLOW_SCHEMA_URL : https://json.schemastore.org/github-workflow
73+ WORKFLOW_SCHEMA_PATH :
74+ sh : mktemp -t workflow-schema-XXXXXXXXXX.json
75+ WORKFLOWS_DATA_PATH : " ./.github/workflows/*.{yml,yaml}"
76+ cmds :
77+ - |
78+ wget \
79+ --quiet \
80+ --output-document="{{.WORKFLOW_SCHEMA_PATH}}" \
81+ {{.WORKFLOW_SCHEMA_URL}}
82+ - |
83+ npx \
84+ --package=ajv-cli \
85+ --package=ajv-formats \
86+ ajv validate \
87+ --all-errors \
88+ --strict=false \
89+ -c ajv-formats \
90+ -s "{{.WORKFLOW_SCHEMA_PATH}}" \
91+ -d "{{.WORKFLOWS_DATA_PATH}}"
92+
93+ # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/deploy-cobra-mkdocs-versioned-poetry/Taskfile.yml
94+ docs:generate :
95+ desc : Create all generated documentation content
96+ deps :
97+ - task : go:cli-docs
98+ # Make the formatting consistent with the non-generated Markdown
99+ - task : general:format-prettier
100+
101+ # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-general-formatting-task/Taskfile.yml
102+ general:check-formatting :
103+ desc : Check basic formatting style of all files
104+ cmds :
105+ - |
106+ if ! which ec &>/dev/null; then
107+ echo "ec not found or not in PATH. Please install: https://github.com/editorconfig-checker/editorconfig-checker#installation"
108+ exit 1
109+ fi
110+ - ec
111+
112+ # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/spell-check-task/Taskfile.yml
113+ general:check-spelling :
114+ desc : Check for commonly misspelled words
115+ deps :
116+ - task : poetry:install-deps
117+ cmds :
118+ - poetry run codespell
119+
120+ # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/spell-check-task/Taskfile.yml
121+ general:correct-spelling :
122+ desc : Correct commonly misspelled words where possible
123+ deps :
124+ - task : poetry:install-deps
125+ cmds :
126+ - poetry run codespell --write-changes
127+
128+ # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-prettier-formatting-task/Taskfile.yml
129+ general:format-prettier :
130+ desc : Format all supported files with Prettier
131+ cmds :
132+ - npx prettier --write .
133+
50134 # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/go-task/Taskfile.yml
51135 go:build :
52136 desc : Build the Go code
53137 cmds :
54138 - go build -v {{.LDFLAGS}}
55139
140+ # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/deploy-cobra-mkdocs-versioned-poetry/Taskfile.yml
141+ go:cli-docs :
142+ desc : Generate command line interface reference documentation
143+ dir : ./docsgen
144+ cmds :
145+ # Command examples use os.Args[0] so the docs generation binary must have the same filename as the project
146+ - go build -o {{.PROJECT_NAME}}{{exeExt}}
147+ # The binary is invoked like this instead of `./{{.PROJECT_NAME}}` to remove the `./` chars from the examples
148+ - PATH=. {{.PROJECT_NAME}} ../docs/commands
149+
150+ # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-go-task/Taskfile.yml
151+ go:fix :
152+ desc : Modernize usages of outdated APIs
153+ cmds :
154+ - go fix {{default .DEFAULT_GO_PACKAGES .GO_PACKAGES}}
155+
156+ # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-go-task/Taskfile.yml
157+ go:format :
158+ desc : Format Go code
159+ cmds :
160+ - go fmt {{default .DEFAULT_GO_PACKAGES .GO_PACKAGES}}
161+
56162 go:generate :
57163 desc : Generate Go code
58164 cmds :
@@ -63,6 +169,20 @@ tasks:
63169 - go generate ./...
64170 - task : go:format
65171
172+ # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-go-task/Taskfile.yml
173+ go:lint :
174+ desc : Lint Go code
175+ cmds :
176+ - |
177+ if ! which golint &>/dev/null; then
178+ echo "golint not installed or not in PATH. Please install: https://github.com/golang/lint#installation"
179+ exit 1
180+ fi
181+ - |
182+ golint \
183+ {{default "-min_confidence 0.8 -set_exit_status" .GO_LINT_FLAGS}} \
184+ {{default .DEFAULT_GO_PACKAGES .GO_PACKAGES}}
185+
66186 # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/test-go-task/Taskfile.yml
67187 go:test :
68188 desc : Run unit tests
@@ -85,67 +205,12 @@ tasks:
85205 cmds :
86206 - poetry run pytest tests
87207
88- check :
89- desc : Check for problems with the project
90- cmds :
91- - task : ci:validate
92- - task : general:check-formatting
93- - task : general:check-spelling
94- - task : go:test
95- - task : go:test-integration
96- - task : go:vet
97- - task : go:lint
98- - task : markdown:lint
99- - task : markdown:check-links
100- - task : python:lint
101- - task : shell:check
102- - task : shell:check-mode
103- - task : website:check
104-
105208 # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-go-task/Taskfile.yml
106209 go:vet :
107210 desc : Check for errors in Go code
108211 cmds :
109212 - go vet {{default .DEFAULT_GO_PACKAGES .GO_PACKAGES}}
110213
111- # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-go-task/Taskfile.yml
112- go:fix :
113- desc : Modernize usages of outdated APIs
114- cmds :
115- - go fix {{default .DEFAULT_GO_PACKAGES .GO_PACKAGES}}
116-
117- # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-go-task/Taskfile.yml
118- go:lint :
119- desc : Lint Go code
120- cmds :
121- - |
122- if ! which golint &>/dev/null; then
123- echo "golint not installed or not in PATH. Please install: https://github.com/golang/lint#installation"
124- exit 1
125- fi
126- - |
127- golint \
128- {{default "-min_confidence 0.8 -set_exit_status" .GO_LINT_FLAGS}} \
129- {{default .DEFAULT_GO_PACKAGES .GO_PACKAGES}}
130-
131- # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-go-task/Taskfile.yml
132- go:format :
133- desc : Format Go code
134- cmds :
135- - go fmt {{default .DEFAULT_GO_PACKAGES .GO_PACKAGES}}
136-
137- # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-markdown-task/Taskfile.yml
138- markdown:lint :
139- desc : Check for problems in Markdown files
140- cmds :
141- - npx markdownlint-cli "**/*.md"
142-
143- # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-markdown-task/Taskfile.yml
144- markdown:fix :
145- desc : Automatically correct linting violations in Markdown files where possible
146- cmds :
147- - npx markdownlint-cli --fix "**/*.md"
148-
149214 # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-markdown-task/Taskfile.yml
150215 markdown:check-links :
151216 desc : Check for broken links
@@ -189,6 +254,18 @@ tasks:
189254 '
190255 fi
191256
257+ # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-markdown-task/Taskfile.yml
258+ markdown:fix :
259+ desc : Automatically correct linting violations in Markdown files where possible
260+ cmds :
261+ - npx markdownlint-cli --fix "**/*.md"
262+
263+ # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-markdown-task/Taskfile.yml
264+ markdown:lint :
265+ desc : Check for problems in Markdown files
266+ cmds :
267+ - npx markdownlint-cli "**/*.md"
268+
192269 # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/poetry-task/Taskfile.yml
193270 poetry:install-deps :
194271 desc : Install dependencies managed by Poetry
@@ -201,14 +278,6 @@ tasks:
201278 cmds :
202279 - poetry update
203280
204- # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-python-task/Taskfile.yml
205- python:lint :
206- desc : Lint Python code
207- deps :
208- - task : poetry:install-deps
209- cmds :
210- - poetry run flake8 --show-source
211-
212281 # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-python-task/Taskfile.yml
213282 python:format :
214283 desc : Format Python files
@@ -217,41 +286,13 @@ tasks:
217286 cmds :
218287 - poetry run black .
219288
220- # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/deploy-cobra-mkdocs-versioned-poetry/Taskfile.yml
221- docs:generate :
222- desc : Create all generated documentation content
223- deps :
224- - task : go:cli-docs
225- # Make the formatting consistent with the non-generated Markdown
226- - task : general:format-prettier
227-
228- # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/deploy-cobra-mkdocs-versioned-poetry/Taskfile.yml
229- go:cli-docs :
230- desc : Generate command line interface reference documentation
231- dir : ./docsgen
232- cmds :
233- # Command examples use os.Args[0] so the docs generation binary must have the same filename as the project
234- - go build -o {{.PROJECT_NAME}}{{exeExt}}
235- # The binary is invoked like this instead of `./{{.PROJECT_NAME}}` to remove the `./` chars from the examples
236- - PATH=. {{.PROJECT_NAME}} ../docs/commands
237-
238- # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-mkdocs-task/Taskfile.yml
239- website:check :
240- desc : Check whether the MkDocs-based website will build
241- deps :
242- - task : docs:generate
243- - task : poetry:install-deps
244- cmds :
245- - poetry run mkdocs build --strict
246-
247- # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-mkdocs-task/Taskfile.yml
248- website:serve :
249- desc : Run website locally
289+ # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-python-task/Taskfile.yml
290+ python:lint :
291+ desc : Lint Python code
250292 deps :
251- - task : docs:generate
252293 - task : poetry:install-deps
253294 cmds :
254- - poetry run mkdocs serve
295+ - poetry run flake8 --show-source
255296
256297 # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-shell-task/Taskfile.yml
257298 shell:check :
@@ -281,17 +322,6 @@ tasks:
281322 \)
282323 )
283324
284- # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-shell-task/Taskfile.yml
285- shell:format :
286- desc : Format shell script files
287- cmds :
288- - |
289- if ! which shfmt &>/dev/null; then
290- echo "shfmt not installed or not in PATH. Please install: https://github.com/mvdan/sh#shfmt"
291- exit 1
292- fi
293- - shfmt -w .
294-
295325 # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-shell-task/Taskfile.yml
296326 shell:check-mode :
297327 desc : Check for non-executable shell scripts
@@ -321,61 +351,31 @@ tasks:
321351 )"
322352 exit $EXIT_STATUS
323353
324- # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-workflows-task/Taskfile.yml
325- ci:validate :
326- desc : Validate GitHub Actions workflows against their JSON schema
327- vars :
328- # Source: https://github.com/SchemaStore/schemastore/blob/master/src/schemas/json/github-workflow.json
329- WORKFLOW_SCHEMA_URL : https://json.schemastore.org/github-workflow
330- WORKFLOW_SCHEMA_PATH :
331- sh : mktemp -t workflow-schema-XXXXXXXXXX.json
332- WORKFLOWS_DATA_PATH : " ./.github/workflows/*.{yml,yaml}"
333- cmds :
334- - |
335- wget \
336- --quiet \
337- --output-document="{{.WORKFLOW_SCHEMA_PATH}}" \
338- {{.WORKFLOW_SCHEMA_URL}}
339- - |
340- npx \
341- --package=ajv-cli \
342- --package=ajv-formats \
343- ajv validate \
344- --all-errors \
345- --strict=false \
346- -c ajv-formats \
347- -s "{{.WORKFLOW_SCHEMA_PATH}}" \
348- -d "{{.WORKFLOWS_DATA_PATH}}"
349-
350- # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-general-formatting-task/Taskfile.yml
351- general:check-formatting :
352- desc : Check basic formatting style of all files
354+ # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-shell-task/Taskfile.yml
355+ shell:format :
356+ desc : Format shell script files
353357 cmds :
354358 - |
355- if ! which ec &>/dev/null; then
356- echo "ec not found or not in PATH. Please install: https://github.com/editorconfig-checker/editorconfig-checker#installation "
359+ if ! which shfmt &>/dev/null; then
360+ echo "shfmt not installed or not in PATH. Please install: https://github.com/mvdan/sh#shfmt "
357361 exit 1
358362 fi
359- - ec
360-
361- # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-prettier-formatting-task/Taskfile.yml
362- general:format-prettier :
363- desc : Format all supported files with Prettier
364- cmds :
365- - npx prettier --write .
363+ - shfmt -w .
366364
367- # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/spell- check-task/Taskfile.yml
368- general :check-spelling :
369- desc : Check for commonly misspelled words
365+ # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-mkdocs -task/Taskfile.yml
366+ website :check :
367+ desc : Check whether the MkDocs-based website will build
370368 deps :
369+ - task : docs:generate
371370 - task : poetry:install-deps
372371 cmds :
373- - poetry run codespell
372+ - poetry run mkdocs build --strict
374373
375- # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/spell- check-task/Taskfile.yml
376- general:correct-spelling :
377- desc : Correct commonly misspelled words where possible
374+ # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-mkdocs -task/Taskfile.yml
375+ website:serve :
376+ desc : Run website locally
378377 deps :
378+ - task : docs:generate
379379 - task : poetry:install-deps
380380 cmds :
381- - poetry run codespell --write-changes
381+ - poetry run mkdocs serve
0 commit comments