-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtaskfile.yaml
More file actions
315 lines (274 loc) · 9.51 KB
/
Copy pathtaskfile.yaml
File metadata and controls
315 lines (274 loc) · 9.51 KB
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
305
306
307
308
309
310
311
312
313
314
315
# yaml-language-server: $schema=https://taskfile.dev/schema.json
version: "3"
vars:
ZIGBUILD_IMAGE: ghcr.io/rust-cross/cargo-zigbuild:latest
GORELEASER_VERSION: "2.17.0"
tasks:
default:
cmds:
- task: run
run:
desc: "run"
interactive: true
cmds:
- cargo run -- {{.CLI_ARGS}}
build:
desc: "build in debug mode"
cmds:
- cargo build --all-targets {{.CLI_ARGS}}
build:release:
desc: "build in release mode"
cmds:
- cargo build --all-targets --release {{.CLI_ARGS}}
goreleaser:
internal: true
requires:
vars: [GORELEASER_ARGS]
cmds:
# The image ships zig, cargo-zigbuild, Rust and every release target; only goreleaser
# is missing. safe.directory is required because the bind-mounted repo has another owner.
- >-
docker run --rm -e GITHUB_TOKEN -e TAP_GITHUB_TOKEN -e "HOST_UID=$(id -u)" -e "HOST_GID=$(id
-g)" -v "${PWD}:/workspace" -w /workspace {{.ZIGBUILD_IMAGE}} bash -euo pipefail -c '
fix_perms() { for d in target goreleaser-dist; do [ -e "$d" ] && chown -R
"${HOST_UID}:${HOST_GID}" "$d" || true; done; }; trap fix_perms EXIT; case "$(uname -m)" in
x86_64) arch=x86_64 ;; aarch64|arm64) arch=arm64 ;; *) echo "unsupported arch" >&2; exit 1
;; esac; curl -sSfL
"https://github.com/goreleaser/goreleaser/releases/download/v{{.GORELEASER_VERSION}}/goreleaser_Linux_${arch}.tar.gz"
| tar -xz -C /usr/local/bin goreleaser; git config --global --add safe.directory "$(pwd)";
goreleaser {{.GORELEASER_ARGS}}'
build:goreleaser:
desc: "build in release mode using goreleaser"
cmds:
- task: goreleaser
vars: { GORELEASER_ARGS: "build --snapshot --clean" }
release:
desc: "release using goreleaser"
cmds:
- task: goreleaser
vars: { GORELEASER_ARGS: "release --clean" }
typos:
desc: "check repository for typos"
aliases: [spellcheck]
cmds:
- typos
check:
desc: "check cargo workspace"
dir: "{{.ROOT_DIR}}"
cmds:
- cargo check --workspace --all-targets {{.CLI_ARGS}}
check:fc:
desc: "check cargo workspace for all combinations of features"
dir: "{{.ROOT_DIR}}"
cmds:
- cargo fc check --all-targets {{.CLI_ARGS}}
clean:
desc: "clean cargo workspace"
cmds:
- cargo clean {{.CLI_ARGS}}
clean:build:
desc: "remove zigbuild/cc probe garbage object files"
cmds:
# prettier-ignore
- >-
find .
-type f
\( -name '.intentionally-empty-file.o' -o -name '*detect_compiler_family.o' \)
-delete
docs:cargo:
desc: "open the rustdoc API documentation preview"
env:
RUSTDOCFLAGS: "--cfg docsrs"
cmds:
- cargo +nightly watchdoc --all-features {{.CLI_ARGS}}
docs:schemas:
desc: "regenerate the documentation schema snippets (runs helm-schema on docs/examples)"
sources:
- scripts/schemas.sh
- crates/*/src/**/*.rs
- docs/examples/**
generates:
- docs/assets/schemas/*.json
cmds:
- bash scripts/schemas.sh
docs:build:
desc: "regenerate schema snippets and build the static site into docs/public"
deps: [docs:schemas]
dir: docs
cmds:
- hugo --minify --gc {{.CLI_ARGS}}
docs:serve:
desc: "serve the documentation website with hot reload (needs hugo extended + go)"
aliases: [docs]
deps: [docs:schemas]
dir: docs
interactive: true
cmds:
- hugo server --disableFastRender {{.CLI_ARGS}}
outdated:
desc: "list outdated deps (incl. new majors): adoptable now vs still in cooldown"
cmds:
- cooldown outdated --sync {{.CLI_ARGS}}
outdated:minor:
desc: "list outdated deps within the current major only"
cmds:
- cooldown outdated --no-major --sync {{.CLI_ARGS}}
upgrade:
desc: "upgrade all deps incl. cross-major bumps, within the cooldown"
aliases: [update]
cmds:
- cooldown upgrade --major --sync {{.CLI_ARGS}}
upgrade:minor:
desc: "upgrade all deps within their current major, within the cooldown"
cmds:
- cooldown upgrade --no-major --sync {{.CLI_ARGS}}
upgrade:latest:
desc: "upgrade ignoring the cooldown window — use deliberately"
prompt:
- >-
DANGER: this bypasses the supply-chain cooldown and adopts brand-new (possibly compromised)
releases. Prefer 'task upgrade' / 'task upgrade:minor'. Continue?
cmds:
- cooldown upgrade --latest {{.CLI_ARGS}}
unused:
desc: "check for unused cargo workspace dependencies"
aliases: [unused-dependencies]
cmds:
- cargo +nightly fc udeps --maximal-features --all-targets {{.CLI_ARGS}}
audit:
desc: "audit cargo workspace dependencies"
cmds:
- cargo audit {{.CLI_ARGS}}
format:
desc: "format cargo workspace"
cmds:
- cargo fmt --all {{.CLI_ARGS}}
test:
desc: "test cargo workspace"
aliases: [test:unit]
cmds:
- cargo nextest run -P default --workspace --all-targets --no-tests warn {{.CLI_ARGS}}
test:fc:
desc: "test cargo workspace for all combinations of features"
cmds:
- cargo fc nextest run -P default --all-targets --no-tests warn {{.CLI_ARGS}}
test:integration:
desc: "run integration tests in cargo workspace"
cmds:
- cargo nextest run -P integration --workspace --all-targets --no-tests warn {{.CLI_ARGS}}
test:network:
desc: "run the live fetch-on-demand tests against real upstream schema hosts"
cmds:
# Keeps the profile's retries: a failure here is usually an upstream
# outage, not a defect in this repository.
- cargo nextest run -P network --workspace --all-targets --no-tests warn {{.CLI_ARGS}}
test:all:
desc: "run ALL tests in cargo workspace, including the live network tests"
aliases: [test:ci]
cmds:
- cargo nextest run -P ci --workspace --all-targets --no-tests warn {{.CLI_ARGS}}
test:doc:
desc: "run doctests in cargo workspace"
cmds:
- cargo test --doc --workspace {{.CLI_ARGS}}
bench:chart:
desc: "benchmark release helm-schema on one chart"
vars:
HELM_SCHEMA_BIN: "{{.ROOT_DIR}}/target/release/helm-schema"
CHART: '{{.CHART | default "./testdata/charts/cert-manager"}}'
OUTPUT: '{{.OUTPUT | default "./target/bench/helm-schema-bench.schema.json"}}'
cmds:
- cargo build -p helm-schema-cli --release
- >-
/usr/bin/time -v
{{.HELM_SCHEMA_BIN}}
{{.CHART}}
--compact
--output {{.OUTPUT}}
{{.CLI_ARGS}}
trace:chart:
desc: "run release helm-schema on one chart and write a perfetto trace"
vars:
HELM_SCHEMA_BIN: "{{.ROOT_DIR}}/target/release/helm-schema"
CHART: '{{.CHART | default "./testdata/charts/cert-manager"}}'
OUTPUT: '{{.OUTPUT | default "./target/bench/helm-schema-trace.schema.json"}}'
TRACE: '{{.TRACE | default "./target/bench/helm-schema-trace.pftrace"}}'
cmds:
- cargo build -p helm-schema-cli --release
- >-
/usr/bin/time -v
{{.HELM_SCHEMA_BIN}}
{{.CHART}}
--compact
--trace-output {{.TRACE}}
--output {{.OUTPUT}}
{{.CLI_ARGS}}
bench:representative:
desc: "benchmark representative charts, including luup3 temporal"
vars:
LUUP3_DIR: '{{.LUUP3_DIR | default "/home/roman/dev/branches/luup3"}}'
cmds:
- >-
task bench:chart --
CHART=./testdata/charts/cert-manager
OUTPUT=./target/bench/helm-schema-bench-cert-manager.json
- >-
task bench:chart --
CHART={{.LUUP3_DIR}}/deployment/charts/inbucket
OUTPUT=./target/bench/helm-schema-bench-inbucket.json
- >-
task bench:chart --
CHART={{.LUUP3_DIR}}/deployment/charts/temporal
OUTPUT=./target/bench/helm-schema-bench-temporal.json
bench:emission-profiles:
desc: "benchmark emission policies on the pinned Temporal wrapper"
cmds:
- ./plan/chart-corpus-scripts/benchmark-emission-profiles.sh {{.CLI_ARGS}}
lint:ast-grep:
desc: "lint with ast-grep rules"
cmds:
- ast-grep test --config sgconfig.yaml --skip-snapshot-tests
- ast-grep scan --config sgconfig.yaml
lint:
desc: "lint cargo workspace"
cmds:
- cargo lint --workspace --all-features {{.CLI_ARGS}}
- task: lint:ast-grep
lint:fc:
desc: "lint cargo workspace for all combinations of features"
cmds:
- cargo fc lint {{.CLI_ARGS}}
- task: lint:ast-grep
lint:fix:
desc: "lint and fix cargo workspace"
aliases: [fix]
cmds:
- cargo fixit --workspace --all-features {{.CLI_ARGS}}
- task: lint:ast-grep
lint:actions:
desc: "lint github actions"
cmds:
- actionlint
tokei:
desc: "count lines of code, excluding vendored and generated files"
cmds:
# excludes vendored tree-sitter grammars (incl. generated parser.c),
# vendored third-party charts, and generated schema/IR JSON fixtures
- >-
tokei
--exclude grammars
--exclude testdata
--exclude 'crates/*/tests/fixtures'
{{.CLI_ARGS}}
tokei:core:
desc: "count lines of non-test code in the crates"
cmds:
# excludes all directories named tests, including crate integration tests
# and private src/tests modules, plus fixtures and the test-util crate; inline
# #[cfg(test)] modules in production src files remain counted until
# they are migrated out of those files
- >-
tokei {{if .CLI_ARGS}}{{.CLI_ARGS}}{{else}}crates{{end}}
--exclude tests
--exclude fixtures
--exclude test-util