-
-
Notifications
You must be signed in to change notification settings - Fork 398
/
Copy pathTaskfile.yml
executable file
·172 lines (149 loc) · 6.04 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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
version: '2'
tasks:
docs:gen:commands:
desc: Generate command reference files
dir: ./docsgen
cmds:
# docs will generate examples using os.Args[0] so we need to call
# the generator `arduino-cli`
- go build -o arduino-cli
# we invoke `arduino-cli` like this instead of `./arduino-cli` to remove
# the `./` chars from the examples
- PATH=. arduino-cli ../docs/commands
docs:gen:protobuf:
desc: Generate markdown contents for protobuffers
cmds:
- '{{ default "protoc" .PROTOC_BINARY }} --doc_out=./docs/rpc --doc_opt=markdown,commands.md --proto_path=rpc ./rpc/commands/*.proto'
- '{{ default "protoc" .PROTOC_BINARY }} --doc_out=./docs/rpc --doc_opt=markdown,monitor.md --proto_path=rpc ./rpc/monitor/*.proto'
- '{{ default "protoc" .PROTOC_BINARY }} --doc_out=./docs/rpc --doc_opt=markdown,settings.md --proto_path=rpc ./rpc/settings/*.proto'
- '{{ default "protoc" .PROTOC_BINARY }} --doc_out=./docs/rpc --doc_opt=markdown,debug.md --proto_path=rpc ./rpc/debug/*.proto'
docs:gen:
desc: Generate documentation files
cmds:
- task: docs:gen:commands
- task: docs:gen:protobuf
docs:build:
desc: Build documentation website contents
deps:
- docs:gen:commands
- docs:gen:protobuf
cmds:
- mkdocs build -s
docs:publish:
desc: Use Mike to build and push versioned docs
deps:
- docs:gen:commands
- docs:gen:protobuf
cmds:
- mike deploy -p -r {{.DOCS_REMOTE}} {{.DOCS_VERSION}} {{.DOCS_ALIAS}}
docs:serve:
desc: Run documentation website locally
deps:
- docs:build
cmds:
- mkdocs serve
protoc:
desc: Compile protobuf definitions
cmds:
- '{{ default "protoc" .PROTOC_BINARY }} --proto_path=rpc --go_out=plugins=grpc,paths=source_relative:rpc ./rpc/commands/*.proto'
- '{{ default "protoc" .PROTOC_BINARY }} --proto_path=rpc --go_out=plugins=grpc,paths=source_relative:rpc ./rpc/monitor/*.proto'
- '{{ default "protoc" .PROTOC_BINARY }} --proto_path=rpc --go_out=plugins=grpc,paths=source_relative:rpc ./rpc/settings/*.proto'
- '{{ default "protoc" .PROTOC_BINARY }} --proto_path=rpc --go_out=plugins=grpc,paths=source_relative:rpc ./rpc/debug/*.proto'
protoc:docs:
desc: Generate docs for protobuf definitions
cmds:
- '{{ default "protoc" .PROTOC_BINARY }} --doc_out=./docs/rpc --doc_opt=markdown,commands.md --proto_path=rpc ./rpc/commands/*.proto'
- '{{ default "protoc" .PROTOC_BINARY }} --doc_out=./docs/rpc --doc_opt=markdown,monitor.md --proto_path=rpc ./rpc/monitor/*.proto'
- '{{ default "protoc" .PROTOC_BINARY }} --doc_out=./docs/rpc --doc_opt=markdown,settings.md --proto_path=rpc ./rpc/settings/*.proto'
- '{{ default "protoc" .PROTOC_BINARY }} --doc_out=./docs/rpc --doc_opt=markdown,debug.md --proto_path=rpc ./rpc/debug/*.proto'
build:
desc: Build the project
cmds:
- go build -v -i {{.LDFLAGS}}
test:
desc: Run the full testsuite, `legacy` will be skipped
cmds:
- task: test-unit
- task: test-integration
test-unit:
desc: Run unit tests only
cmds:
- go test -short -run '{{ default ".*" .TEST_REGEX }}' {{ default "-v" .GOFLAGS }} -coverprofile=coverage_unit.txt {{ default .DEFAULT_TARGETS .TARGETS }} {{.TEST_LDFLAGS}}
test-integration:
desc: Run integration tests only
cmds:
- pytest test
test-legacy:
desc: Run tests for the `legacy` package
cmds:
- go test {{ default "-v -failfast" .GOFLAGS }} -coverprofile=coverage_legacy.txt ./legacy/...
test-unit-race:
desc: Run unit tests only with race condition detection
cmds:
- go test -short -race {{ default "-v" .GOFLAGS }} -coverprofile=coverage_race_unit.txt {{ default .DEFAULT_TARGETS .TARGETS }}
check:
desc: Check fmt and lint, `legacy` will be skipped
cmds:
- test -z $(go fmt {{ default .DEFAULT_TARGETS .TARGETS }})
- go vet {{ default .DEFAULT_TARGETS .TARGETS }}
- "'{{.GOLINTBIN}}' {{.GOLINTFLAGS}} {{ default .DEFAULT_TARGETS .TARGETS }}"
- task: i18n:check
check-legacy:
desc: Check fmt and lint for the `legacy` package
cmds:
- test -z $(go fmt ./legacy/...)
- go vet ./legacy/...
rpc-client:
desc: Run the rpc client test routine (server must be already started)
cmds:
- go test -run TestWithClientE2E ./commands/daemon
i18n:update:
desc: Updates i18n files
cmds:
- go run ./i18n/cmd/main.go catalog generate . > ./i18n/data/en.po
- task: i18n:generate
i18n:pull:
desc: Pull i18n files from transifex
cmds:
- go run ./i18n/cmd/main.go transifex pull -l {{.I18N_LANGS}} ./i18n/data
- task: i18n:generate
i18n:push:
desc: Push i18n files to transifex
cmds:
- go run ./i18n/cmd/main.go transifex push ./i18n/data
i18n:check:
desc: Check if the i18n message catalog was updated
cmds:
- task: i18n:update
- git add -N ./i18n/data
- git diff --exit-code ./i18n/data
i18n:generate:
desc: Generate embedded i18n catalog files
cmds:
- git add -N ./i18n/data
- git diff --exit-code ./i18n/data &> /dev/null || (cd ./i18n && rice embed-go)
vars:
# all modules of this project except for "legacy/..." module
DEFAULT_TARGETS:
sh: echo `go list ./... | grep -v legacy | tr '\n' ' '`
# build vars
COMMIT:
sh: echo ${TRAVIS_COMMIT:-`git log -n 1 --format=%h`}
LDFLAGS: >
-ldflags '-X github.com/arduino/arduino-cli/version.commit={{.COMMIT}}'
# test vars
GOFLAGS: "-timeout 10m -v -coverpkg=./... -covermode=atomic"
TEST_VERSIONSTRING: "0.0.0-test.preview"
TEST_COMMIT: "deadbeef"
TEST_LDFLAGS: >
-ldflags '-X github.com/arduino/arduino-cli/version.versionString={{.TEST_VERSIONSTRING}}
-X github.com/arduino/arduino-cli/version.commit={{.TEST_COMMIT}}'
# check-lint vars
GOLINTBIN:
sh: go list -f {{"{{"}}".Target{{"}}"}}" golang.org/x/lint/golint
GOLINTFLAGS: "-min_confidence 0.8 -set_exit_status"
# docs versioning
DOCS_VERSION: dev
DOCS_ALIAS: ""
DOCS_REMOTE: "origin"
I18N_LANGS: "pt_BR"