diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml deleted file mode 100644 index 079abce..0000000 --- a/.github/workflows/publish.yaml +++ /dev/null @@ -1,26 +0,0 @@ -name: Publish to Cargo - -on: - push: - branches: [main] - -jobs: - publish: - runs-on: ubuntu-latest - environment: cargo - - env: - CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} - - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 2 - - - name: Cache build - uses: Swatinem/rust-cache@v2 - with: - key: cache - - - name: Publish Crate - uses: seunlanlege/cargo-auto-publish@2 diff --git a/Cargo.lock b/Cargo.lock index df5e935..a8a40d7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1228,7 +1228,7 @@ dependencies = [ "clap", "futures-util", "orbit-client", - "orbit-core", + "orbit-types", "tokio", "url", ] @@ -1239,7 +1239,7 @@ version = "0.1.0" dependencies = [ "async-fn-stream", "futures", - "orbit-core", + "orbit-types", "reqwest", "reqwest-eventsource", "serde_json", @@ -1247,14 +1247,6 @@ dependencies = [ "url", ] -[[package]] -name = "orbit-core" -version = "0.1.0" -dependencies = [ - "serde", - "thiserror", -] - [[package]] name = "orbit-server" version = "0.1.0" @@ -1270,7 +1262,7 @@ dependencies = [ "futures-util", "http", "indexmap", - "orbit-core", + "orbit-types", "reqwest", "schemars", "serde", @@ -1285,6 +1277,14 @@ dependencies = [ "uuid", ] +[[package]] +name = "orbit-types" +version = "0.1.0" +dependencies = [ + "serde", + "thiserror", +] + [[package]] name = "overload" version = "0.1.1" diff --git a/Cargo.toml b/Cargo.toml index e912adb..5297982 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [workspace] resolver = "2" -members = ["orbit-cli", "orbit-client", "orbit-core", "orbit-server"] +members = ["crates/*"] [workspace.package] license = "MIT" diff --git a/orbit-cli/Cargo.toml b/crates/cli/Cargo.toml similarity index 70% rename from orbit-cli/Cargo.toml rename to crates/cli/Cargo.toml index 9c4df4e..4493306 100644 --- a/orbit-cli/Cargo.toml +++ b/crates/cli/Cargo.toml @@ -9,6 +9,6 @@ authors.workspace = true url = "2.5.2" futures-util = "0.3.30" tokio = { version = "1.38.1", features = ["full"] } +orbit-types = { version = "0.1.0", path = "../types" } +orbit-client = { version = "0.1.0", path = "../client" } clap = { version = "4.5.9", features = ["derive", "env"] } -orbit-core = { version = "0.1.0", path = "../orbit-core" } -orbit-client = { version = "0.1.0", path = "../orbit-client" } diff --git a/orbit-cli/src/main.rs b/crates/cli/src/main.rs similarity index 90% rename from orbit-cli/src/main.rs rename to crates/cli/src/main.rs index dbe21b8..03aea1e 100644 --- a/orbit-cli/src/main.rs +++ b/crates/cli/src/main.rs @@ -1,7 +1,9 @@ +#![warn(clippy::all, clippy::pedantic, clippy::nursery)] + use clap::{Parser, Subcommand}; use futures_util::StreamExt; use orbit_client::Client; -use orbit_core::{Log, Progress, Stage}; +use orbit_types::{Log, Progress, Stage}; use url::Url; #[derive(Debug, Parser)] @@ -38,7 +40,7 @@ async fn main() { } async fn run_deploy(slug: String, r#ref: Option, client: &Client) { - let stream = client.deploy(&slug, r#ref.as_deref()).await; + let stream = client.deploy(&slug, r#ref.as_deref()); stream .map(|result| result.unwrap()) diff --git a/orbit-client/Cargo.toml b/crates/client/Cargo.toml similarity index 81% rename from orbit-client/Cargo.toml rename to crates/client/Cargo.toml index 48f466f..1b8d8c3 100644 --- a/orbit-client/Cargo.toml +++ b/crates/client/Cargo.toml @@ -12,4 +12,4 @@ thiserror = "1.0.63" serde_json = "1.0.120" async-fn-stream = "0.2.2" reqwest-eventsource = "0.6.0" -orbit-core = { version = "0.1.0", path = "../orbit-core" } +orbit-types = { version = "0.1.0", path = "../types" } diff --git a/orbit-client/src/lib.rs b/crates/client/src/lib.rs similarity index 87% rename from orbit-client/src/lib.rs rename to crates/client/src/lib.rs index 57f6fb1..fbf584a 100644 --- a/orbit-client/src/lib.rs +++ b/crates/client/src/lib.rs @@ -1,6 +1,8 @@ +#![warn(clippy::all, clippy::pedantic, clippy::nursery)] + use async_fn_stream::try_fn_stream; use futures::{stream::StreamExt, Stream}; -use orbit_core::{ErrorResponse, Progress}; +use orbit_types::{ErrorResponse, Progress}; use reqwest::{Response, StatusCode}; use reqwest_eventsource::{Event, RequestBuilderExt}; use url::Url; @@ -29,6 +31,8 @@ pub enum Error { } impl Client { + /// Create a new client. + #[must_use] pub fn new(base_url: Url) -> Self { Self { url: base_url, @@ -36,11 +40,13 @@ impl Client { } } - pub async fn deploy( + /// Deploy a site. + #[allow(clippy::missing_panics_doc)] + pub fn deploy( &self, name: &str, r#ref: Option<&str>, - ) -> impl Stream, Error>> { + ) -> impl Stream, Error>> { let mut stream = self .client .post(self.url.join(&format!("/sites/{name}/deploy")).unwrap()) diff --git a/orbit-server/Cargo.toml b/crates/server/Cargo.toml similarity index 93% rename from orbit-server/Cargo.toml rename to crates/server/Cargo.toml index c3b8867..1fd9b19 100644 --- a/orbit-server/Cargo.toml +++ b/crates/server/Cargo.toml @@ -25,10 +25,10 @@ futures-util = "0.3.30" async-fn-stream = "0.2.2" uuid = { version = "1.10.0", features = ["v7"] } tokio = { version = "1.29.1", features = ["full"] } +orbit-types = { version = "0.1.0", path = "../types" } aide = { version = "0.13.4", features = ["axum", "scalar"] } axum-jsonschema = { version = "0.8.0", features = ["aide"] } tracing-subscriber = { version = "0.3.17", features = ["env-filter"] } -orbit-core = { version = "0.1.0", path = "../orbit-core" } [build-dependencies] chrono = "0.4.26" diff --git a/orbit-server/build.rs b/crates/server/build.rs similarity index 100% rename from orbit-server/build.rs rename to crates/server/build.rs diff --git a/orbit-server/orbit.example.toml b/crates/server/orbit.example.toml similarity index 100% rename from orbit-server/orbit.example.toml rename to crates/server/orbit.example.toml diff --git a/orbit-server/src/config.rs b/crates/server/src/config.rs similarity index 100% rename from orbit-server/src/config.rs rename to crates/server/src/config.rs diff --git a/orbit-server/src/deploy.rs b/crates/server/src/deploy.rs similarity index 96% rename from orbit-server/src/deploy.rs rename to crates/server/src/deploy.rs index 764ce91..e4731b4 100644 --- a/orbit-server/src/deploy.rs +++ b/crates/server/src/deploy.rs @@ -2,7 +2,7 @@ use async_fn_stream::try_fn_stream; use flate2::read::GzDecoder; use futures_util::{Stream, TryStreamExt}; use http::header; -use orbit_core::{Log, Progress, Stage}; +use orbit_types::{Log, Progress, Stage}; use std::{env, fs, path::PathBuf}; use tokio::process::Command; use uuid::Uuid; @@ -27,7 +27,7 @@ pub enum Error { Publish(std::io::Error), } -impl From for orbit_core::Error { +impl From for orbit_types::Error { fn from(value: Error) -> Self { match value { Error::Cleanup(_) => Self::Cleanup, @@ -39,9 +39,9 @@ impl From for orbit_core::Error { } } -impl From for orbit_core::ErrorResponse { +impl From for orbit_types::ErrorResponse { fn from(value: Error) -> Self { - Self::from(orbit_core::Error::from(value)) + Self::from(orbit_types::Error::from(value)) } } diff --git a/orbit-server/src/main.rs b/crates/server/src/main.rs similarity index 100% rename from orbit-server/src/main.rs rename to crates/server/src/main.rs diff --git a/orbit-server/src/misc.rs b/crates/server/src/misc.rs similarity index 99% rename from orbit-server/src/misc.rs rename to crates/server/src/misc.rs index ce20d56..c907a88 100644 --- a/orbit-server/src/misc.rs +++ b/crates/server/src/misc.rs @@ -9,7 +9,7 @@ use axum::response::{ }; use futures_util::Stream; use indexmap::IndexMap; -use orbit_core::Log; +use orbit_types::Log; use schemars::JsonSchema; use std::{io, process::Stdio}; use tokio::{ diff --git a/orbit-server/src/routes/docs.rs b/crates/server/src/routes/docs.rs similarity index 100% rename from orbit-server/src/routes/docs.rs rename to crates/server/src/routes/docs.rs diff --git a/orbit-server/src/routes/mod.rs b/crates/server/src/routes/mod.rs similarity index 100% rename from orbit-server/src/routes/mod.rs rename to crates/server/src/routes/mod.rs diff --git a/orbit-server/src/routes/sites.rs b/crates/server/src/routes/sites.rs similarity index 96% rename from orbit-server/src/routes/sites.rs rename to crates/server/src/routes/sites.rs index 4b06a19..a53f7cf 100644 --- a/orbit-server/src/routes/sites.rs +++ b/crates/server/src/routes/sites.rs @@ -8,7 +8,7 @@ use axum::{ Extension, }; use futures_util::{stream::Stream, StreamExt}; -use orbit_core::{ErrorResponse, Progress}; +use orbit_types::{ErrorResponse, Progress}; use schemars::JsonSchema; use serde::Deserialize; diff --git a/orbit-server/src/routes/system.rs b/crates/server/src/routes/system.rs similarity index 100% rename from orbit-server/src/routes/system.rs rename to crates/server/src/routes/system.rs diff --git a/orbit-server/src/server.rs b/crates/server/src/server.rs similarity index 100% rename from orbit-server/src/server.rs rename to crates/server/src/server.rs diff --git a/orbit-core/Cargo.toml b/crates/types/Cargo.toml similarity index 90% rename from orbit-core/Cargo.toml rename to crates/types/Cargo.toml index ba5f047..9a16d88 100644 --- a/orbit-core/Cargo.toml +++ b/crates/types/Cargo.toml @@ -1,6 +1,6 @@ [package] version = "0.1.0" -name = "orbit-core" +name = "orbit-types" license.workspace = true edition.workspace = true authors.workspace = true diff --git a/orbit-core/src/lib.rs b/crates/types/src/lib.rs similarity index 96% rename from orbit-core/src/lib.rs rename to crates/types/src/lib.rs index e0db619..be6e2de 100644 --- a/orbit-core/src/lib.rs +++ b/crates/types/src/lib.rs @@ -1,3 +1,5 @@ +#![warn(clippy::all, clippy::pedantic, clippy::nursery)] + use serde::{Deserialize, Serialize}; /// A progress update for a deployment.