Files
radicle-ci-broker/src/subplot.rs
T
Lars Wirzenius 1d57cc1f2f chore: drop the "given an installed ci-broker" step
It's not used anywhere now that the binary name has changed to cib.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-07-17 18:11:55 +03:00

65 lines
1.5 KiB
Rust

// Implementations of Subplot scenario steps for the CI broker.
use std::path::{Path, PathBuf};
use subplotlib::steplibrary::runcmd::Runcmd;
#[derive(Debug, Default)]
struct SubplotContext {}
impl ContextElement for SubplotContext {}
#[step]
#[context(SubplotContext)]
#[context(Runcmd)]
fn install_cib(context: &ScenarioContext) {
let target_path = bindir();
assert!(target_path.join("cib").exists());
context.with_mut(
|context: &mut Runcmd| {
context.prepend_to_path(target_path);
Ok(())
},
false,
)?;
}
#[step]
#[context(SubplotContext)]
#[context(Runcmd)]
fn install_cibtool(context: &ScenarioContext) {
let target_path = bindir();
assert!(target_path.join("cibtool").exists());
context.with_mut(
|context: &mut Runcmd| {
context.prepend_to_path(target_path);
Ok(())
},
false,
)?;
}
#[step]
#[context(SubplotContext)]
#[context(Runcmd)]
fn install_synthetic_events(context: &ScenarioContext) {
let target_path = bindir();
assert!(target_path.join("synthetic-events").exists());
context.with_mut(
|context: &mut Runcmd| {
context.prepend_to_path(target_path);
Ok(())
},
false,
)?;
}
fn bindir() -> PathBuf {
let path = if let Ok(target) = std::env::var("CARGO_TARGET_DIR") {
Path::new(&target).join("debug")
} else {
PathBuf::from("target/debug")
};
path.canonicalize().unwrap()
}