This repository has been archived by the owner on Oct 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTaskfile.yml
257 lines (227 loc) · 6.35 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
---
# https://taskfile.dev
version: "3"
env:
GO_NAME: goer
GO_RUNNER: go
GOOS: darwin
GOARCH: arm64
PY_PM: poetry
PY_RUNNER: poetry run
PYTESTARGS: -vvl --workers auto
BLACKARGS: --line-length 128 --check --diff
TF_NAMESPACE: dev
TF_TYPE: turing-pi-bmc
TF_VERSION: "0.1.2"
tasks:
default:
cmds:
- task -l
#############################################################################
#
# Environment Setup
#
#############################################################################
setup:
desc: Setup environment
cmds:
- task: setup-python-env
- task: setup-pre-commit
setup-python-env:
desc: Setup Python environment
cmds:
- $PY_PM update
setup-pre-commit:
desc: Setup Pre-Commit environment
cmds:
- $PY_RUNNER pre-commit install
- $PY_RUNNER pre-commit install --install-hooks
- $PY_RUNNER pre-commit install --hook-type commit-msg
- $PY_RUNNER pre-commit install --hook-type pre-push
- task: ansible-init
ansible-init:
desc: Setup ansible
cmds:
- echo "No Ansible support"
#############################################################################
#
# Release management
#
#############################################################################
release:
desc: Release MINOR version bump
cmds:
- $PY_RUNNER cz bump --check-consistency --increment MINOR --no-verify
release-major:
desc: Release MAJOR version bump
cmds:
- $PY_RUNNER cz bump --check-consistency --increment MAJOR --no-verify
release-patch:
desc: Release PATCH version bump
cmds:
- $PY_RUNNER cz bump --check-consistency --increment PATCH --no-verify
publish:
desc: Push to remote
cmds:
- git push -v --progress
- git push -v --progress --tags
#############################################################################
#
# Cookies options
#
#############################################################################
cruft-update:
desc: Update the cookies
cmds:
- git stash push -m cruft-update
- $PY_RUNNER cruft update --allow-untracked-files --skip-apply-ask
- if test -d control; then pushd control >/dev/null && task init && popd; fi
- if test -d deployment; then pushd deployment >/dev/null && task init && popd; fi
- $PY_RUNNER pre-commit run -a pretty-format-json
- $PY_RUNNER pre-commit run -a terraform_docs
- git stash list | grep -q cruft-update && git stash pop >/dev/null || true
cruft-push:
desc: Push the cookies
cmds:
- 'git ci -a -m "chore(cruft): update to latest cruft state"'
cruft-reset:
desc: Reset cruft
cmds:
- cruft diff | git apply
#############################################################################
#
# Checking and Linting
#
#############################################################################
prettier:
desc: Run prettier
cmds:
- prettier -w .
check:
desc: Run pre-commit
deps:
- lint
lint:
desc: Run pre-commit
deps:
- linting
linting:
desc: Run pre-commit
cmds:
- task: pre-commit
- task: trunk
pre-commit:
desc: Run pre-commit
cmds:
- $PY_RUNNER pre-commit run --hook-stage commit --all-files
- $PY_RUNNER pre-commit run --hook-stage push --all-files
- $PY_RUNNER pre-commit run --hook-stage manual --all-files
trunk:
desc: Run trunk
cmds:
- cmd: trunk check --all --fix --exclude trivy
test:
desc: Run pytest
deps:
- pytest
pytest:
desc: Run pytest
cmds:
- $PY_RUNNER pytest $PYTESTARGS tests
#############################################################################
#
# GOLANG options
#
#############################################################################
go-fmt:
desc: Runs gofumpt
sources:
- "./**/*.go"
cmds:
- gofumpt -l -w -extra .
go-install:
desc: Install GO application
sources:
- "./**/*.go"
cmds:
- $GO_RUNNER install -v -ldflags="-w -s -X main.version=\{\{.GIT_COMMIT\}\}" ./cmd/${GO_NAME}
go-lint:
desc: Runs golangci-lint
sources:
- "./**/*.go"
cmds:
- golangci-lint --verbose run
- staticcheck -f stylish ./...
go-mod:
desc: Downloads and tidy Go modules
cmds:
- go mod download -x
- go mod tidy -v
go-test:
desc: Runs gotest
cmds:
- grc -es --colour=on go test -v --bench=. --benchmem ./...
go-update:
desc: Update dependencies
cmds:
- go get -u ./...
go-vet:
desc: Vet go code
cmds:
- go mod vendor
- go vet ./...
go-generate:
desc: Generate GO docs and stuff
cmds:
- cmd: go mod vendor
- cmd: go generate ./...
- cmd: pre-commit run -a end-of-file-fixer
ignore_error: true
- cmd: pre-commit run -a trailing-whitespace
ignore_error: true
- cmd: prettier -w docs
- cmd: pre-commit run -a terraform_docs
ignore_error: true
ghost:
desc: Run all go stuff
cmds:
- task: go-update
- task: go-mod
- task: go-generate
- task: go-vet
- task: go-fmt
- task: go-lint
#############################################################################
#
# Terraform provider
#
#############################################################################
create-provider-dir:
desc: Create Provider directory
cmds:
- mkdir -p ~/.terraform.d/plugins/jlec.de/${TF_NAMESPACE}/${TF_TYPE}/${TF_VERSION}/darwin_arm64
provider-build:
desc: Build project
cmds:
- go build -v -x -o ./terraform-provider-${TF_TYPE}_${TF_VERSION}_${GOOS}_${GOARCH}
provider-install:
desc: Install Terraform provider dev version
deps:
- provider-build
- create-provider-dir
cmds:
- >-
install -m 755
./terraform-provider-${TF_TYPE}_${TF_VERSION}_${GOOS}_${GOARCH}
~/.terraform.d/plugins/jlec.de/${TF_NAMESPACE}/${TF_TYPE}/${TF_VERSION}/darwin_arm64/terraform-provider-${TF_TYPE}_${TF_VERSION}_${GOOS}_${GOARCH}
#############################################################################
#
# Custom options
#
#############################################################################
clean:
desc: Clean up
cmds:
- rm -rf dist
- rm -rf tmp
- git clean -fdx