-
Notifications
You must be signed in to change notification settings - Fork 37
Expand file tree
/
Copy pathMakefile.toml
More file actions
294 lines (245 loc) · 12.5 KB
/
Copy pathMakefile.toml
File metadata and controls
294 lines (245 loc) · 12.5 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
extend = [
{ path = "tools/makefiles/lints.toml" },
{ path = "tools/makefiles/notify.toml" },
{ path = "tools/makefiles/rocksdb.toml" },
]
env_files = [".env.testing-artifacts"]
[config]
default_to_workspace = false
[env]
IMAGE_NAME = "zingodevops/zaino-ci"
TEST_BINARIES_DIR = "/home/container_user/artifacts"
CONTAINERS_CONF_OVERRIDE = "${CARGO_MAKE_WORKING_DIRECTORY}/.config/containers.conf"
# Single source of truth: rust-toolchain.toml's `channel`, extracted via the
# workbench `get-rust-version` binary. Replaces RUST_VERSION in
# .env.testing-artifacts.
RUST_VERSION = { script = ["cargo run -q --manifest-path tools/workbench/Cargo.toml --bin get-rust-version"] }
[tasks.help]
description = "List available commands and usage notes"
script_runner = "bash"
extend = "base-script"
script.main = 'source "./tools/scripts/help.sh"'
[tasks.base-script]
# The pre-script lives in tools/scripts/base-script-pre.sh and is *sourced*
# (not executed) so the TAG var, podman_cleanup function, and cleanup trap it
# defines stay in scope for each consuming task's script.main. cargo-make
# concatenates pre/main/post into one shell program, so sourcing keeps them in
# the same shell.
script_runner = "bash"
script.pre = 'source "./tools/scripts/base-script-pre.sh"'
script.main = "err 'default main script. define a proper script to skip this one'"
script.post = ""
# -------------------------------------------------------------------
[tasks.init-podman-volumes]
description = "Initialize named podman volumes for container builds"
script_runner = "bash"
script = 'source "./tools/scripts/init-podman-volumes.sh"'
# -------------------------------------------------------------------
[tasks.compute-image-tag]
description = "Compute image tag from version vars"
script_runner = "bash"
script = 'source "./tools/scripts/compute-image-tag.sh"'
# -------------------------------------------------------------------
[tasks.get-podman-hash]
description = "Get the current CONTAINER_DIR_HASH"
script_runner = "bash"
script = 'source "./tools/scripts/get-podman-hash.sh"'
[tasks.ensure-image-exists]
description = "Ensure the image exists locally, building if needed"
dependencies = ["init-podman-volumes"]
script_runner = "bash"
extend = "base-script"
script.main = 'source "./tools/scripts/ensure-image-exists.sh"'
# -------------------------------------------------------------------
[tasks.pull-ci-image]
description = "Pull the CI image from the registry"
extend = "base-script"
script.main = 'source "./tools/scripts/pull-ci-image.sh"'
# -------------------------------------------------------------------
[tasks.build-image]
description = "Build the container image for testing artifacts"
# Note: This task builds the container image from the live-tests/test_environment
# directory, which contains the Containerfile and entrypoint.sh for the CI/test environment.
script_runner = "bash"
extend = "base-script"
script.main = 'source "./tools/scripts/build-image.sh"'
# -------------------------------------------------------------------
[tasks.push-image]
description = "Push image if running in CI"
# condition = { env_set = ["CI"] }
dependencies = ["ensure-image-exists"]
script_runner = "bash"
extend = "base-script"
script.main = 'source "./tools/scripts/push-image.sh"'
# -------------------------------------------------------------------
[tasks.container-test]
clear = true
description = "Engine: run nextest in the local CI container, forwarding args (zcashd_support OFF by default; --with-zcashd adds --features zcashd_support). Devs use `makers test [packages|e2e|clientless|live|all]`; live-clientless / live-e2e and the `test` front door call this."
# This task runs tests inside the container built from live-tests/test_environment.
# The entrypoint.sh script in the container sets up test binaries (zcashd, zebrad, zcash-cli)
# by creating symlinks from /home/container_user/artifacts to the expected live-tests/test_binaries/bins location.
dependencies = ["init-podman-volumes", "ensure-image-exists"]
script_runner = "bash"
extend = "base-script"
# The container-test binary (tools/test-runner, a std-only cargo crate — no
# rust-script needed) owns the podman run; `set -e` makes a test failure abort
# the script (so `script.post = notify` is skipped on failure, as before).
script.main = '''
set -euo pipefail
cargo run -q --manifest-path tools/test-runner/Cargo.toml --bin container-test -- "${@}"
'''
script.post = "makers notify"
# -------------------------------------------------------------------
[tasks.live-clientless]
description = "Run the `clientless` live-test partition inside the CI container (forwards extra args to `cargo nextest run`)"
env = { PACKAGE = "clientless", PACKAGE_DESC = "clientless partition" }
script_runner = "bash"
extend = "base-script"
script.main = 'source "./tools/scripts/container-nextest-workspace.sh"'
# -------------------------------------------------------------------
[tasks.live-e2e]
description = "Run the `e2e` live-test partition inside the CI container (forwards extra args to `cargo nextest run`)"
env = { PACKAGE = "e2e", PACKAGE_DESC = "e2e partition" }
script_runner = "bash"
extend = "base-script"
script.main = 'source "./tools/scripts/container-nextest-workspace.sh"'
# -------------------------------------------------------------------
# ===================================================================
# Developer-facing test front door: a single `makers test [SET]` task.
#
# makers test packages (the default)
# makers test packages packages/* production-crate tests (no validator)
# makers test e2e the e2e live partition
# makers test clientless the clientless live partition
# makers test live both live partitions + combined summary
# makers test all packages then live (everything)
#
# SET names mirror the crate/dir names (`e2e`, `clientless`); `packages`,
# `live`, and `all` are the groupings. `live` = all non-packages tests; `all`
# = `packages` + `live` (see live-tests/CONTEXT.md). Each set delegates to an
# existing engine rather than re-implementing a run. `--with-zcashd` (handled
# by the engines) adds the zcashd-backed tests to any set.
# ===================================================================
[tasks.test]
# clear = true fully replaces cargo-make's built-in `test` task (which runs
# `cargo test`); without it our `script` would merge with the builtin `command`.
clear = true
description = "Run a test set: `makers test [packages|e2e|clientless|live|all|ironwood]` (default: packages). Pass --with-zcashd for the zcashd-backed tests."
script_runner = "bash"
script = '''
set -uo pipefail
usage() {
echo "usage: makers test [packages|e2e|clientless|live|all|ironwood] [-- nextest args]" >&2
echo " packages (default) packages/* tests, no live validator" >&2
echo " e2e | clientless that single live partition" >&2
echo " live both live partitions + combined summary" >&2
echo " all packages then live (everything)" >&2
echo " ironwood the ironwood tests of every set, packages then clientless then e2e" >&2
}
# A non-flag first arg selects the set and must be a known name; a flag first
# arg (or none) keeps the default `packages` and is forwarded to nextest. So
# `makers test --with-zcashd` runs packages with the flag, while a mistyped set
# name errors instead of silently running the default.
set="packages"
if [ "$#" -gt 0 ] && [ "${1#-}" = "$1" ]; then
case "$1" in
packages|e2e|clientless|live|all|ironwood) set="$1"; shift ;;
*) echo "makers test: unknown set '$1'" >&2; usage; exit 2 ;;
esac
fi
case "$set" in
packages) exec makers container-test "$@" ;;
e2e) exec makers live-e2e "$@" ;;
clientless) exec makers live-clientless "$@" ;;
live) exec cargo run -q --manifest-path tools/test-runner/Cargo.toml --bin live-summary -- "$@" ;;
all)
# The summary runner's --all mode runs the packages set and both live
# partitions (each set runs even when an earlier one fails, and the exit
# code reflects any failure), so the combined table covers everything.
exec cargo run -q --manifest-path tools/test-runner/Cargo.toml --bin live-summary -- --all "$@" ;;
ironwood)
# The one definition of the ironwood selection: the two dedicated test
# binaries, plus every test whose name carries the pool's name (the
# CONTEXT.md era-naming convention keeps new ironwood tests inside this
# net). The same expression serves every engine — a selector naming a
# binary a partition lacks simply matches nothing there. The engines are
# invoked directly rather than through the `live` summary runner, which
# forwards no nextest args. Run every set even if an earlier one fails,
# as in `all`.
ironwood_filter='binary(ironwood_activation) | binary(the_pub_testnet_ironwood_boundary) | test(ironwood)'
rc=0
makers container-test -E "$ironwood_filter" "$@" || rc=1
makers live-clientless -E "$ironwood_filter" "$@" || rc=1
makers live-e2e -E "$ironwood_filter" "$@" || rc=1
exit "$rc" ;;
esac
'''
# -------------------------------------------------------------------
[tasks.zcashd_test]
description = "Convenience: the whole suite with the zcashd-backed tests (`makers test all --with-zcashd`)"
# Delegates to the `test all` front door with the explicit flag — there is no
# implicit/env-var path to enable zcashd (docs/adr/0005).
script_runner = "bash"
script = 'exec makers test all --with-zcashd'
# -------------------------------------------------------------------
[tasks.check-matching-zebras]
description = "Check that zebra versions in .env.testing-artifacts match what's in Cargo.toml"
extend = "base-script"
script_runner = "bash"
script.main = 'source "./tools/scripts/check-matching-zebras.sh"'
# -------------------------------------------------------------------
[tasks.validate-makefile-tasks]
description = "Validate all tasks work correctly with minimal execution"
dependencies = ["init-podman-volumes"]
script_runner = "@rust"
script = { file = "tools/scripts/validate-makefile-tasks.rs" }
# -------------------------------------------------------------------
[tasks.validate-test-targets]
description = "Validate that nextest targets match CI workflow matrix"
script_runner = "bash"
extend = "base-script"
script.main = 'source "./tools/scripts/validate-test-targets.sh"'
# -------------------------------------------------------------------
[tasks.update-test-targets]
description = "Update CI workflow matrix to match nextest targets"
script_runner = "bash"
extend = "base-script"
script.main = 'source "./tools/scripts/update-test-targets.sh"'
# -------------------------------------------------------------------
[tasks.container-test-save-failures]
description = "Run container-test and save failed test names for later retry"
script_runner = "bash"
extend = "base-script"
script.main = 'source "./tools/scripts/container-test-save-failures.sh"'
script.post = "makers notify"
# -------------------------------------------------------------------
[tasks.container-test-retry-failures]
description = "Rerun only failed tests from previous container-test-save-failures"
script_runner = "bash"
extend = "base-script"
script.main = 'source "./tools/scripts/container-test-retry-failures.sh"'
script.post = "makers notify"
# -------------------------------------------------------------------
[tasks.verify-all]
description = "Exercise every Makefile.toml task for correctness (idempotent)"
script_runner = "bash"
script = 'source "./tools/scripts/verify-all.sh"'
# -------------------------------------------------------------------
# Verify the no-zcashd build compiles: `zcashd_support` is opt-in and being
# deprecated (docs/adr/0001, 0005), so the default --no-default-features build
# must stay green or it bit-rots. The reunified workspace (production +
# live-test crates) is checked in a single pass.
[tasks.check-no-zcashd-packages]
description = "cargo check --no-default-features across the whole workspace (zcashd_support off)"
command = "cargo"
args = ["check", "--workspace", "--all-targets", "--no-default-features"]
[tasks.check-zaino-proto-heavy]
description = "Guard: zaino-proto `heavy` must stay enabled under --no-default-features (else the no-zcashd test build silently loses zebra-state/zebra-chain/which)"
script_runner = "@rust"
script = { file = "tools/scripts/check-zaino-proto-heavy.rs" }
[tasks.check-no-zcashd]
description = "Verify the no-zcashd (--no-default-features) build compiles across the workspace, and that zaino-proto `heavy` survives it"
dependencies = [
"check-zaino-proto-heavy",
"check-no-zcashd-packages",
]