generated from snivilised/astrolib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Taskfile.yml
304 lines (244 loc) Β· 6.36 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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
---
# dependencies:
# - ginkgo
# - goi18n
# - golangci-lint
# - goveralls
# - yamllint
version: "3"
silent: true
dotenv: [".env"]
vars:
FORMAT: json
BINARY_NAME: traverse
DEPLOY_DIR: ./locale/deploy
OUT_DIR: ./locale/out
L10N_DIR: ./locale/out/l10n
#
SOURCE_LANG: en-GB
SOURCE_ACTIVE: "active.{{.SOURCE_LANG}}.{{.FORMAT}}"
#
LANGUAGE_US: en-US
US_OUT_DIR: "{{.OUT_DIR}}/{{.LANGUAGE_US}}"
ACTIVE_US: "{{.BINARY_NAME}}.active.en-US.{{.FORMAT}}"
TRANSLATE_US: "{{.BINARY_NAME}}.translate.en-US.{{.FORMAT}}"
TRANSLATE_US_FILEPATH: "{{.US_OUT_DIR}}/{{.TRANSLATE_US}}"
COVER_DIR: "./"
COVER_FILE: "coverage.out"
COVER_HTML_PATH: "./coverage.html"
GINKGO_REPORT: "ginkgo.report"
tasks:
# === build ================================================
b:
cmds:
- go build ./...
# === test =================================================
# to see how to select tests by label, refer to:
# https://onsi.github.io/ginkgo/#spec-labels
#
# equal: --label-filter="foo"
# not: --label-filter="!foo"
# and: --label-filter="!foo && bar"
# or: --label-filter="!foo || bar"
# regex: --label-filter="/pattern/"
dry:
cmds:
- ginkgo -v --dry-run ./...
clean:
cmds:
- go clean
clean-t:
cmds:
- go clean -testcache
lfs:
cmds:
- go test ./lfs
t:
cmds:
- go test ./...
ta:
cmds:
- go test ./tapable
ten:
cmds:
- go test ./internal/enclave
tk:
cmds:
- go test ./internal/kernel
ti:
cmds:
- go test ./i18n
tl:
cmds:
- go test ./locale
tlc:
cmds:
- go test ./life
tcore:
cmds:
- go test ./core
tf:
cmds:
- go test ./internal/filtering
tf-hiber:
cmds:
- go test ./internal/feat/hiber
tf-res:
cmds:
- go test ./internal/feat/resume
tf-samp:
cmds:
- go test ./internal/feat/sampling
toc:
cmds:
- go test ./collections
tpref:
cmds:
- go test ./pref
tpers:
cmds:
- go test ./internal/persist
tt:
cmds:
- go test
# this needs to be invoked using -- eg:
# task venus -- -filter RETRO-WAVE,DUB
venus:
cmds:
- go run ./test/cmd/venus/main.go {{.CLI_ARGS}}
# === ginkgo ================================================
# initialise a test suite for a package. (only 1 per package)
boot:
cmds:
- ginkgo bootstrap
# run tests suites recursive
g:
cmds:
- ginkgo -r
# invoke as task gen -- <item>
gl:
cmds:
- ginkgo -r --label-filter={{.CLI_ARGS}}
# run tests suites recursive with verbose
gv:
cmds:
- ginkgo -r -v
# generate a test file for the item provided (item_test.go)
# invoke as task gen -- <item>
gen:
cmds:
- ginkgo generate {{.CLI_ARGS}}
# === watch ================================================
watchv:
cmds:
- ginkgo watch -v -r -p ./...
watchvc:
cmds:
- ginkgo watch -v -r -p ./collections
watchvi:
cmds:
- ginkgo watch -v -r -p ./i18n
watch:
cmds:
- ginkgo watch -r -p ./...
# === lint =================================================
lint:
cmds:
- golangci-lint run
linty:
cmds:
- yamllint *.y*ml
# === generate =============================================
enums:
cmds:
- go generate ./enums
# === coverage =============================================
cover-clean:
cmds:
- rm -rf ./coverage
cover-publish:
cmds:
- goveralls -repotoken {{.COVERALLS_TOKEN}}
cover-setup:
cmds:
- mkdir -p ./coverage
cover-ginkgo:
cmds:
- ginkgo run -r -json-report {{.GINKGO_REPORT}} -coverpkg=./... -coverprofile={{.COVER_FILE}} --output-dir {{.COVER_DIR}}
cover-show:
cmds:
- open {{.COVER_HTML_PATH}}
cover-exclude:
cmds:
- ./scripts/apply-coverage-exclusions.sh
cover:
cmds:
- task: cover-setup
- task: cover-ginkgo
- task: cover-exclude
- go tool cover -html=./coverage.out -o {{.COVER_HTML_PATH}}
- open {{.COVER_HTML_PATH}}
# === security =============================================
# for verbose mode:
# govulncheck -show verbose ./...
vuln:
cmds:
- govulncheck ./...
# === i18n =================================================
clear:
cmds:
- rm -rf {{.OUT_DIR}}/* --recursive
# extract i18m messages
extract:
cmds:
- mkdir -p ./locale/out/l10n
- goi18n extract
-format json
-sourceLanguage "en-GB"
-outdir ./locale/out/l10n
# new translation
# where is the default? locale/default/li18ngo.active.en-GB.json not populated
# ! creates: locale/out/l10n/active.en-GB.json => extracted output
# ! creates: locale/out/l10n/translate.en-US.json => empty
newt:
deps: [extract]
cmds:
- touch ./locale/out/l10n/translate.en-US.json
# derive a translation from the default
# ! the default active file does not contain hashes, just the extracted content
# ! the foreign translate file contains the hashes
# ! the active foreign file (locale/out/l10n/active.en-US.json) is empty
# ! pass the translate file(locale/out/l10n/translate.en-US.json) to your translator
#
merge:
cmds:
- goi18n merge
-format json
-sourceLanguage "en-GB"
-outdir ./locale/out/l10n
./locale/out/l10n/active.en-GB.json ./locale/out/l10n/translate.en-US.json
# update existing translations
# after running this task, the translation file generated will
# contain only the new translations. Update the active file,
# with the new translations. Also, need to copy the default
# file (active.en-GB.json) back into ./locale/default
update:
deps: [extract]
cmds:
- goi18n merge
-format json
-sourceLanguage "en-GB"
-outdir ./locale/out
./locale/out/active.en-GB.json ./i18n/deploy/active.en-US.json
# run this after manual translation has occurred to integrate it
# back into the translation file. Unfortunately, this task doesn't
# work properly, because it does not include the hashes. Without
# this task, the new translations must be manually added to the active
# translation file (active.en-US.json).
accept:
cmds:
- goi18n merge
-format json
-sourceLanguage "en-US"
-outdir ./i18n/temp
./locale/out/translate.en-US.json ./i18n/deploy/active.en-US.json