repositories / smith

smith

There are many coding harnesses - but this one is fast

owned by bugabinga

ci: make cargo x bootstrap self-sufficient, drop mise

bb40e56382ece281f87b50a38d4b5bb725cafd6a

Oliver Jan Krylow <oliver@bugabinga.net> ·

unsigned

Browse filesCompare with HEAD

bootstrap now installs cargo-binstall, then the pinned cargo-nextest
through it, before adding the nightly components and building cargo_pup.
mise.toml is deleted because no gate tool depends on mise anymore, and
the Luci job shrinks to rustup components plus bootstrap and check.

Changed files (3)

+47 / −37 text lines

Diff layout

.ci/check.kdl

Modified

+0 / −1 text lines

11job "check" {
22 image "docker.io/library/rust:latest"
33 run "rustup component add rustfmt clippy"
4 run "rustup toolchain install nightly-2026-01-22 --profile minimal --component rust-src,rustc-dev,llvm-tools"
54 run "cargo run -p xtask -- bootstrap"
65 run "cargo run -p xtask -- check"
76}

mise.toml

Deleted
deleted file mode 100644

+0 / −9 text lines

1# Smith tooling.
2# Source of truth: .system/RULES.md (build gates), xtask/src/main.rs (invocation).
3# aqua ships prebuilt cargo-nextest; cargo_pup has no binaries and must be
4# built from source on the pinned nightly, see xtask's bootstrap command.
5[tools]
6"aqua:nextest-rs/nextest/cargo-nextest" = "0.9.144"
7
8[settings]
9experimental = true

xtask/src/main.rs

Modified

+47 / −27 text lines

2424/// Version of `cargo_pup` used by the architecture gate.
2525const PUP_VERSION: &str = "0.1.8";
27/// Version of `cargo-nextest` used by the test gate.
28const NEXTEST_VERSION: &str = "0.9.144";
30/// Version of `cargo-binstall` used to install `cargo-nextest`.
31const BINSTALL_VERSION: &str = "latest";
2632const CRATES: &[&str] = &[
2733 "smith",
2834 "smith-core",
110116/// Install the external gate tools that Cargo cannot ship.
111117///
112/// `cargo-nextest` comes from mise (see mise.toml); `cargo_pup` has no
113/// published
114/// binaries, so it is built from source on the pinned nightly with its
115/// rustc-dev dependency, which `rustup component add` provides.
118/// `cargo-nextest` arrives as a prebuilt binary through `cargo-binstall`;
119/// `cargo_pup` has no published binaries, so it is built from source on the
120/// pinned nightly with its rustc-dev dependency, which `rustup component
121/// add` provides. Both steps are idempotent.
116122fn bootstrap() -> ExitCode {
117 let steps: [Step; 3] = [add_pup_components, install_pup, report_nextest];
123 let steps: [Step; 3] = [install_binstall, install_nextest, install_pup];
118124 sequence(&steps)
127fn install_binstall() -> ExitCode {
128 tool_present(&["binstall", "--help"], || {
129 cargo(&["install", "cargo-binstall", "--version", BINSTALL_VERSION])
130 })
131}
133fn install_nextest() -> ExitCode {
134 tool_present(&["nextest", "--version"], || {
135 cargo(&[
136 "binstall",
137 &format!("cargo-nextest@{NEXTEST_VERSION}"),
138 "--no-confirm",
139 ])
140 })
141}
121143fn add_pup_components() -> ExitCode {
122144 run(
123145 "rustup",
136158fn install_pup() -> ExitCode {
137 let already = Command::new("cargo")
138 .args([PINNED_NIGHTLY, "pup", "--help"])
139 .stdout(std::process::Stdio::null())
140 .stderr(std::process::Stdio::null())
141 .status()
142 .is_ok_and(|status| status.success());
143 if already {
144 return ExitCode::SUCCESS;
159 let components = sequence(&[add_pup_components]);
160 if components != ExitCode::SUCCESS {
161 return components;
145162 }
146 cargo(&[
147 PINNED_NIGHTLY,
148 "install",
149 "cargo_pup",
150 "--version",
151 PUP_VERSION,
152 ])
163 tool_present(&[PINNED_NIGHTLY, "pup", "--help"], || {
164 cargo(&[
165 PINNED_NIGHTLY,
166 "install",
167 "cargo_pup",
168 "--version",
169 PUP_VERSION,
170 ])
171 })
155fn report_nextest() -> ExitCode {
156 match Command::new("cargo")
157 .args(["nextest", "--version"])
174/// Run `probe` with cargo; when it fails, run `install` and return its code.
175/// The probe pins the tool so a stale unpinned binary is replaced.
176fn tool_present(probe: &[&str], install: impl FnOnce() -> ExitCode) -> ExitCode {
177 let mut arguments = vec!["cargo"];
178 arguments.extend_from_slice(probe);
179 match Command::new(arguments[0])
180 .args(&arguments[1..])
158181 .stdout(std::process::Stdio::null())
159182 .stderr(std::process::Stdio::null())
160183 .status()
161184 {
162185 Ok(status) if status.success() => ExitCode::SUCCESS,
163 _ => fail(concat!(
164 "cargo-nextest is missing: run `mise install` once,\n",
165 "it provides the pinned cargo-nextest from mise.toml\n",
166 )),
186 _ => install(),
167187 }