-
Notifications
You must be signed in to change notification settings - Fork 3
/
Taskfile.yml
262 lines (232 loc) · 5.99 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
---
# yaml-language-server: $schema=https://taskfile.dev/schema.json
# https://taskfile.dev
version: '3'
output: prefixed
includes:
local:
taskfile: .taskfiles/local.yml
optional: true
tasks:
default:
silent: true
interactive: true
cmds:
- cmd: task --list
- cmd: printf "\nRun \"task --help\" for more information.\n"
check:
desc: Runs all QA checks executed during CI activities
cmds:
- task: prebuild-lambda
- task: check-tasks
check-tasks:
internal: true
deps:
- fmt
- test
- lint
- vet
cmds:
- task: build
- task: build-cli
test:
desc: "Runs unit tests and updates the HTML coverage report"
run: once
prefix: "test output"
cmds:
- go test -race -covermode=atomic -coverprofile=cover.out {{ .CLI_ARGS }} ./...
- task: coverage-report-html
sources:
- ./**/*.go
- ./Taskfile.yml
- ./go.mod
- ./go.sum
coverage-report-html:
desc: "Writes an HTML coverage report to cover.html"
cmds:
- go tool cover -html=cover.out -o cover.html
sources:
- ./cover.out
generates:
- ./cover.html
lint:
desc: "Runs the staticcheck linter utility"
vars:
FORMAT: '{{ default "stylish" .FORMAT }}'
cmds:
- "staticcheck -f {{ .FORMAT }} ./..."
sources:
- ./**/*.go
generate:
desc: "Discovers and runs all go:generate directives for the entire project"
cmds:
- go generate ./...
fmt:
desc: Runs `go fmt` and `terraform fmt` for the entire project
cmds:
- task: fmt-go
- task: fmt-terraform
fmt-go:
internal: true
label: "fmt"
cmds:
- go fmt ./...
sources:
- ./**/*.go
fmt-terraform:
internal: true
label: "fmt"
dir: terraform
cmds:
- terraform fmt -recursive
sources:
- '**/**.tf'
- '**/**.tfvars'
vet:
desc: Runs `go vet` for the entire project
cmds:
- go vet ./...
sources:
- ./**/*.go
clean:
desc: "Removes generated content from ./bin directories"
silent: true
cmds:
- test -d bin && find ./bin -mindepth 1 -type d -exec rm -rf {} + -print
- rm -f bin/grants-ingest
build-cli:
run: when_changed
desc: Compiles the grants-ingest CLI utility
vars:
BUILD_BIN: bin/grants-ingest
env:
GOPATH:
sh: go env GOPATH
cmds:
- go build -gcflags="-trimpath=$GOPATH" -asmflags="-trimpath=$GOPATH" -trimpath -ldflags=-buildid= -buildvcs=false -v -o {{ .BUILD_BIN }} ./cli/grants-ingest
- cmd: echo {{ .BUILD_BIN }}
silent: true
sources:
- ./cli/grants-ingest/**/*.go
- ./go.mod
- ./go.sum
- ./Taskfile.yml
generates:
- "{{ .BUILD_BIN }}"
prebuild-lambda:
run: always
desc: Batch-compiles all Lambda handlers to /dev/null to optimize future builds
cmds:
- task: go-build-lambda
vars:
LABEL: "prebuild-lambda"
BUILD_DEST: /dev/null
SOURCE: ./cmd/...
build-lambda:
internal: true
run: when_changed
label: "build-{{ .LAMBDA_CMD }}"
vars:
BUILD_DIR: bin/{{ .LAMBDA_CMD }}
BUILD_BIN: "{{ .BUILD_DIR }}/bootstrap"
SOURCE: ./cmd/{{ .LAMBDA_CMD }}/...
env:
GOPATH:
sh: go env GOPATH
cmds:
- task: go-build-lambda
vars:
LABEL: "build-{{ .LAMBDA_CMD }}"
BUILD_DEST: "{{ .BUILD_BIN }}"
SOURCE: "{{ .SOURCE }}"
- cmd: echo {{ .BUILD_BIN }}
silent: true
sources:
- ./**/*.go
- ./Taskfile.yml
- ./go.mod
- ./go.sum
generates:
- "{{ .BUILD_BIN }}"
go-build-lambda:
internal: true
run: always
label: "{{ .LABEL }}"
env:
GOPATH:
sh: go env GOPATH
cmds:
- GOOS=linux GOARCH=arm64 go build -gcflags="-trimpath=$GOPATH" -ldflags="-s -w" -asmflags="-trimpath=$GOPATH" -trimpath -ldflags=-buildid= -buildvcs=false -tags "lambda.norpc" -v -o {{ .BUILD_DEST }} {{ .SOURCE }}
build:
desc: "Compiles all Lambda handlers"
deps:
- build-DownloadGrantsGovDB
- build-SplitGrantsGovXMLDB
- build-PublishGrantEvents
- build-EnqueueFFISDownload
- build-PersistFFISData
- build-PersistGrantsGovXMLDB
- build-DownloadFFISSpreadsheet
- build-SplitFFISSpreadsheet
- build-ExtractGrantsGovDBToXML
- build-ReceiveFFISEmail
build-DownloadGrantsGovDB:
desc: Compiles DownloadGrantsGovDB
cmds:
- task: build-lambda
vars:
LAMBDA_CMD: DownloadGrantsGovDB
build-SplitGrantsGovXMLDB:
desc: Compiles SplitGrantsGovXMLDB
cmds:
- task: build-lambda
vars:
LAMBDA_CMD: SplitGrantsGovXMLDB
build-ExtractGrantsGovDBToXML:
desc: Complies ExtractGrantsGovDBToXML
cmds:
- task: build-lambda
vars:
LAMBDA_CMD: ExtractGrantsGovDBToXML
build-EnqueueFFISDownload:
desc: Compiles EnqueueFFISDownload
cmds:
- task: build-lambda
vars:
LAMBDA_CMD: EnqueueFFISDownload
build-PersistGrantsGovXMLDB:
desc: Compiles PersistGrantsGovXMLDB
cmds:
- task: build-lambda
vars:
LAMBDA_CMD: PersistGrantsGovXMLDB
build-DownloadFFISSpreadsheet:
desc: Compiles DownloadFFISSpreadsheet
cmds:
- task: build-lambda
vars:
LAMBDA_CMD: DownloadFFISSpreadsheet
build-PersistFFISData:
desc: Compiles PersistFFISData
cmds:
- task: build-lambda
vars:
LAMBDA_CMD: PersistFFISData
build-SplitFFISSpreadsheet:
desc: Compiles SplitFFISSpreadsheet
cmds:
- task: build-lambda
vars:
LAMBDA_CMD: SplitFFISSpreadsheet
build-PublishGrantEvents:
desc: Compiles build-PublishGrantEvents
cmds:
- task: build-lambda
vars:
LAMBDA_CMD: PublishGrantEvents
build-ReceiveFFISEmail:
desc: Compiles build-ReceiveFFISEmail
cmds:
- task: build-lambda
vars:
LAMBDA_CMD: ReceiveFFISEmail