feat(ci): with pr
All checks were successful
continuous-integration/drone/push Build is passing

Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
Kasper Juul Hermansen 2023-08-04 01:10:10 +02:00
parent 2d255c21e6
commit f94677d78f
Signed by: kjuulh
GPG Key ID: 9AA7BC13CE474394
2 changed files with 88 additions and 3 deletions

View File

@ -35,7 +35,14 @@ pub enum Commands {
#[command(subcommand)]
command: LocalCommands,
},
PullRequest,
PullRequest {
#[arg(long)]
image: String,
#[arg(long)]
tag: String,
#[arg(long)]
bin_name: String,
},
Main {
#[arg(long)]
image: String,
@ -163,7 +170,48 @@ async fn main() -> eyre::Result<()> {
.await?;
}
},
Commands::PullRequest => todo!(),
Commands::PullRequest {
image,
tag,
bin_name,
} => {
async fn test(client: Arc<dagger_sdk::Query>, cli: &Command, bin_name: &String) {
let args = &cli.global;
let base_image =
base_rust_image(client.clone(), &args, &None, bin_name, &"debug".into())
.await
.unwrap();
test::execute(client.clone(), &args, base_image)
.await
.unwrap();
}
async fn build(
client: Arc<dagger_sdk::Query>,
cli: &Command,
bin_name: &String,
image: &String,
tag: &String,
) {
let args = &cli.global;
build::build(client.clone(), &args, bin_name, image, tag)
.await
.unwrap();
}
async fn cuddle_please(client: Arc<dagger_sdk::Query>, cli: &Command) {
run_release_please(client.clone(), &cli.global)
.await
.unwrap();
}
tokio::join!(
test(client.clone(), &cli, &bin_name),
build(client.clone(), &cli, &bin_name, &image, &tag),
cuddle_please(client.clone(), &cli)
);
}
Commands::Main {
image,
tag,
@ -442,6 +490,44 @@ mod build {
.await?;
Ok(())
}
pub async fn build(
client: Arc<dagger_sdk::Query>,
args: &GlobalArgs,
bin_name: &String,
image: &String,
tag: &String,
) -> eyre::Result<()> {
// let containers = vec!["linux/amd64", "linux/arm64"];
let base_image = get_base_debian_image(
client.clone(),
&args.clone(),
Some("linux/amd64".to_string()),
)
.await?;
let container = base_rust_image(
client.clone(),
&args,
&Some("linux/amd64".to_string()),
&bin_name.clone(),
&"release".into(),
)
.await?;
let build_image = execute(
client.clone(),
&args,
&container,
&base_image,
&bin_name,
&Some("linux/amd64".to_string()),
)
.await?;
build_image.exit_code().await?;
Ok(())
}
pub async fn execute(
_client: Arc<dagger_sdk::Query>,
_args: &GlobalArgs,

View File

@ -1,4 +1,3 @@
#!/usr/bin/env bash
set -e