-
Notifications
You must be signed in to change notification settings - Fork 41
Expand file tree
/
Copy pathMakefile.toml
More file actions
291 lines (251 loc) · 7.58 KB
/
Copy pathMakefile.toml
File metadata and controls
291 lines (251 loc) · 7.58 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
[tasks.check-all-fast]
description = "Run all fast checks"
dependencies = [
"crate-names",
"kebab-file-names",
"todo-format",
"editorconfig",
"assert-matches",
"ast-grep-scan",
"ast-grep-test",
"fmt",
"cargo-sort",
"cargo-shear",
"cargo-deny-no-advisories",
"zizmor",
"opengrep",
"check-markdown-links",
"sandbox-image-version",
"check",
"check-docs",
"clippy",
"clippy-all-features",
"contract-check",
]
[tasks.check-all]
description = "Run all checks"
dependencies = ["check-all-fast", "nextest"]
[tasks.check-extra]
description = "Run extra checks"
dependencies = ["cargo-deny"]
[tasks.check]
command = "cargo"
args = ["check"]
[tasks.clippy-all-features]
command = "cargo"
args = [
"clippy",
"--all-features",
"--all-targets",
"--locked",
"--",
"-D",
"warnings",
]
[tasks.clippy]
command = "cargo"
args = ["clippy", "--all-targets", "--locked", "--", "-D", "warnings"]
[tasks.contract-check]
description = "Lint contract crates under the real build config via `cargo near check`"
command = "bash"
args = ["scripts/check-contract-clippy.sh"]
[tasks.fmt]
command = "cargo"
args = ["fmt", "--", "--check"]
[tasks.cargo-sort]
command = "cargo"
args = ["sort", "--workspace", "--grouped", "--check", "--check-format"]
[tasks.cargo-shear]
command = "cargo"
args = ["shear", "--deny-warnings"]
[tasks.nextest]
command = "cargo"
args = [
"nextest",
"run",
"--cargo-profile=test-release",
"--all-features",
"--all-targets",
"--locked",
]
[tasks.zizmor]
command = "zizmor"
args = [".github/"]
[tasks.opengrep]
command = "bash"
args = ["scripts/run-opengrep.sh"]
[tasks.crate-names]
command = "bash"
args = ["scripts/check-crates-kebab-case.sh"]
[tasks.kebab-file-names]
command = "bash"
args = ["scripts/check-kebab-case-files.sh"]
[tasks.todo-format]
command = "bash"
args = ["scripts/check-todo-format.sh"]
[tasks.editorconfig]
description = "Enforce .editorconfig rules across all tracked files"
command = "editorconfig-checker"
[tasks.check-contract-size]
description = "Check reproducible contract WASM size against baseline"
command = "bash"
args = ["scripts/check-contract-wasm-size.sh"]
[tasks.assert-matches]
description = "Check for assert!(matches!(...)) — use assert_matches!() instead"
command = "bash"
args = ["scripts/check-assert-matches.sh"]
[tasks.ast-grep-scan]
description = "Run every lints/rules structural lint over the workspace"
command = "ast-grep"
args = ["scan", "crates/"]
[tasks.ast-grep-test]
description = "Check that the lints/rules accept and reject what lints/tests says they should"
# The report each rule prints is not snapshotted, only the verdict per snippet.
command = "ast-grep"
args = ["test", "--skip-snapshot-tests"]
[tasks.cargo-deny]
description = "Run cargo deny"
command = "cargo"
args = ["deny", "--all-features", "check"]
[tasks.cargo-deny-no-advisories]
description = "Run cargo deny without advisories"
command = "cargo"
args = ["deny", "--all-features", "check", "licenses", "bans", "sources"]
[tasks.license-file]
command = "bash"
args = ["scripts/check-third-party-licenses.sh"]
[tasks.check-docs]
description = "Check rustdoc for broken intra-doc links"
command = "cargo"
args = [
"doc",
"--workspace",
"--no-deps",
"--all-features",
"--document-private-items",
"--locked",
]
[tasks.check-docs.env]
RUSTDOCFLAGS = "-D warnings"
[tasks.check-markdown-links]
command = "lychee"
args = ["--no-progress", "."]
[tasks.sandbox-image-version]
description = "Check that sandbox Docker image version matches nearcore"
command = "bash"
args = ["scripts/check-sandbox-image-version.sh"]
# These build tasks are the single source of truth for both local and CI builds.
# CI's `mpc-e2e-tests` job invokes them via `cargo make`.
# Each is skipped when `E2E_SKIP_BUILD` is set (used by `e2e-tests-skip-build`).
[tasks.build-mpc-node-network-hardship-simulation]
description = "Build the mpc-node binary used by the E2E tests"
condition = { env_not_set = ["E2E_SKIP_BUILD"] }
command = "cargo"
args = [
"build",
"-p",
"mpc-node",
"--release",
"--features",
"network-hardship-simulation,test-utils",
"--locked",
]
# Build via cargo-near, the same tool that produces the deployed/reproducible
# artifact. It sets `--cfg near` (required by near-sdk's host bindings — e.g.
# `env::panic_str` -> `panic_utf8`) and runs wasm-opt. A plain `cargo build`
# omits `--cfg near`, which makes contract panics compile to raw `unreachable`
# traps instead of readable errors. Output: target/near/<crate>/<crate>.wasm.
[tasks.build-mpc-contract-optimized]
description = "Build the mpc-contract WASM used by the E2E tests"
condition = { env_not_set = ["E2E_SKIP_BUILD"] }
command = "cargo"
args = [
"near",
"build",
"non-reproducible-wasm",
"--no-abi",
"--profile=release-contract",
"--manifest-path",
"crates/contract/Cargo.toml",
"--locked",
]
[tasks.build-tee-verifier-optimized]
description = "Build the tee-verifier WASM for localnet and the E2E tests"
condition = { env_not_set = ["E2E_SKIP_BUILD"] }
command = "cargo"
args = [
"near",
"build",
"non-reproducible-wasm",
"--no-abi",
"--profile=release-contract",
"--manifest-path",
"crates/tee-verifier/Cargo.toml",
"--locked",
]
[tasks.build-test-parallel-contract-optimized]
description = "Build the test-parallel-contract WASM used by the E2E tests"
condition = { env_not_set = ["E2E_SKIP_BUILD"] }
command = "cargo"
args = [
"near",
"build",
"non-reproducible-wasm",
"--no-abi",
"--profile=release-contract",
"--manifest-path",
"crates/test-parallel-contract/Cargo.toml",
"--locked",
]
[tasks.build-backup-cli]
description = "Build the backup-cli binary used by the E2E migration tests"
condition = { env_not_set = ["E2E_SKIP_BUILD"] }
command = "cargo"
args = ["build", "-p", "backup-cli", "--release", "--locked"]
# Kill orphan mpc-node processes left over from interrupted test runs.
# Ports are deterministic per test, so orphans from a previous run block the next one.
[tasks.kill-orphan-mpc-nodes]
description = "Kill orphan mpc-node processes left over from interrupted E2E test runs"
script = [
"pids=$(pgrep -f 'mpc-node start-with-config-file' || true)",
"if [ -n \"$pids\" ]; then echo \"Killing orphan mpc-node processes: $pids\"; kill $pids; sleep 1; else echo \"No orphan mpc-node processes found\"; fi",
]
# Shared logic for `e2e-tests` and `e2e-tests-skip-build`. Dependencies are
# skipped automatically when `E2E_SKIP_BUILD` is set.
[tasks._run-e2e-logic]
private = true
dependencies = [
"build-mpc-node-network-hardship-simulation",
"build-mpc-contract-optimized",
"build-tee-verifier-optimized",
"build-test-parallel-contract-optimized",
"build-backup-cli",
]
command = "cargo"
args = [
"nextest",
"run",
"--cargo-profile=test-release",
"-p",
"e2e-tests",
"--all-features",
"--locked",
"--profile",
"ci-e2e",
"${@}",
]
[tasks._run-e2e-logic.env]
MPC_CONTRACT_WASM = "${CARGO_MAKE_WORKING_DIRECTORY}/target/near/mpc_contract/mpc_contract.wasm"
MPC_PARALLEL_CONTRACT_WASM = "${CARGO_MAKE_WORKING_DIRECTORY}/target/near/test_parallel_contract/test_parallel_contract.wasm"
MPC_TEE_VERIFIER_WASM = "${CARGO_MAKE_WORKING_DIRECTORY}/target/near/tee_verifier/tee_verifier.wasm"
# Build the mpc-node binary, the contract WASMs, and the backup CLI, then run the E2E tests.
[tasks.e2e-tests]
description = "Build required binaries and run the E2E tests"
run_task = "_run-e2e-logic"
# Reuse the binaries from a previous `cargo make e2e-tests` run.
[tasks.e2e-tests-skip-build]
description = "Run the E2E tests using previously built binaries"
env = { "E2E_SKIP_BUILD" = "true" }
run_task = "_run-e2e-logic"
[config]
default_to_workspace = false