forked from ava-labs/avalanchego
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaskfile.yml
More file actions
417 lines (344 loc) · 13.7 KB
/
Taskfile.yml
File metadata and controls
417 lines (344 loc) · 13.7 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
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
# https://taskfile.dev
# To run on a system without task installed, `./scripts/run_task.sh` will execute it with `go run`.
# If in the nix dev shell, `task` is available.
# To install nix, `./scripts/run_task.sh install-nix`
# - Tasks should be simple entrypoints to functionality exposed by scripts or code.
# - Avoid the temptation to use task vars to define an API surface. Prefer configuring the
# underlying script or code via CLI args and/or env vars.
version: '3'
includes:
packaging:
taskfile: .github/packaging/Taskfile.yml
tasks:
default: ./scripts/run_task.sh --list
build:
desc: Builds avalanchego
cmd: ./scripts/build.sh
build-antithesis-images-avalanchego:
desc: Builds docker images for antithesis for the avalanchego test setup
env:
TEST_SETUP: avalanchego
cmd: bash -x ./scripts/build_antithesis_images.sh
build-antithesis-images-subnet-evm:
desc: Builds docker images for antithesis for the subnet-evm test setup
env:
TEST_SETUP: subnet-evm
cmd: bash -x ./scripts/build_antithesis_images.sh
build-antithesis-images-xsvm:
desc: Builds docker images for antithesis for the xsvm test setup
env:
TEST_SETUP: xsvm
cmd: bash -x ./scripts/build_antithesis_images.sh
build-bootstrap-monitor:
desc: Builds bootstrap-monitor
cmd: ./scripts/build_bootstrap_monitor.sh
build-bootstrap-monitor-image:
desc: Builds docker image for bootstrap-monitor
cmd: ./scripts/build_bootstrap_monitor_image.sh
build-image:
desc: Builds docker image for avalanchego
cmd: ./scripts/build_image.sh
build-race:
desc: Builds avalanchego with race detection enabled
cmd: ./scripts/build.sh -r
build-subnet-evm:
desc: Builds subnet-evm plugin
cmd: ./graft/subnet-evm/scripts/build.sh
build-subnet-evm-image:
desc: Builds docker image for subnet-evm
dir: graft/subnet-evm
cmd: ./scripts/build_docker_image.sh
build-tmpnetctl:
desc: Builds tmpnetctl
cmd: ./scripts/build_tmpnetctl.sh
build-xsvm:
desc: Builds xsvm plugin
cmd: ./scripts/build_xsvm.sh
build-xsvm-image:
desc: Builds xsvm image
cmd: ./scripts/build_xsvm_image.sh
check-clean-branch:
desc: Checks that the git working tree is clean
cmd: .github/workflows/check-clean-branch.sh
check-generate-canoto:
desc: Checks that generated canoto is up-to-date (requires a clean git working tree)
cmds:
- task: generate-canoto
- task: check-clean-branch
check-generate-load-contract-bindings:
desc: Checks that generated load contract bindings are up-to-date (requires a clean git working tree)
cmds:
- task: generate-load-contract-bindings
- task: check-clean-branch
check-generate-mocks:
desc: Checks that generated mocks are up-to-date (requires a clean git working tree)
cmds:
- task: generate-mocks
- task: check-clean-branch
check-generate-protobuf:
desc: Checks that generated protobuf is up-to-date (requires a clean git working tree)
cmds:
- task: generate-protobuf
- task: check-clean-branch
check-go-mod-tidy:
desc: Checks that go module configuration is consistent (requires a clean git working tree)
cmds:
- task: go-mod-tidy
- task: check-clean-branch
check-go-version:
desc: Checks that go version directives are consistent across all modules
cmd: ./scripts/check_go_version.sh
check-require-directives:
desc: Checks that internal module require directives reference the same version
cmd: ./scripts/check_require_directives.sh
check-require-directives-round-trip:
desc: Validates that update_require_directives.sh is idempotent (requires a clean git working tree)
cmds:
- ./scripts/check_require_directives_round_trip.sh
- task: check-clean-branch
create-kind-cluster:
desc: Creates the default kind cluster
cmd: bash -x ./scripts/start_kind_cluster.sh {{.CLI_ARGS}}
delete-kind-cluster:
desc: Deletes the default kind cluster
cmd: kind delete cluster
export-cchain-block-range:
desc: Export range of C-Chain blocks from source to target directory.
cmd: go run github.com/ava-labs/avalanchego/tests/reexecute/blockexport {{.CLI_ARGS}}
generate-canoto:
desc: Generates canoto
cmd: go generate -run "canoto" ./...
generate-load-contract-bindings:
desc: Generates load contract bindings
cmds:
- cmd: grep -lr -E '^// Code generated - DO NOT EDIT\.$' tests/load | xargs -r rm
- cmd: go generate ./tests/load/...
generate-mocks:
desc: Generates testing mocks
cmds:
# Avoid deleting mocks in grafted modules
- cmd: grep -lr -E '^// Code generated by MockGen\. DO NOT EDIT\.$' . | grep -v '^./graft' | xargs -r rm
- cmd: go generate -run "mockgen" ./...
generate-protobuf:
desc: Generates protobuf
cmd: ./scripts/protobuf_codegen.sh
ginkgo-build:
desc: Runs ginkgo against the current working directory
cmd: ./bin/ginkgo build {{.USER_WORKING_DIR}}
go-mod-tidy:
desc: Ensures that go module configuration is consistent
cmds:
# GOWORK=off is required because lint tooling runs with GOWORK=off
# (see scripts/run_tool.sh) and dependency resolution differs when
# the workspace is enabled vs disabled.
#
# NOTE: Using explicit 'cd' instead of Task's 'dir:' directive because
# 'dir:' doesn't properly isolate the go.work context, causing go mod tidy
# to miss some indirect dependency go.mod hashes in go.sum.
- cmd: GOWORK=off go mod tidy
# GOWORK=off is required because tools/external is not part of the workspace
# and go will otherwise find go.work by walking up the tree
- cmd: cd tools/external && GOWORK=off go mod tidy
# GOWORK=off is required for graft modules because lint tooling runs
# with GOWORK=off (see scripts/run_tool.sh) and dependency resolution
# differs when the workspace is enabled vs disabled.
- cmd: cd graft/evm && GOWORK=off go mod tidy
- cmd: cd graft/coreth && GOWORK=off go mod tidy
- cmd: cd graft/subnet-evm && GOWORK=off go mod tidy
- task: sync-go-work
install-nix:
desc: Installs nix with an OS-appropriate installer
cmd: ./scripts/install_nix.sh
lint:
desc: Runs static analysis tests of golang code
cmd: ./scripts/lint.sh
lint-action:
desc: Runs actionlint to check sanity of github action configuration
cmd: ./scripts/actionlint.sh
lint-all:
desc: Runs all lint checks in parallel
deps:
- lint
- lint-action
- lint-shell
- check-go-mod-tidy
- check-go-version
- check-require-directives
- check-require-directives-round-trip
lint-all-ci:
desc: Runs all lint checks one-by-one
cmds:
- task: lint
- task: lint-action
- task: lint-shell
- task: check-go-mod-tidy
- task: check-go-version
- task: check-require-directives
- task: check-require-directives-round-trip
lint-fix:
desc: Runs automated fixing for failing static analysis of golang code
cmd: ./scripts/run_tool.sh golangci-lint run --config .golangci.yml --fix
lint-shell:
desc: Runs shellcheck to check sanity of shell scripts
cmd: ./scripts/shellcheck.sh
run-polyrepo:
desc: "Run polyrepo for orchestrating local dependencies. Example: LIBEVM_REF=v1.2.3 FIREWOOD_REF=abc123 task run-polyrepo"
cmd: ./scripts/run_polyrepo.sh {{.CLI_ARGS}}
setup-chain-data:
desc: Sets up C-Chain test data (blocks from S3, state from S3 or empty for genesis).
cmd: ./scripts/setup_cchain_data.sh
sync-go-work:
desc: Downloads module dependencies and syncs go.work.sum
cmds:
- cmd: go mod download
# GOWORK="" ensures workspace mode is enabled (overrides any GOWORK=off in environment)
- cmd: GOWORK="" go work sync
test-bootstrap-monitor-e2e:
desc: Runs bootstrap monitor e2e tests
cmd: bash -x ./scripts/tests.e2e.bootstrap_monitor.sh
test-build-antithesis-images-avalanchego:
desc: Tests the build of antithesis images for the avalanchego test setup
env:
TEST_SETUP: avalanchego
cmds:
- task: build-race
- cmd: go run ./tests/antithesis/avalanchego --avalanchego-path=./build/avalanchego --duration=120s
- cmd: bash -x ./scripts/tests.build_antithesis_images.sh
test-build-antithesis-images-subnet-evm:
desc: Tests the build of antithesis images for the subnet-evm test setup
env:
TEST_SETUP: subnet-evm
cmds:
- task: build-race
- task: build-subnet-evm
- cmd: cd graft/subnet-evm && go run ./tests/antithesis --avalanchego-path=../../build/avalanchego --plugin-dir=../../build/plugins --duration=120s
- cmd: bash -x ./scripts/tests.build_antithesis_images.sh
test-build-antithesis-images-xsvm:
desc: Tests the build of antithesis images for the xsvm test setup
env:
TEST_SETUP: xsvm
cmds:
- task: build-race
- task: build-xsvm
- cmd: go run ./tests/antithesis/xsvm --avalanchego-path=./build/avalanchego --duration=120s
- cmd: bash -x ./scripts/tests.build_antithesis_images.sh
test-build-image:
# On mac, docker/podman/lima should work out-of-the-box.
# On linux, requires qemu (e.g. apt -y install qemu-system qemu-user-static).
desc: Runs test of cross-platform docker image build
cmd: bash -x scripts/tests.build_image.sh
test-cchain-reexecution:
desc: Runs C-Chain re-execution test. Run without args to see available tests.
cmd: ./scripts/benchmark_cchain_range.sh {{.CLI_ARGS}}
test-e2e:
desc: Runs e2e tests
cmds:
- task: build
- task: build-xsvm
- cmd: bash -x ./scripts/tests.e2e.sh {{.CLI_ARGS}}
test-e2e-ci:
desc: Runs e2e tests [serially with race detection enabled]
env:
E2E_SERIAL: 1
cmds:
- task: build-race
- task: build-xsvm
- cmd: bash -x ./scripts/tests.e2e.sh {{.CLI_ARGS}}
test-e2e-existing-ci:
desc: Runs e2e tests with an existing network [serially with race detection enabled]
env:
E2E_SERIAL: 1
cmds:
- task: build-race
- task: build-xsvm
- cmd: bash -x ./scripts/tests.e2e.existing.sh {{.CLI_ARGS}}
test-e2e-kube:
desc: Runs e2e tests against a network deployed to kube
cmds:
- cmd: bash -x ./scripts/tests.e2e.kube.sh {{.CLI_ARGS}}
test-e2e-kube-ci:
# Free github action runners do not have sufficient resources to reliably run a full e2e run against a kube-hosted network
desc: Runs the xsvm e2e tests in serial against a network deployed to kube
env:
E2E_SERIAL: 1
cmds:
- cmd: bash -x ./scripts/tests.e2e.kube.sh --ginkgo.focus-file=xsvm.go {{.CLI_ARGS}}
# test-fuzz targets a single package as a smoke test for fuzz infrastructure.
# For comprehensive fuzzing, use test-fuzz-long FUZZTIME=[value in seconds].
# A value of `-1` will run until it encounters a failing output.
test-fuzz:
desc: Smoke tests fuzz infrastructure with a quick package
vars:
FUZZTIME: '{{.FUZZTIME| default "10"}}'
cmd: ./scripts/build_fuzz.sh {{.FUZZTIME}} ./utils/cb58
test-fuzz-long:
desc: Runs each fuzz test for 180 seconds
vars:
FUZZTIME: '{{.FUZZTIME| default "180"}}'
cmd: ./scripts/build_fuzz.sh {{.FUZZTIME}}
test-fuzz-merkledb:
desc: Runs each merkledb fuzz test for 15 minutes
vars:
FUZZTIME: '{{.FUZZTIME| default "900"}}'
cmd: ./scripts/build_fuzz.sh {{.FUZZTIME}} ./x/merkledb
test-load:
desc: Runs load tests
cmds:
- task: generate-load-contract-bindings
- task: build
- cmd: go run ./tests/load/main --avalanchego-path=./build/avalanchego {{.CLI_ARGS}}
test-load-exclusive:
desc: Runs load tests against kube with exclusive scheduling
cmds:
- cmd: go run ./tests/load/main --runtime=kube --kube-use-exclusive-scheduling {{.CLI_ARGS}}
test-load-kube:
desc: Runs load tests against a kubernetes cluster
cmds:
- task: generate-load-contract-bindings
- cmd: go run ./tests/load/main --runtime=kube {{.CLI_ARGS}}
test-load-kube-kind:
desc: Runs load tests against a kind cluster
cmds:
- task: generate-load-contract-bindings
- cmd: bash -x ./scripts/tests.load.kube.kind.sh {{.CLI_ARGS}}
test-robustness:
desc: Deploys kind with chaos mesh. Intended to eventually run a robustness (fault-injection) test suite.
cmds:
- ./bin/tmpnetctl start-kind-cluster --install-chaos-mesh
test-unit:
desc: Runs unit tests
# Invoking with bash ensures compatibility with CI execution on Windows
cmd: bash ./scripts/build_test.sh
test-unit-fast:
desc: Runs unit tests
env:
NO_SHUFFLE: TRUE # Allows caching
NO_RACE: TRUE # Tests are much faster without race detection
cmd: bash ./scripts/build_test.sh
tags-create:
desc: Creates tags for avalanchego and submodules
cmd: ./scripts/create_tags.sh {{.CLI_ARGS}}
tags-push:
desc: Pushes tags for avalanchego and submodules and verifies delivery
cmds:
- ./scripts/push_tags.sh {{.CLI_ARGS}}
- ./scripts/verify_tags_remote.sh {{.CLI_ARGS}}
tags-update-require-directives:
desc: Updates require directives for avalanchego modules
cmds:
- ./scripts/update_require_directives.sh {{.CLI_ARGS}}
- task: go-mod-tidy
- task: check-require-directives
tags-verify-remote:
desc: Verifies tags for avalanchego and submodules exist on the remote
cmd: ./scripts/verify_tags_remote.sh {{.CLI_ARGS}}
test-upgrade:
desc: Runs upgrade tests
cmds:
- task: build
- cmd: bash -x ./scripts/tests.upgrade.sh {{.CLI_ARGS}}
update-go-version:
desc: "Updates go version directives across all modules. Usage: task update-go-version -- <version> (e.g. 1.25.7)"
cmds:
- cmd: ./scripts/set_go_version.sh {{.CLI_ARGS}}
- task: go-mod-tidy