-
-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathTaskfile.yml
executable file
·128 lines (112 loc) · 3.29 KB
/
Taskfile.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
version: "3"
includes:
dist: ./DistTasks.yml
tasks:
docs:check:
desc: Run documentation linting
cmds:
- npx {{ .PRETTIER }} --check "**/*.md"
docs:check-links:
desc: Verifies there are no dead links in documentation
cmds:
- |
npx -p markdown-link-check -c '
STATUS=0
for file in $(find -name "*.md"); do
markdown-link-check -c markdown-link-check-config.json -q "$file"
STATUS=$(( $STATUS + $? ))
done
exit $STATUS'
docs:format:
desc: Automatically formats documentation
cmds:
- npx {{ .PRETTIER }} --write "**/*.md"
docs:build:
desc: Build documentation website contents
cmds:
- mkdocs build -s
build:
desc: Build the project
cmds:
- go build -v {{.LDFLAGS}}
test:
desc: Run tests
cmds:
- task: test-unit
- task: test-integration
test-unit:
desc: Run unit tests
cmds:
- go test -short -race -run '.*' {{ default "-v" .GOFLAGS }} -coverprofile=coverage_unit.txt ./... {{.TEST_LDFLAGS}}
test-integration:
desc: Run integration tests
cmds:
- task: build
- poetry install --no-root
- poetry run pytest test
check:
desc: Check fmt and lint
cmds:
- test -z $(go fmt ./...)
- go vet ./...
- "'{{.GOLINTBIN}}' {{.GOLINTFLAGS}} ./..."
- task: docs:check
- task: config:check
- task: python:check
config:check:
desc: Check linting of configuration and supporting files
cmds:
- npx {{ .PRETTIER }} --check "**/*.{yml,yaml}"
config:format:
desc: Automatically formats configuration and supporting files
cmds:
- npx {{ .PRETTIER }} --write "**/*.{yml,yaml}"
python:check:
cmds:
- task: python:lint
python:lint:
desc: Lint Python code
cmds:
- poetry install --no-root
- poetry run flake8
python:format:
desc: Automatically formats Python files
cmds:
- poetry install --no-root
- poetry run black .
vars:
PROJECT_NAME: "FirmwareUploader"
DIST_DIR: "dist"
# build vars
COMMIT:
sh: echo "$(git log -n 1 --format=%h)"
TIMESTAMP:
sh: echo "$(date -u +"%Y-%m-%dT%H:%M:%SZ")"
TIMESTAMP_SHORT:
sh: echo "{{now | date "20060102"}}"
TAG:
sh: echo "`git tag --points-at=HEAD 2> /dev/null | head -n1`"
VERSION: "{{ if .NIGHTLY }}nightly-{{ .TIMESTAMP_SHORT }}{{ else if .TAG }}{{ .TAG }}{{ else }}{{ .PACKAGE_NAME_PREFIX }}git-snapshot{{ end }}"
LDFLAGS: >
-ldflags
'
-X github.com/arduino/FirmwareUploader/version.versionString={{.VERSION}}
-X github.com/arduino/FirmwareUploader/version.commit={{ .COMMIT }}
-X github.com/arduino/FirmwareUploader/version.date={{.TIMESTAMP}}
'
# test vars
GOFLAGS: "-timeout 10m -v -coverpkg=./... -covermode=atomic"
TEST_VERSION: "0.0.0-test.preview"
TEST_COMMIT: "deadbeef"
TEST_LDFLAGS: >
-ldflags
'
-X github.com/arduino/FirmwareUploader/version.versionString={{.TEST_VERSION}}
-X github.com/arduino/FirmwareUploader/version.commit={{.TEST_COMMIT}}
-X github.com/arduino/FirmwareUploader/version.date={{.TIMESTAMP}}
'
# check-lint vars
GOLINTBIN:
sh: go list -f {{"{{"}}".Target{{"}}"}}" golang.org/x/lint/golint
GOLINTFLAGS: "-min_confidence 0.8 -set_exit_status"
PRETTIER: [email protected]