From 0eb59cb396548744d1473f72646c2942210ad8d7 Mon Sep 17 00:00:00 2001 From: kjuulh Date: Sat, 30 Mar 2024 23:51:33 +0100 Subject: [PATCH] feat: without extra stuff Signed-off-by: kjuulh --- Cargo.lock | 61 +++++++++++++++++++++++-- ci/src/main.rs | 23 ++++------ crates/cuddle-rust-cli-plan/src/main.rs | 16 ++----- 3 files changed, 71 insertions(+), 29 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index aeb1771..9e62a42 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -307,7 +307,7 @@ dependencies = [ [[package]] name = "cuddle-ci" version = "0.2.0" -source = "git+https://git.front.kjuulh.io/kjuulh/dagger-components?branch=main#0539e375b1cd8523804a5240e0250d9856585d93" +source = "git+https://git.front.kjuulh.io/kjuulh/dagger-components?branch=main#99bc420f71d3721e9ba4bd79a06ac91617739970" dependencies = [ "async-trait", "chrono", @@ -321,6 +321,7 @@ dependencies = [ "serde_json", "serde_yaml", "tokio", + "toml", "tracing", ] @@ -340,12 +341,12 @@ dependencies = [ [[package]] name = "dagger-components" version = "0.1.0" -source = "git+https://git.front.kjuulh.io/kjuulh/dagger-components?branch=main#0539e375b1cd8523804a5240e0250d9856585d93" +source = "git+https://git.front.kjuulh.io/kjuulh/dagger-components?branch=main#99bc420f71d3721e9ba4bd79a06ac91617739970" [[package]] name = "dagger-cuddle-please" version = "0.2.0" -source = "git+https://git.front.kjuulh.io/kjuulh/dagger-components?branch=main#0539e375b1cd8523804a5240e0250d9856585d93" +source = "git+https://git.front.kjuulh.io/kjuulh/dagger-components?branch=main#99bc420f71d3721e9ba4bd79a06ac91617739970" dependencies = [ "async-trait", "dagger-sdk", @@ -355,7 +356,7 @@ dependencies = [ [[package]] name = "dagger-rust" version = "0.2.0" -source = "git+https://git.front.kjuulh.io/kjuulh/dagger-components?branch=main#0539e375b1cd8523804a5240e0250d9856585d93" +source = "git+https://git.front.kjuulh.io/kjuulh/dagger-components?branch=main#99bc420f71d3721e9ba4bd79a06ac91617739970" dependencies = [ "async-trait", "dagger-sdk", @@ -1334,6 +1335,15 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_spanned" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb3622f419d1296904700073ea6cc23ad690adbd66f13ea683df73298736f0c1" +dependencies = [ + "serde", +] + [[package]] name = "serde_urlencoded" version = "0.7.1" @@ -1602,6 +1612,40 @@ dependencies = [ "tracing", ] +[[package]] +name = "toml" +version = "0.8.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9dd1545e8208b4a5af1aa9bbd0b4cf7e9ea08fabc5d0a5c67fcaafa17433aa3" +dependencies = [ + "serde", + "serde_spanned", + "toml_datetime", + "toml_edit", +] + +[[package]] +name = "toml_datetime" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1" +dependencies = [ + "serde", +] + +[[package]] +name = "toml_edit" +version = "0.22.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e40bb779c5187258fd7aad0eb68cb8706a0a81fa712fbea808ab43c4b8374c4" +dependencies = [ + "indexmap", + "serde", + "serde_spanned", + "toml_datetime", + "winnow", +] + [[package]] name = "tower-service" version = "0.3.2" @@ -2029,6 +2073,15 @@ version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32b752e52a2da0ddfbdbcc6fceadfeede4c939ed16d13e648833a61dfb611ed8" +[[package]] +name = "winnow" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dffa400e67ed5a4dd237983829e66475f0a4a26938c4b04c21baede6262215b8" +dependencies = [ + "memchr", +] + [[package]] name = "winreg" version = "0.50.0" diff --git a/ci/src/main.rs b/ci/src/main.rs index 49b8608..db48611 100644 --- a/ci/src/main.rs +++ b/ci/src/main.rs @@ -1,10 +1,8 @@ -use std::sync::Arc; use cuddle_ci::drone_templater::DroneTemplater; use cuddle_ci::rust_service::architecture::{Architecture, Os}; use cuddle_ci::rust_service::{extensions::*, RustService}; -use cuddle_ci::{drone_templater, CuddleCI}; -use tokio::sync::Mutex; +use cuddle_ci::{CuddleCI}; const BIN_NAME: &str = "cuddle-rust-cli-plan"; @@ -12,7 +10,7 @@ const BIN_NAME: &str = "cuddle-rust-cli-plan"; async fn main() -> eyre::Result<()> { let client = dagger_sdk::connect().await?; - let service = RustService::from(client.clone()) + let service = &RustService::from(client.clone()) .with_arch(Architecture::Amd64) .with_os(Os::Linux) .with_apt(&[ @@ -28,23 +26,20 @@ async fn main() -> eyre::Result<()> { .with_cuddle_cli() .with_kubectl() .with_apt_ca_certificates() - .with_crates(["ci", "crates/*"]) + .with_workspace_crates() + .await .with_mold("2.3.3") .with_bin_name(BIN_NAME) .with_deployment(false) .to_owned(); - let service = Arc::new(Mutex::new(service)); - - let drone_templater = Arc::new(Mutex::new( - DroneTemplater::new(client, "templates/cuddle-rust-cli-plan.yaml") - .with_variable("bin_name", BIN_NAME) - .to_owned(), - )); + let drone_templater = &DroneTemplater::new(client, "templates/cuddle-rust-cli-plan.yaml") + .with_variable("bin_name", BIN_NAME) + .to_owned(); CuddleCI::default() - .with_pull_request(service.clone()) - .with_main(service.clone()) + .with_pull_request(service) + .with_main(service) .with_main(drone_templater) .execute(std::env::args()) .await?; diff --git a/crates/cuddle-rust-cli-plan/src/main.rs b/crates/cuddle-rust-cli-plan/src/main.rs index aa2221f..baab050 100644 --- a/crates/cuddle-rust-cli-plan/src/main.rs +++ b/crates/cuddle-rust-cli-plan/src/main.rs @@ -1,20 +1,16 @@ -use std::sync::Arc; -use async_trait::async_trait; use cuddle_ci::cuddle_file::CuddleFile; -use cuddle_ci::cuddle_releaser::CuddleReleaser; use cuddle_ci::rust_service::architecture::{Architecture, Os}; use cuddle_ci::rust_service::RustService; -use cuddle_ci::rust_service::{extensions::*, RustServiceContext}; -use cuddle_ci::{Context, CuddleCI, MainAction, PullRequestAction}; -use tokio::sync::Mutex; +use cuddle_ci::rust_service::{extensions::*}; +use cuddle_ci::{CuddleCI}; #[tokio::main] async fn main() -> eyre::Result<()> { let client = dagger_sdk::connect().await?; let cuddle_file = CuddleFile::from_cuddle_file().await?; - let service = RustService::from(client.clone()) + let service = &RustService::from(client.clone()) .with_arch(Architecture::Amd64) .with_os(Os::Linux) .with_apt(&["libssl-dev", "libz-dev", "libpq-dev", "protobuf-compiler"]) @@ -26,11 +22,9 @@ async fn main() -> eyre::Result<()> { .with_deployment(false) .to_owned(); - let service = Arc::new(Mutex::new(service)); - CuddleCI::default() - .with_pull_request(service.clone()) - .with_main(service.clone()) + .with_pull_request(service) + .with_main(service) .execute(std::env::args()) .await?;