chore: drop the rad-ci binary

It's not in its own crate.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
This commit is contained in:
Lars Wirzenius
2025-02-18 13:45:23 +02:00
parent c9d28a15f2
commit 331d68fb10
2 changed files with 0 additions and 93 deletions
-63
View File
@@ -1,63 +0,0 @@
use std::{
path::Path,
process::{exit, Command},
};
use clap::Parser;
use radicle_native_ci::{run::RUNSPEC_PATH, runspec::RunSpec};
// Exit codes for the program.
const EXIT_OK: i32 = 0;
const EXIT_FAILURE: i32 = 1;
const EXIT_ERROR: i32 = 2;
/// The main program.
fn main() {
let code = match fallible_main() {
Ok(success) => {
if success {
EXIT_OK
} else {
EXIT_FAILURE
}
}
Err(e) => {
eprintln!("ERROR: {}", e);
let mut e = e.source();
while let Some(source) = e {
eprintln!("caused by: {}", source);
e = source.source();
}
EXIT_ERROR
}
};
exit(code);
}
fn fallible_main() -> Result<bool, Box<dyn std::error::Error>> {
let args = Args::parse();
let runspec = RunSpec::from_file(Path::new(RUNSPEC_PATH))?;
let shell = format!("set -xeuo pipefail\n{}", runspec.shell);
if args.dry_run {
print!("{shell}");
Ok(true)
} else {
let exit = Command::new("bash").args(["-c", &shell]).spawn()?.wait()?;
Ok(exit.success())
}
}
/// Run the commands the Radicle native CI adapter would run for this
/// repository.
///
/// The shell commands are specified in the .radicle/native.yaml file,
/// in the shell field. They are run directly on the host, using the
/// Bash shell, without any isolation.
#[derive(Debug, Parser)]
#[clap(version)]
struct Args {
/// Don't actually run anything, merely output what would be given
/// to Bash to run.
#[clap(long, alias = "no-act")]
dry_run: bool,
}