@@ -3,16 +3,82 @@ version: "3"
33tasks :
44 build-dummy-discovery :
55 desc : Build the dummy-discovery client example
6+ vars :
7+ EXECUTABLE : dummy-discovery{{if eq OS "windows"}}.exe{{end}}
68 cmds :
7- - go build -o dist/dummy-discovery -v -ldflags '{{.LDFLAGS}}' ./dummy-discovery
9+ - go build -o dist/{{.EXECUTABLE}} -v -ldflags '{{.DUMMY_DISCOVERY_LDFLAGS}}' ./dummy-discovery
10+
11+ # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-workflows-task/Taskfile.yml
12+ ci:validate :
13+ desc : Validate GitHub Actions workflows against their JSON schema
14+ vars :
15+ # Source: https://github.com/SchemaStore/schemastore/blob/master/src/schemas/json/github-workflow.json
16+ WORKFLOW_SCHEMA_URL : https://json.schemastore.org/github-workflow
17+ WORKFLOW_SCHEMA_PATH :
18+ sh : mktemp -t workflow-schema-XXXXXXXXXX.json
19+ WORKFLOWS_DATA_PATH : " ./.github/workflows/*.{yml,yaml}"
20+ cmds :
21+ - |
22+ wget \
23+ --quiet \
24+ --output-document="{{.WORKFLOW_SCHEMA_PATH}}" \
25+ {{.WORKFLOW_SCHEMA_URL}}
26+ - |
27+ npx \
28+ --package=ajv-cli \
29+ --package=ajv-formats \
30+ ajv validate \
31+ --all-errors \
32+ --strict=false \
33+ -c ajv-formats \
34+ -s "{{.WORKFLOW_SCHEMA_PATH}}" \
35+ -d "{{.WORKFLOWS_DATA_PATH}}"
36+
37+ # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-general-formatting-task/Taskfile.yml
38+ general:check-formatting :
39+ desc : Check basic formatting style of all files
40+ cmds :
41+ - |
42+ if ! which ec &>/dev/null; then
43+ echo "ec not found or not in PATH. Please install: https://github.com/editorconfig-checker/editorconfig-checker#installation"
44+ exit 1
45+ fi
46+ - ec
47+
48+ # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/spell-check-task/Taskfile.yml
49+ general:check-spelling :
50+ desc : Check for commonly misspelled words
51+ deps :
52+ - task : poetry:install-deps
53+ cmds :
54+ - poetry run codespell
55+
56+ # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/spell-check-task/Taskfile.yml
57+ general:correct-spelling :
58+ desc : Correct commonly misspelled words where possible
59+ deps :
60+ - task : poetry:install-deps
61+ cmds :
62+ - poetry run codespell --write-changes
63+
64+ # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/poetry-task/Taskfile.yml
65+ poetry:install-deps :
66+ desc : Install dependencies managed by Poetry
67+ cmds :
68+ - poetry install --no-root
69+
70+ # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/poetry-task/Taskfile.yml
71+ poetry:update-deps :
72+ desc : Update all dependencies managed by Poetry to their newest versions
73+ cmds :
74+ - poetry update
875
976vars :
10- PROJECT_NAME : " dummy-discovery"
1177 DIST_DIR : " dist"
12- VERSION :
78+ DUMMY_DISCOVERY_VERSION :
1379 sh : echo "$(git describe --tags --dirty --broken)"
14- TIMESTAMP :
80+ DUMMY_DISCOVERY_TIMESTAMP :
1581 sh : echo "$(date -u +"%Y-%m-%dT%H:%M:%SZ")"
16- LDFLAGS : >
17- -X github.com/arduino/pluggable-discovery-protocol-handler/dummy-discovery/args.Tag={{.VERSION }}
18- -X github.com/arduino/pluggable-discovery-protocol-handler/dummy-discovery/args.Timestamp={{.TIMESTAMP }}
82+ DUMMY_DISCOVERY_LDFLAGS : >
83+ -X github.com/arduino/pluggable-discovery-protocol-handler/dummy-discovery/args.Tag={{.DUMMY_DISCOVERY_VERSION }}
84+ -X github.com/arduino/pluggable-discovery-protocol-handler/dummy-discovery/args.Timestamp={{.DUMMY_DISCOVERY_TIMESTAMP }}
0 commit comments