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
#!/usr/bin/env bash
# Pre-push gate — runs the offline test suite (lib unit + integration tests)
# before code leaves the machine. Lives here rather than in pre-commit because
# the suite is too slow per-commit; fmt + clippy stay in pre-commit for fast
# feedback.
#
# Scope is `--tests` (NOT `--all-targets`): that deliberately excludes the
# criterion benchmarks, which `--all-targets` would *execute* and add minutes
# for zero correctness signal. CI (`cargo test --all-targets`) is the backstop
# that also compiles benches/examples; doctests are skipped both here and there.
#
# Enable once per clone: git config core.hooksPath .githooks
# Bypass in an emergency: git push --no-verify (CI still enforces).
#
# Live tests are `#[ignore]` and need docker services, so they stay out of the
# gate — run them explicitly with `cargo test -- --ignored`.
# Prefer cargo-nextest: it runs each test in its own process, so the consolidated
# test binaries (one link instead of N — tests/offline_suite.rs et al.) stay
# isolated. Falls back to the built-in harness when nextest isn't installed.
if ; then
# Split for speed: the lib/bin UNIT tests are pure + fast — run them threaded
# via the built-in harness. Only the INTEGRATION suites (offline_suite /
# live_suite et al.) need nextest's per-test process isolation, so run just
# those (`kind(test)`) under nextest. Avoids ~1700 process spawns for the lib.
else
# No nextest: fall back to the built-in harness. NOTE this runs each consolidated suite
# (offline_suite / live_suite) as threads in ONE process — a crash / SIGKILL / global-state
# test can poison its siblings (per-test isolation is gone). Install cargo-nextest to restore
# it; CI runs under nextest regardless.
fi
# The test run above ran a non-`--locked` cargo build, which silently reconciles
# the working-tree Cargo.lock against Cargo.toml. If that left the lock DIRTY,
# the COMMITTED lock was stale — and the pushed commit would fail the release's
# `cargo publish --locked` (exit 101, *after* the tag is cut). 0.16.1 stalled
# exactly this way: a version bump regenerated the lock but never committed it.
# Checking *after* the build is the trick — it forces the reconcile that exposes
# a committed-stale lock as a dirty working tree (a pre-build `--locked` check
# sees the already-reconciled tree and is fooled).
if ! ; then
fi