mirror of
https://github.com/kjuulh/dagger-rs.git
synced 2024-11-25 16:32:42 +01:00
fix: with test changes
This commit is contained in:
parent
a2036838de
commit
d72313051b
@ -8,14 +8,17 @@ fn main() -> eyre::Result<()> {
|
|||||||
let matches = clap::Command::new("ci")
|
let matches = clap::Command::new("ci")
|
||||||
.subcommand_required(true)
|
.subcommand_required(true)
|
||||||
.subcommand(clap::Command::new("pr"))
|
.subcommand(clap::Command::new("pr"))
|
||||||
|
.subcommand(clap::Command::new("release"))
|
||||||
.get_matches();
|
.get_matches();
|
||||||
|
|
||||||
let client = dagger_sdk::client::connect()?;
|
let client = dagger_sdk::client::connect()?;
|
||||||
|
|
||||||
let base = select_base_image(client.clone());
|
|
||||||
|
|
||||||
match matches.subcommand() {
|
match matches.subcommand() {
|
||||||
Some(("pr", _)) => return validate_pr(client, base),
|
Some(("pr", _)) => {
|
||||||
|
let base = select_base_image(client.clone());
|
||||||
|
return validate_pr(client, base);
|
||||||
|
}
|
||||||
|
Some(("release", subm)) => return release(client, subm),
|
||||||
Some(_) => {
|
Some(_) => {
|
||||||
panic!("invalid subcommand selected!")
|
panic!("invalid subcommand selected!")
|
||||||
}
|
}
|
||||||
@ -25,6 +28,51 @@ fn main() -> eyre::Result<()> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn release(client: Arc<Query>, subm: &clap::ArgMatches) -> Result<(), color_eyre::Report> {
|
||||||
|
let src_dir = client.host().directory(
|
||||||
|
".".into(),
|
||||||
|
Some(HostDirectoryOpts {
|
||||||
|
exclude: Some(vec!["target/".into()]),
|
||||||
|
include: None,
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
let base_image = client
|
||||||
|
.container(None)
|
||||||
|
.from("rust:latest".into())
|
||||||
|
.with_workdir("app".into())
|
||||||
|
.with_mounted_directory("/app/".into(), src_dir.id());
|
||||||
|
|
||||||
|
let container = base_image
|
||||||
|
.with_exec(
|
||||||
|
vec![
|
||||||
|
"cargo".into(),
|
||||||
|
"install".into(),
|
||||||
|
"cargo-smart-release".into(),
|
||||||
|
],
|
||||||
|
None,
|
||||||
|
)
|
||||||
|
.with_exec(
|
||||||
|
vec![
|
||||||
|
"cargo".into(),
|
||||||
|
"smart-release".into(),
|
||||||
|
"--execute".into(),
|
||||||
|
"--allow-fully-generated-changelogs".into(),
|
||||||
|
"--no-changelog-preview".into(),
|
||||||
|
"dagger-rs".into(),
|
||||||
|
"dagger-sdk".into(),
|
||||||
|
],
|
||||||
|
None,
|
||||||
|
);
|
||||||
|
let exit = container.exit_code();
|
||||||
|
if exit != 0 {
|
||||||
|
eyre::bail!("container failed with non-zero exit code");
|
||||||
|
}
|
||||||
|
|
||||||
|
println!("released pr succeeded!");
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
fn get_dependencies(client: Arc<Query>) -> Container {
|
fn get_dependencies(client: Arc<Query>) -> Container {
|
||||||
let cargo_dir = client.host().directory(
|
let cargo_dir = client.host().directory(
|
||||||
".".into(),
|
".".into(),
|
||||||
|
@ -4,6 +4,7 @@ pub mod cli;
|
|||||||
mod cli_generate;
|
mod cli_generate;
|
||||||
|
|
||||||
fn main() -> eyre::Result<()> {
|
fn main() -> eyre::Result<()> {
|
||||||
|
// test change
|
||||||
color_eyre::install().unwrap();
|
color_eyre::install().unwrap();
|
||||||
|
|
||||||
let args = std::env::args();
|
let args = std::env::args();
|
||||||
|
Loading…
Reference in New Issue
Block a user