-
Notifications
You must be signed in to change notification settings - Fork 0
/
Taskfile.yml
177 lines (136 loc) · 3.71 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
173
174
175
176
177
version: "3"
silent: true
dotenv: [".env"]
vars:
FORMAT: json
GEN_BINARY_NAME: cobrass-gen
GEN_DIR: ./generators/gola/gen
GEN_TEST_OUTPUT_DIR: ./generators/gola/out/assistant
DIST_DIR: ./dist
tasks:
# === build ================================================
b:
cmds:
- go build ./...
clean:
cmds:
- go clean
# === test =================================================
t:
cmds:
- go test ./...
clean-t:
cmds:
- go clean -testcache
dry:
cmds:
- ginkgo -v --dry-run ./...
# run tests suites recursive
g:
cmds:
- ginkgo -r
# run tests suites recursive with verbose
gv:
cmds:
- ginkgo -r -v
# invoke as task gen -- <item>
gl:
cmds:
- ginkgo -r --label-filter={{.CLI_ARGS}}
# === watch ================================================
watchv:
cmds:
- ginkgo watch -v -r -p ./...
watch:
cmds:
- ginkgo watch -r -p ./...
# === ginkgo =================================================
# initialise a test suite for a package. (only 1 per package)
boot:
cmds:
- ginkgo bootstrap
# generate a test file for the item provided (item_test.go)
# invoke as task gen -- <item>
gen:
cmds:
- ginkgo generate {{.CLI_ARGS}}
# === lint ===================================================
lint:
cmds:
- golangci-lint run
cover:
cmds:
- goveralls -repotoken {{.COVERALLS_TOKEN}}
# === code generator =========================================
#
# NB: go generate can't evaluate variables, but we need to
# distinguish between a test run and a real run. For this reason
# we only invoke go generate for a real run and for a test run
# we invoke the generator directly without go generate, passing
# in the test flag.
co-gen-t:
cmds:
- mkdir -p {{.GEN_TEST_OUTPUT_DIR}}
- cobrass-gen -test -cwd ./ -templates generators/gola -write
- go fmt ./generators/gola/out/assistant/*.go
co-gen-vc:
cmds:
- go generate src/assistant/configuration
# co-gen:
# cmds:
# - go generate ./...
clear-gen-t:
cmds:
- rm -f ./generators/gola/out/assistant/*auto*.go
sign-t:
cmds:
- cobrass-gen -sign -test -cwd ./
sign:
cmds:
- cobrass-gen -sign
# === build/deploy code generator ============================
b-gen-linux:
cmds:
- task: build-generic
vars: { TARGET_OS: linux, TARGET_ARCH: amd64 }
build-generic:
vars:
APPLICATION_ENTRY: ./generators/gola/gen
cmds:
- echo "cross compiling generator from {{OS}} to {{.TARGET_OS}}"
- GOOS={{.TARGET_OS}} GOARCH={{.TARGET_ARCH}} go build -o {{.DIST_DIR}}/{{.TARGET_OS}}/{{.GEN_BINARY_NAME}} -v {{.APPLICATION_ENTRY}}
sources:
- ./generators/gola/**/*.go
generates:
- "{{.DIST_DIR}}/{{.TARGET_OS}}/{{.GEN_BINARY_NAME}}"
build-play:
vars:
APPLICATION_ENTRY: ./generators/gola/gen
cmds:
- echo "cross compiling generator from {{OS}} to {{.TARGET_OS}}"
- GOOS={{.TARGET_OS}} GOARCH={{.TARGET_ARCH}} go build -gcflags=-m ./generators/gola/gen/main.go
sources:
- ./generators/gola/**/*.go
d:
cmds:
- task: deploy
# currently, this is hardcoded for linux
#
deploy:
vars:
TARGET_OS: linux
DEPLOY_BINARY: "{{.DIST_DIR}}/{{.TARGET_OS}}/{{.GEN_BINARY_NAME}}"
cmds:
- echo "deploying to location (.env) DEPLOY_TO ==> '$DEPLOY_TO'"
- /bin/cp -f {{.DEPLOY_BINARY}} $DEPLOY_TO
generates:
- $DEPLOY_TO/{{.DEPLOY_BINARY}}
- $DEPLOY_TO/{{.ACTIVE_US}}
preconditions:
- test $DEPLOY_TO
- test -f {{.DEPLOY_BINARY}}
tbd:
cmds:
- task: t
- task: b-gen-linux
- task: d