-
Notifications
You must be signed in to change notification settings - Fork 856
Expand file tree
/
Copy pathTaskfile.yml
More file actions
153 lines (128 loc) · 5.41 KB
/
Copy pathTaskfile.yml
File metadata and controls
153 lines (128 loc) · 5.41 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
# https://taskfile.dev
# To run on a system without task installed, `./scripts/run_task.sh` will
# prefer a real task on PATH, otherwise bootstrap task via `go tool`.
# If in the nix dev shell, repo tasks use the pinned toolchain.
version: '3'
env:
AVALANCHEGO_BUILD_PATH: '{{.AVALANCHEGO_BUILD_PATH | default (printf "%s/avalanchego/build" .TASKFILE_DIR) }}'
vars:
# Task entrypoints run through the repo's nix wrapper so they use the pinned
# dev-shell toolchain when nix is available, without nesting nix shells.
NIX_RUN: '{{printf "%s/../../scripts/nix_run.sh" .TASKFILE_DIR}}'
tasks:
default: '{{.NIX_RUN}} ./scripts/run_task.sh --list'
build-test:
desc: Run all Go tests with retry logic for flaky tests, race detection, and coverage reporting
cmd: '{{.NIX_RUN}} ./scripts/build_test.sh'
check-clean-branch:
desc: Checks that the git working tree is clean
cmds:
- cmd: '{{.NIX_RUN}} git add --all'
- cmd: '{{.NIX_RUN}} bash -c "git update-index --really-refresh >> /dev/null"'
- cmd: '{{.NIX_RUN}} git status --short' # Show the status of the working tree.
- cmd: '{{.NIX_RUN}} git diff-index --quiet HEAD' # Exits if any uncommitted changes are found.
check-generate-codec:
desc: Checks that generated codec files are up-to-date (requires a clean git working tree)
cmds:
- task: generate-codec
- 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-rlp:
desc: Checks that generated rlp files are up-to-date (requires a clean git working tree)
cmds:
- task: generate-rlp
- task: check-clean-branch
check-generate-bindings:
desc: Checks that generated Go bindings from all Solidity contracts are up-to-date (requires a clean git working tree)
cmds:
- task: generate-bindings
- task: check-clean-branch
check-go-mod-tidy:
desc: Checks that all go.mod and go.sum files are up-to-date (requires a clean git working tree)
cmds:
- cmd: '{{.NIX_RUN}} go mod tidy'
- task: check-clean-branch
coverage:
desc: Display test coverage statistics from coverage.out file
cmd: '{{.NIX_RUN}} ./scripts/coverage.sh'
generate-codec:
desc: Generates fjl/gencodec files
cmds:
- cmd: '{{.NIX_RUN}} bash -c "grep -lr -E ''^// Code generated by github\\.com/fjl/gencodec\\. DO NOT EDIT\\.$'' . | xargs -r rm"'
- cmd: '{{.NIX_RUN}} go generate -run gencodec ./...'
generate-mocks:
desc: Generates testing mocks
cmds:
- cmd: '{{.NIX_RUN}} bash -c "grep -lr -E ''^// Code generated by MockGen\\. DO NOT EDIT\\.$'' . | xargs -r rm"'
- cmd: '{{.NIX_RUN}} go generate -run mockgen ./...'
generate-rlp:
desc: Generates rlp files
cmds:
- cmd: '{{.NIX_RUN}} bash -c "grep -lr -E ''^// Code generated by rlpgen\\. DO NOT EDIT.\\.$'' . | xargs -r rm"'
- cmd: '{{.NIX_RUN}} go generate -run rlpgen ./...'
generate-bindings:
desc: Generates Go bindings from Solidity contracts (searches for all compile.go files)
cmds:
- cmd: '{{.NIX_RUN}} bash -c "find . -type f \\( -name ''*.abi'' -o -name ''*.bin'' \\) ! -path ''*/artifacts/*'' ! -path ''*/contracts/*'' | xargs -r rm"'
- cmd: '{{.NIX_RUN}} bash -c "find . -type f -name ''compile.go'' -execdir go generate {} \\;"'
lint:
desc: Run golangci-lint and check for allowed Ethereum imports in Go code
cmd: '{{.NIX_RUN}} ../evm/scripts/lint.sh'
lint-all:
desc: Runs all lint checks
cmds:
# Phase 1: Read-only checks that are safe to parallelize.
- task: _lint-readonly-parallel
# Phase 2: Tree-mutating checks must be sequential to avoid races
# while rewriting generated files and verifying a clean git state.
- task: _lint-tree-mutating-serial
_lint-readonly-parallel:
internal: true
deps:
- lint
- shellcheck
_lint-tree-mutating-serial:
internal: true
cmds:
- task: check-generate-codec
- task: check-generate-mocks
- task: check-generate-rlp
- task: check-generate-bindings
lint-all-ci:
desc: Runs all lint checks one-by-one
cmds:
- task: lint
- task: shellcheck
- task: check-generate-codec
- task: check-generate-mocks
- task: check-generate-rlp
- task: check-generate-bindings
lint-fix:
desc: Run golangci-lint with auto-fix where possible
cmd: '{{.NIX_RUN}} ../evm/scripts/lint_fix.sh'
shellcheck:
desc: Run shellcheck static analysis on all shell scripts with version management
cmd: '{{.NIX_RUN}} ../../scripts/shellcheck.sh'
test-e2e-warp:
desc: Run end-to-end warp tests using Ginkgo test framework
dir: ../../
env:
E2E_TARGET: ./graft/coreth/tests/warp
cmds:
- cmd: '{{.NIX_RUN}} ./scripts/run_task.sh build'
- cmd: "{{.NIX_RUN}} bash -c 'cd graft/subnet-evm && ./scripts/build.sh'"
- cmd: '{{.NIX_RUN}} bash -x ./scripts/tests.e2e.sh {{.CLI_ARGS}}'
test-e2e-warp-ci: # consolidated test-e2e-warp
desc: Run E2E warp tests with CI setup
dir: ../../
env:
E2E_TARGET: ./graft/coreth/tests/warp
E2E_SERIAL: 1
cmds:
- cmd: '{{.NIX_RUN}} ./scripts/run_task.sh build-race'
- cmd: "{{.NIX_RUN}} bash -c 'cd graft/subnet-evm && ./scripts/build.sh'"
- cmd: '{{.NIX_RUN}} bash -x ./scripts/tests.e2e.sh {{.CLI_ARGS}}'