Files
radicle-ci-broker/build.rs
T
Lars Wirzenius 1f1e0c72b7 tests: add subplot to capture acceptance criteria and verification
Add a markdown document to document acceptance criteria for the CI
broker, and also how to verify they are being met. The document is
used by the Subplot software, and the verification is run as part of
"cargo test".

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-05-07 19:32:51 +03:00

28 lines
799 B
Rust

// Build acceptance test suite using Subplot.
use std::process::Command;
fn main() {
// Set a build-time `GIT_HEAD` env var which includes the commit id;
// such that we can tell which code is running.
let hash = Command::new("git")
.arg("rev-parse")
.arg("--short")
.arg("HEAD")
.output()
.ok()
.and_then(|output| {
if output.status.success() {
String::from_utf8(output.stdout).ok()
} else {
None
}
})
.unwrap_or_else(|| String::from("unknown"));
println!("cargo:rustc-env=GIT_HEAD={hash}");
println!("cargo:rustc-rerun-if-changed=.git/HEAD");
subplot_build::codegen("ci-broker.subplot").expect("failed to generate code with Subplot");
}