generated from snivilised/astrolib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Taskfile.yml
199 lines (161 loc) Β· 4.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
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
---
# 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 =================================================
t:
cmds:
- go test ./...
ti:
cmds:
- go test ./i18n
dry:
cmds:
- ginkgo -v --dry-run ./...
# === 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
# === 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}}
# === i18n =================================================
clear:
cmds:
- rm ./i18n/out/* --recursive
# extract i18m messages
extract:
cmds:
- goi18n extract
-format json
-sourceLanguage "en-GB"
-outdir ./i18n/out/l10n
# new translation
newt:
deps: [extract]
cmds:
- touch ./i18n/out/l10n/translate.en-US.json
# derive a translation from the default
merge:
cmds:
- goi18n merge
-format json
-sourceLanguage "en-GB"
-outdir ./i18n/out
./i18n/out/active.en-GB.json ./i18n/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 ./i18n/default
update:
deps: [extract]
cmds:
- goi18n merge
-format json
-sourceLanguage "en-GB"
-outdir ./i18n/out
./i18n/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
./i18n/out/translate.en-US.json ./i18n/deploy/active.en-US.json