I originally set out to establish some logical order to the tasks on some indecipherable criteria. In the end, it resulted in a jumble. Alphabetical order is completely objective and it results in a fairly logical order in the end due to the the use of prefixes on the task names according to their domain. The exception is that the convenience "umbrella" tasks have been left at the top (in their own alphabetical order) so that they will have the maximum visibility as the most useful tasks. Even that is not completely inconsistent, since these don't have a namespace prefix, and so might be imagined to have a null global namespace prefix that would be sorted first.
158 lines
5.3 KiB
YAML
158 lines
5.3 KiB
YAML
version: "3"
|
|
|
|
tasks:
|
|
build:
|
|
desc: Build the project
|
|
deps:
|
|
- task: ts:build
|
|
|
|
check:
|
|
desc: Check for problems with the project
|
|
deps:
|
|
- task: action:validate
|
|
- task: general:check-spelling
|
|
- task: markdown:check-links
|
|
- task: markdown:lint
|
|
- task: ts:lint
|
|
- task: ts:test
|
|
|
|
fix:
|
|
desc: Make automated corrections to the project's files
|
|
deps:
|
|
- task: general:correct-spelling
|
|
- task: general:format-prettier
|
|
- task: markdown:fix
|
|
- task: ts:build
|
|
- task: ts:fix-lint
|
|
|
|
action:validate:
|
|
desc: Validate GitHub Actions metadata against JSON schema
|
|
vars:
|
|
ACTION_METADATA_SCHEMA_PATH:
|
|
sh: mktemp -t github-action-schema-XXXXXXXXXX.json
|
|
cmds:
|
|
- wget --quiet --output-document="{{.ACTION_METADATA_SCHEMA_PATH}}" https://json.schemastore.org/github-action
|
|
- npx ajv-cli validate --strict=false -s "{{.ACTION_METADATA_SCHEMA_PATH}}" -d "action.yml"
|
|
|
|
docs:generate:
|
|
desc: Create all generated documentation content
|
|
# This is an "umbrella" task used to call any documentation generation processes the project has.
|
|
# It can be left empty if there are none.
|
|
|
|
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/spell-check-task/Taskfile.yml
|
|
general:check-spelling:
|
|
desc: Check for commonly misspelled words
|
|
deps:
|
|
- task: poetry:install-deps
|
|
cmds:
|
|
- poetry run codespell
|
|
|
|
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/spell-check-task/Taskfile.yml
|
|
general:correct-spelling:
|
|
desc: Correct commonly misspelled words where possible
|
|
deps:
|
|
- task: poetry:install-deps
|
|
cmds:
|
|
- poetry run codespell --write-changes
|
|
|
|
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-prettier-formatting-task/Taskfile.yml
|
|
general:format-prettier:
|
|
desc: Format all supported files with Prettier
|
|
cmds:
|
|
- npx prettier --write .
|
|
|
|
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-markdown-task/Taskfile.yml
|
|
markdown:check-links:
|
|
desc: Check for broken links
|
|
deps:
|
|
- task: docs:generate
|
|
cmds:
|
|
- |
|
|
if [[ "{{.OS}}" == "Windows_NT" ]]; then
|
|
# npx --call uses the native shell, which makes it too difficult to use npx for this application on Windows,
|
|
# so the Windows user is required to have markdown-link-check installed and in PATH.
|
|
if ! which markdown-link-check &>/dev/null; then
|
|
echo "markdown-link-check not found or not in PATH. Please install: https://github.com/tcort/markdown-link-check#readme"
|
|
exit 1
|
|
fi
|
|
# Default behavior of the task on Windows is to exit the task when the first broken link causes a non-zero
|
|
# exit status, but it's better to check all links before exiting.
|
|
set +o errexit
|
|
STATUS=0
|
|
# Using -regex instead of -name to avoid Task's behavior of globbing even when quoted on Windows
|
|
# The odd method for escaping . in the regex is required for windows compatibility because mvdan.cc/sh gives
|
|
# \ characters special treatment on Windows in an attempt to support them as path separators.
|
|
for file in $(find . -regex ".*[.]md"); do
|
|
markdown-link-check \
|
|
--quiet \
|
|
--config "./.markdown-link-check.json" \
|
|
"$file"
|
|
STATUS=$(( $STATUS + $? ))
|
|
done
|
|
exit $STATUS
|
|
else
|
|
npx --package=markdown-link-check --call='
|
|
STATUS=0
|
|
for file in $(find . -regex ".*[.]md"); do
|
|
markdown-link-check \
|
|
--quiet \
|
|
--config "./.markdown-link-check.json" \
|
|
"$file"
|
|
STATUS=$(( $STATUS + $? ))
|
|
done
|
|
exit $STATUS
|
|
'
|
|
fi
|
|
|
|
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-markdown-task/Taskfile.yml
|
|
markdown:fix:
|
|
desc: Automatically correct linting violations in Markdown files where possible
|
|
cmds:
|
|
- npx markdownlint-cli --fix "**/*.md"
|
|
|
|
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-markdown-task/Taskfile.yml
|
|
markdown:lint:
|
|
desc: Check for problems in Markdown files
|
|
cmds:
|
|
- npx markdownlint-cli "**/*.md"
|
|
|
|
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/poetry-task/Taskfile.yml
|
|
poetry:install-deps:
|
|
desc: Install dependencies managed by Poetry
|
|
cmds:
|
|
- poetry install --no-root
|
|
|
|
ts:build:
|
|
desc: Build the action's TypeScript code.
|
|
deps:
|
|
- task: ts:install-deps
|
|
cmds:
|
|
- npx tsc
|
|
- npx ncc build
|
|
|
|
ts:fix-lint:
|
|
desc: Fix TypeScript code linting violations
|
|
deps:
|
|
- task: ts:install-deps
|
|
cmds:
|
|
- npx eslint --ext .js,.jsx,.ts,.tsx --fix .
|
|
|
|
ts:install-deps:
|
|
desc: Install TypeScript dependencies
|
|
cmds:
|
|
- npm install
|
|
|
|
ts:lint:
|
|
desc: Lint TypeScript code
|
|
deps:
|
|
- task: ts:install-deps
|
|
cmds:
|
|
- npx eslint --ext .js,.jsx,.ts,.tsx .
|
|
|
|
ts:test:
|
|
desc: Test the action's TypeScript code.
|
|
deps:
|
|
- task: ts:install-deps
|
|
cmds:
|
|
- npx jest
|