|
39 | 39 | )
|
40 | 40 |
|
41 | 41 | tasks:
|
| 42 | + # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-workflows-task/Taskfile.yml |
| 43 | + ci:validate: |
| 44 | + desc: Validate GitHub Actions workflows against their JSON schema |
| 45 | + vars: |
| 46 | + # Source: https://github.com/SchemaStore/schemastore/blob/master/src/schemas/json/github-workflow.json |
| 47 | + WORKFLOW_SCHEMA_URL: https://json.schemastore.org/github-workflow |
| 48 | + WORKFLOW_SCHEMA_PATH: |
| 49 | + sh: task utility:mktemp-file TEMPLATE="workflow-schema-XXXXXXXXXX.json" |
| 50 | + WORKFLOWS_DATA_PATH: "./.github/workflows/*.{yml,yaml}" |
| 51 | + deps: |
| 52 | + - task: npm:install-deps |
| 53 | + cmds: |
| 54 | + - | |
| 55 | + wget \ |
| 56 | + --quiet \ |
| 57 | + --output-document="{{.WORKFLOW_SCHEMA_PATH}}" \ |
| 58 | + {{.WORKFLOW_SCHEMA_URL}} |
| 59 | + - | |
| 60 | + npx \ |
| 61 | + --package=ajv-cli \ |
| 62 | + --package=ajv-formats \ |
| 63 | + ajv validate \ |
| 64 | + --all-errors \ |
| 65 | + --strict=false \ |
| 66 | + -c ajv-formats \ |
| 67 | + -s "{{.WORKFLOW_SCHEMA_PATH}}" \ |
| 68 | + -d "{{.WORKFLOWS_DATA_PATH}}" |
| 69 | +
|
| 70 | + docs:generate: |
| 71 | + desc: Create all generated documentation content |
| 72 | + # This is an "umbrella" task used to call any documentation generation processes the project has. |
| 73 | + # It can be left empty if there are none. |
| 74 | + |
42 | 75 | download-dfu-util:
|
43 | 76 | desc: download dfu-util and copy the files in the correct dir
|
44 | 77 | cmds:
|
|
56 | 89 | # for some reason quirks.c has the exec flag set
|
57 | 90 | chmod -x dfu-util_quirks.c
|
58 | 91 | fi
|
59 |
| - |
| 92 | +
|
60 | 93 | download-libusb:
|
61 | 94 | desc: download libusb and copy the files in the correct dir
|
62 | 95 | cmds:
|
@@ -138,33 +171,80 @@ tasks:
|
138 | 171 | cmds:
|
139 | 172 | - go vet {{default .DEFAULT_GO_PACKAGES .GO_PACKAGES}}
|
140 | 173 |
|
141 |
| - # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-workflows-task/Taskfile.yml |
142 |
| - ci:validate: |
143 |
| - desc: Validate GitHub Actions workflows against their JSON schema |
144 |
| - vars: |
145 |
| - # Source: https://github.com/SchemaStore/schemastore/blob/master/src/schemas/json/github-workflow.json |
146 |
| - WORKFLOW_SCHEMA_URL: https://json.schemastore.org/github-workflow |
147 |
| - WORKFLOW_SCHEMA_PATH: |
148 |
| - sh: task utility:mktemp-file TEMPLATE="workflow-schema-XXXXXXXXXX.json" |
149 |
| - WORKFLOWS_DATA_PATH: "./.github/workflows/*.{yml,yaml}" |
| 174 | + # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-markdown-task/Taskfile.yml |
| 175 | + markdown:check-links: |
| 176 | + desc: Check for broken links |
150 | 177 | deps:
|
| 178 | + - task: docs:generate |
151 | 179 | - task: npm:install-deps
|
152 | 180 | cmds:
|
153 | 181 | - |
|
154 |
| - wget \ |
155 |
| - --quiet \ |
156 |
| - --output-document="{{.WORKFLOW_SCHEMA_PATH}}" \ |
157 |
| - {{.WORKFLOW_SCHEMA_URL}} |
158 |
| - - | |
159 |
| - npx \ |
160 |
| - --package=ajv-cli \ |
161 |
| - --package=ajv-formats \ |
162 |
| - ajv validate \ |
163 |
| - --all-errors \ |
164 |
| - --strict=false \ |
165 |
| - -c ajv-formats \ |
166 |
| - -s "{{.WORKFLOW_SCHEMA_PATH}}" \ |
167 |
| - -d "{{.WORKFLOWS_DATA_PATH}}" |
| 182 | + if [[ "{{.OS}}" == "Windows_NT" ]]; then |
| 183 | + # npx --call uses the native shell, which makes it too difficult to use npx for this application on Windows, |
| 184 | + # so the Windows user is required to have markdown-link-check installed and in PATH. |
| 185 | + if ! which markdown-link-check &>/dev/null; then |
| 186 | + echo "markdown-link-check not found or not in PATH." |
| 187 | + echo "Please install: https://github.com/tcort/markdown-link-check#readme" |
| 188 | + exit 1 |
| 189 | + fi |
| 190 | + # Default behavior of the task on Windows is to exit the task when the first broken link causes a non-zero |
| 191 | + # exit status, but it's better to check all links before exiting. |
| 192 | + set +o errexit |
| 193 | + STATUS=0 |
| 194 | + # Using -regex instead of -name to avoid Task's behavior of globbing even when quoted on Windows |
| 195 | + # The odd method for escaping . in the regex is required for windows compatibility because mvdan.cc/sh gives |
| 196 | + # \ characters special treatment on Windows in an attempt to support them as path separators. |
| 197 | + for file in $( |
| 198 | + find . \ |
| 199 | + -type d -name '.git' -prune -o \ |
| 200 | + -type d -name '.licenses' -prune -o \ |
| 201 | + -type d -name '__pycache__' -prune -o \ |
| 202 | + -type d -name 'node_modules' -prune -o \ |
| 203 | + -regex ".*[.]md" -print |
| 204 | + ); do |
| 205 | + markdown-link-check \ |
| 206 | + --quiet \ |
| 207 | + --config "./.markdown-link-check.json" \ |
| 208 | + "$file" |
| 209 | + STATUS=$(( $STATUS + $? )) |
| 210 | + done |
| 211 | + exit $STATUS |
| 212 | + else |
| 213 | + npx --package=markdown-link-check --call=' |
| 214 | + STATUS=0 |
| 215 | + for file in $( |
| 216 | + find . \ |
| 217 | + -type d -name '.git' -prune -o \ |
| 218 | + -type d -name '.licenses' -prune -o \ |
| 219 | + -type d -name '__pycache__' -prune -o \ |
| 220 | + -type d -name 'node_modules' -prune -o \ |
| 221 | + -regex ".*[.]md" -print |
| 222 | + ); do |
| 223 | + markdown-link-check \ |
| 224 | + --quiet \ |
| 225 | + --config "./.markdown-link-check.json" \ |
| 226 | + "$file" |
| 227 | + STATUS=$(( $STATUS + $? )) |
| 228 | + done |
| 229 | + exit $STATUS |
| 230 | + ' |
| 231 | + fi |
| 232 | +
|
| 233 | + # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-markdown-task/Taskfile.yml |
| 234 | + markdown:fix: |
| 235 | + desc: Automatically correct linting violations in Markdown files where possible |
| 236 | + deps: |
| 237 | + - task: npm:install-deps |
| 238 | + cmds: |
| 239 | + - npx markdownlint-cli --fix "**/*.md" |
| 240 | + |
| 241 | + # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-markdown-task/Taskfile.yml |
| 242 | + markdown:lint: |
| 243 | + desc: Check for problems in Markdown files |
| 244 | + deps: |
| 245 | + - task: npm:install-deps |
| 246 | + cmds: |
| 247 | + - npx markdownlint-cli "**/*.md" |
168 | 248 |
|
169 | 249 | # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/npm-task/Taskfile.yml
|
170 | 250 | npm:install-deps:
|
|
0 commit comments