Skip to content

Commit 8647a96

Browse files
committed
Use styleguide-compliant key order in template taskfiles
According to the official styleg uide: https://taskfile.dev/#/styleguide?id=use-the-correct-order-of-keywords The order should be: - version: - includes: - Configuration ones, like output:, expansions: or silent: - vars: - env: - tasks:
1 parent d5acda4 commit 8647a96

File tree

2 files changed

+39
-39
lines changed

2 files changed

+39
-39
lines changed

DistTasks.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ version: "3"
1717
#
1818
# The project MUST contain a LICENSE.txt file in the root folder or packaging will fail.
1919

20+
vars:
21+
CONTAINER: "docker.elastic.co/beats-dev/golang-crossbuild"
22+
GO_VERSION: "1.14.7"
23+
CHECKSUM_FILE: "{{ .VERSION }}-checksums.txt"
24+
2025
tasks:
2126
all:
2227
desc: Build for distribution for all platforms
@@ -205,8 +210,3 @@ tasks:
205210
CONTAINER_TAG: "{{ .GO_VERSION }}-darwin"
206211
PACKAGE_PLATFORM: "macOS_64bit"
207212
PACKAGE_NAME: "{{ .PROJECT_NAME }}_{{ .VERSION }}_{{ .PACKAGE_PLATFORM }}.tar.gz"
208-
209-
vars:
210-
CONTAINER: "docker.elastic.co/beats-dev/golang-crossbuild"
211-
GO_VERSION: "1.14.7"
212-
CHECKSUM_FILE: "{{ .VERSION }}-checksums.txt"

Taskfile.yml

+34-34
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,40 @@ version: "3"
44
includes:
55
dist: ./DistTasks.yml
66

7+
vars:
8+
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/release-go-task/Taskfile.yml
9+
PROJECT_NAME: "arduino-lint"
10+
DIST_DIR: "dist"
11+
DEFAULT_GO_PACKAGES:
12+
sh: echo `go list ./... | grep --invert-match 'github.com/arduino/arduino-lint/internal/rule/schema/schemadata' | tr '\n' ' '`
13+
# build vars
14+
COMMIT:
15+
sh: echo "$(git log --no-show-signature -n 1 --format=%h)"
16+
TIMESTAMP:
17+
sh: echo "$(date -u +"%Y-%m-%dT%H:%M:%SZ")"
18+
TIMESTAMP_SHORT:
19+
sh: echo "{{now | date "20060102"}}"
20+
TAG:
21+
sh: echo "$(git tag --points-at=HEAD 2> /dev/null | head -n1)"
22+
VERSION: "{{ if .NIGHTLY }}nightly-{{ .TIMESTAMP_SHORT }}{{ else if .TAG }}{{ .TAG }}{{ else }}snapshot{{ end }}"
23+
CONFIGURATION_PACKAGE: "github.com/arduino/{{ .PROJECT_NAME }}/internal/configuration"
24+
LDFLAGS: >-
25+
-ldflags
26+
'
27+
-X {{ .CONFIGURATION_PACKAGE }}.version={{.VERSION}}
28+
-X {{ .CONFIGURATION_PACKAGE }}.commit={{.COMMIT}}
29+
-X {{ .CONFIGURATION_PACKAGE }}.buildTimestamp={{.TIMESTAMP}}
30+
'
31+
GOFLAGS: "-timeout 10m -v -coverpkg=./... -covermode=atomic"
32+
DOCS_VERSION: dev
33+
DOCS_ALIAS: ""
34+
DOCS_REMOTE: "origin"
35+
36+
37+
38+
CODESPELL_SKIP_OPTION: '--skip "./.git,go.mod,go.sum,./arduino-lint,./arduino-lint.exe,./internal/rule/rulefunction/testdata/libraries/MisspelledSentenceParagraphValue/library.properties,./site"'
39+
CODESPELL_IGNORE_WORDS_OPTION: "--ignore-words ./etc/codespell-ignore-words-list.txt"
40+
741
tasks:
842
build:
943
desc: Build the project
@@ -369,37 +403,3 @@ tasks:
369403
cmds:
370404
- poetry install --no-root
371405
- poetry run codespell --write-changes {{ .CODESPELL_SKIP_OPTION }} {{ .CODESPELL_IGNORE_WORDS_OPTION }}
372-
373-
vars:
374-
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/release-go-task/Taskfile.yml
375-
PROJECT_NAME: "arduino-lint"
376-
DIST_DIR: "dist"
377-
DEFAULT_GO_PACKAGES:
378-
sh: echo `go list ./... | grep --invert-match 'github.com/arduino/arduino-lint/internal/rule/schema/schemadata' | tr '\n' ' '`
379-
# build vars
380-
COMMIT:
381-
sh: echo "$(git log --no-show-signature -n 1 --format=%h)"
382-
TIMESTAMP:
383-
sh: echo "$(date -u +"%Y-%m-%dT%H:%M:%SZ")"
384-
TIMESTAMP_SHORT:
385-
sh: echo "{{now | date "20060102"}}"
386-
TAG:
387-
sh: echo "$(git tag --points-at=HEAD 2> /dev/null | head -n1)"
388-
VERSION: "{{ if .NIGHTLY }}nightly-{{ .TIMESTAMP_SHORT }}{{ else if .TAG }}{{ .TAG }}{{ else }}snapshot{{ end }}"
389-
CONFIGURATION_PACKAGE: "github.com/arduino/{{ .PROJECT_NAME }}/internal/configuration"
390-
LDFLAGS: >-
391-
-ldflags
392-
'
393-
-X {{ .CONFIGURATION_PACKAGE }}.version={{.VERSION}}
394-
-X {{ .CONFIGURATION_PACKAGE }}.commit={{.COMMIT}}
395-
-X {{ .CONFIGURATION_PACKAGE }}.buildTimestamp={{.TIMESTAMP}}
396-
'
397-
GOFLAGS: "-timeout 10m -v -coverpkg=./... -covermode=atomic"
398-
DOCS_VERSION: dev
399-
DOCS_ALIAS: ""
400-
DOCS_REMOTE: "origin"
401-
402-
403-
404-
CODESPELL_SKIP_OPTION: '--skip "./.git,go.mod,go.sum,./arduino-lint,./arduino-lint.exe,./internal/rule/rulefunction/testdata/libraries/MisspelledSentenceParagraphValue/library.properties,./site"'
405-
CODESPELL_IGNORE_WORDS_OPTION: "--ignore-words ./etc/codespell-ignore-words-list.txt"

0 commit comments

Comments
 (0)