Radish alpha
r
rad:z3qg5TKmN83afz2fj9z3fQjU8vaYE
Radicle CI adapter for native CI
Radicle
Git
chore: bump dependency on radicle-ci-broker to new release
Merged liw opened 1 year ago

Signed-off-by: Lars Wirzenius liw@liw.fi

chore: drop the rad-ci binary

It’s not in its own crate.

Signed-off-by: Lars Wirzenius liw@liw.fi

chore: prepare release 0.8.0

Signed-off-by: Lars Wirzenius liw@liw.fi

6 files changed +16 -98 d5917bf9 3106f0c3
modified Cargo.lock
@@ -1918,9 +1918,9 @@ dependencies = [

[[package]]
name = "radicle-ci-broker"
-
version = "0.12.0"
+
version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-
checksum = "874e2c48bcc5ad6fd503ff09689923be2313cc37e07d8b05c04b9227199a9e6d"
+
checksum = "0a9ddca49df34a27f93c897268962bebc8f5059d8e6277f28fbf10f50b8c0764"
dependencies = [
 "anyhow",
 "clap",
@@ -2013,7 +2013,7 @@ dependencies = [

[[package]]
name = "radicle-native-ci"
-
version = "0.7.0"
+
version = "0.8.0"
dependencies = [
 "clap",
 "html-page",
modified Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "radicle-native-ci"
-
version = "0.7.0"
+
version = "0.8.0"
edition = "2021"
default-run = "radicle-native-ci"
rust-version = "1.80.1"
@@ -15,7 +15,7 @@ categories = ["development-tools::build-utils"]
clap = { version = "4.5.23", features = ["derive"] }
html-page = "0.4.0"
radicle = "0.14.0"
-
radicle-ci-broker = "0.12.0"
+
radicle-ci-broker = "0.13.0"
radicle-git-ext = "0.8.1"
serde = { version = "1.0.193", features = ["derive"] }
serde_json = "1.0.114"
modified NEWS.md
@@ -4,6 +4,11 @@ This file summarizes the user-visible changes to `radicle-native-ci`
between releases.


+
## Version 0.8.0, released 2025-02-18
+

+
* The `rad-ci` binary has been dropped from this crate, as the new
+
  `rad-ci` crate provides a better version now.
+

## Version 0.7.0, released 2025-02-03

* The `README.md` file documents the exit codes used by the adapter,
modified README.md
@@ -22,39 +22,9 @@ shell: |

[Radicle CI broker]: https://app.radicle.xyz/nodes/radicle.liw.fi/rad:zwTxygwuz5LDGBq255RA2CbNGrz8

-
This crate also includes the program `rad-ci`, which runs the commands
-
the adapter runs when invoked by the CI broker. To use: install it on
-
your `$PATH` (using `cargo install`) and run:
-

-
```sh
-
rad ci
-
```
-

This will read `.radicle/native.yaml` and run the shell commands
specified there.

-
Toe see `rad-ci` options, run it with the `--help` option:
-

-
~~~sh
-
$ rad-ci -- --help
-
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.
-

-
Usage: rad-ci [OPTIONS]
-

-
Options:
-
      --dry-run
-
          Don't actually run anything, merely output what would be given to Bash to run
-

-
  -h, --help
-
          Print help (see a summary with '-h')
-

-
  -V, --version
-
          Print version
-
~~~
-

## Architecture

See the [documentation](doc) directory for an architecture document.
modified debian/changelog
@@ -1,3 +1,9 @@
+
radicle-native-ci (0.8.0-1) unstable; urgency=medium
+

+
  * New release.
+

+
 -- Lars Wirzenius <liw@liw.fi>  Tue, 18 Feb 2025 13:47:08 +0200
+

radicle-native-ci (0.7.0) unstable; urgency=medium

  * New release.
deleted src/bin/rad-ci.rs
@@ -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,
-
}