chore: fmt

Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
Kasper Juul Hermansen 2023-11-25 23:16:21 +01:00
parent 3939940c01
commit 80782e70f9
Signed by: kjuulh
GPG Key ID: 57B6E1465221F912
2 changed files with 77 additions and 87 deletions

View File

@ -1,14 +1,13 @@
use async_trait::async_trait; use async_trait::async_trait;
use dagger_sdk::Container; use dagger_sdk::Container;
use crate::{dagger_middleware::DaggerMiddleware, MainAction, PullRequestAction}; use crate::{dagger_middleware::DaggerMiddleware, MainAction, PullRequestAction};
pub type DynMiddleware = Box<dyn DaggerMiddleware + Send + Sync>; pub type DynMiddleware = Box<dyn DaggerMiddleware + Send + Sync>;
pub enum RustServiceStage { pub enum RustServiceStage {
BeforeDeps(DynMiddleware),
AfterDeps(DynMiddleware),
BeforeBase(DynMiddleware), BeforeBase(DynMiddleware),
AfterBase(DynMiddleware), AfterBase(DynMiddleware),
BeforeRelease(DynMiddleware), BeforeRelease(DynMiddleware),
@ -86,8 +85,6 @@ mod test {
rust_service::{RustService, RustServiceStage}, rust_service::{RustService, RustServiceStage},
}; };
#[tokio::test] #[tokio::test]
async fn can_build_rust() -> eyre::Result<()> { async fn can_build_rust() -> eyre::Result<()> {
let client = dagger_sdk::connect().await?; let client = dagger_sdk::connect().await?;
@ -95,7 +92,7 @@ mod test {
RustService::from(client.clone()) RustService::from(client.clone())
.with_base_image(client.container().from("rustlang/rust:nightly")) .with_base_image(client.container().from("rustlang/rust:nightly"))
.with_sqlx() .with_sqlx()
.with_stage(RustServiceStage::BeforeBase(middleware(|c| async move { Ok(c) }.boxed()))) .with_stage(RustServiceStage::BeforeDeps(middleware(|c| async move { Ok(c) }.boxed())))
.build_release() .build_release()
.await?; .await?;

View File

@ -97,7 +97,8 @@ impl RustBuild {
let mut containers = Vec::new(); let mut containers = Vec::new();
for container_image in images { for container_image in images {
let container = match &container_image { let container =
match &container_image {
SlimImage::Debian { image, deps, .. } => { SlimImage::Debian { image, deps, .. } => {
let target = BuildTarget::from_target(&container_image); let target = BuildTarget::from_target(&container_image);
@ -124,11 +125,7 @@ impl RustBuild {
"-p", "-p",
bin_name, bin_name,
]) ])
.file(format!( .file(format!("target/{}/release/{}", target.to_string(), bin_name));
"target/{}/release/{}",
target.to_string(),
bin_name
));
self.build_debian_image( self.build_debian_image(
bin, bin,
@ -166,11 +163,7 @@ impl RustBuild {
"-p", "-p",
bin_name, bin_name,
]) ])
.file(format!( .file(format!("target/{}/release/{}", target.to_string(), bin_name));
"target/{}/release/{}",
target.to_string(),
bin_name
));
self.build_alpine_image( self.build_alpine_image(
bin, bin,