feat: with full support for rust services
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
41
crates/cuddle-ci/src/rust_service/clap_sanity_test.rs
Normal file
41
crates/cuddle-ci/src/rust_service/clap_sanity_test.rs
Normal file
@@ -0,0 +1,41 @@
|
||||
use async_trait::async_trait;
|
||||
use dagger_sdk::Container;
|
||||
|
||||
use crate::dagger_middleware::DaggerMiddleware;
|
||||
|
||||
use super::RustService;
|
||||
|
||||
pub struct ClapSanityTest {
|
||||
bin_name: String,
|
||||
}
|
||||
|
||||
impl ClapSanityTest {
|
||||
pub fn new(bin_name: impl Into<String>) -> Self {
|
||||
Self {
|
||||
bin_name: bin_name.into(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
impl DaggerMiddleware for ClapSanityTest {
|
||||
async fn handle(&self, container: Container) -> eyre::Result<Container> {
|
||||
Ok(container.with_exec(vec![&self.bin_name, "--help"]))
|
||||
}
|
||||
}
|
||||
|
||||
pub trait ClapSanityTestExt {
|
||||
fn with_clap_sanity_test(&mut self) -> &mut Self {
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
impl ClapSanityTestExt for RustService {
|
||||
fn with_clap_sanity_test(&mut self) -> &mut Self {
|
||||
self.with_stage(
|
||||
super::RustServiceStage::AfterPackage(Box::new(ClapSanityTest::new(&self.bin_name)))
|
||||
);
|
||||
|
||||
self
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user