diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..2ee442f --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,52 @@ +name: CI + +on: + push: + branches: + - main + pull_request: + +permissions: + contents: read + +env: + CARGO_TERM_COLOR: always + RUSTFLAGS: -Dwarnings + +jobs: + formatting: + name: Formatting + runs-on: ubuntu-latest + steps: + - name: Check out repository + uses: actions/checkout@v4 + - name: Install Rust + uses: dtolnay/rust-toolchain@stable + with: + components: rustfmt + - name: Check formatting + run: cargo fmt --all -- --check + + clippy: + name: Clippy + runs-on: ubuntu-latest + steps: + - name: Check out repository + uses: actions/checkout@v4 + - name: Install Rust + uses: dtolnay/rust-toolchain@stable + with: + components: clippy + - name: Run Clippy + run: cargo clippy --workspace --all-targets --all-features --locked -- -D warnings + + tests: + name: Tests + runs-on: ubuntu-latest + steps: + - name: Check out repository + uses: actions/checkout@v4 + - name: Install Rust + uses: dtolnay/rust-toolchain@stable + - name: Run tests + run: cargo test --workspace --all-features --locked diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b83d222 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/target/ diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..0479319 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,159 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "once_cell" +version = "1.21.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" + +[[package]] +name = "pin-project-lite" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" + +[[package]] +name = "proc-macro2" +version = "1.0.107" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "roadrunner-cli" +version = "0.1.0" +dependencies = [ + "roadrunner-core", + "tracing", +] + +[[package]] +name = "roadrunner-core" +version = "0.1.0" +dependencies = [ + "serde", + "thiserror", + "tracing", +] + +[[package]] +name = "serde" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.4", +] + +[[package]] +name = "syn" +version = "2.0.119" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "3.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6275cddf4610d1775e6d1fe9469b2e77d0f39fd98fb7450901b821e0c53649f" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "thiserror" +version = "2.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec86235f5fcc2a73650310756d2ac5b138a5780bbbdfae3eeccec992c435ba4f" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc04cd3e1236dd4a98afca4569f2deb3f120e5422a4023be2cb683f8486292af" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.4", +] + +[[package]] +name = "tracing" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" +dependencies = [ + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "tracing-core" +version = "0.1.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" +dependencies = [ + "once_cell", +] + +[[package]] +name = "unicode-ident" +version = "1.0.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75" diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..9f95fff --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,36 @@ +[workspace] +members = [ + "crates/roadrunner-cli", + "crates/roadrunner-core", +] +resolver = "3" + +[workspace.package] +version = "0.1.0" +edition = "2024" +rust-version = "1.85" +publish = false + +[workspace.dependencies] +serde = { version = "1", features = ["derive"] } +thiserror = "2" +tracing = "0.1" + +[workspace.lints.rust] +missing_docs = "deny" +unsafe_code = "forbid" +unused_lifetimes = "deny" +unused_qualifications = "deny" + +[workspace.lints.rustdoc] +broken_intra_doc_links = "deny" +private_intra_doc_links = "deny" + +[workspace.lints.clippy] +all = { level = "deny", priority = -1 } +pedantic = { level = "deny", priority = -1 } +dbg_macro = "deny" +expect_used = "deny" +todo = "deny" +unimplemented = "deny" +unwrap_used = "deny" diff --git a/crates/roadrunner-cli/Cargo.toml b/crates/roadrunner-cli/Cargo.toml new file mode 100644 index 0000000..a08c426 --- /dev/null +++ b/crates/roadrunner-cli/Cargo.toml @@ -0,0 +1,18 @@ +[package] +name = "roadrunner-cli" +description = "Command-line interface for Roadrunner" +version.workspace = true +edition.workspace = true +rust-version.workspace = true +publish.workspace = true + +[[bin]] +name = "roadrunner" +path = "src/main.rs" + +[lints] +workspace = true + +[dependencies] +roadrunner-core = { path = "../roadrunner-core" } +tracing.workspace = true diff --git a/crates/roadrunner-cli/src/main.rs b/crates/roadrunner-cli/src/main.rs new file mode 100644 index 0000000..f9cc254 --- /dev/null +++ b/crates/roadrunner-cli/src/main.rs @@ -0,0 +1,8 @@ +//! Command-line entry point for Roadrunner. + +fn main() { + tracing::info!( + core_version = roadrunner_core::version(), + "Roadrunner CLI initialized" + ); +} diff --git a/crates/roadrunner-core/Cargo.toml b/crates/roadrunner-core/Cargo.toml new file mode 100644 index 0000000..8c93a73 --- /dev/null +++ b/crates/roadrunner-core/Cargo.toml @@ -0,0 +1,15 @@ +[package] +name = "roadrunner-core" +description = "Core domain and routing foundations for Roadrunner" +version.workspace = true +edition.workspace = true +rust-version.workspace = true +publish.workspace = true + +[lints] +workspace = true + +[dependencies] +serde.workspace = true +thiserror.workspace = true +tracing.workspace = true diff --git a/crates/roadrunner-core/src/lib.rs b/crates/roadrunner-core/src/lib.rs new file mode 100644 index 0000000..c5034e1 --- /dev/null +++ b/crates/roadrunner-core/src/lib.rs @@ -0,0 +1,21 @@ +//! Core domain and routing foundations for Roadrunner. +//! +//! Graph types and routing algorithms are intentionally introduced in their +//! dedicated implementation phases. This crate currently establishes the stable +//! library boundary shared by Roadrunner's adapters. + +/// Returns the version of the Roadrunner core crate. +#[must_use] +pub const fn version() -> &'static str { + env!("CARGO_PKG_VERSION") +} + +#[cfg(test)] +mod tests { + use super::version; + + #[test] + fn reports_the_package_version() { + assert_eq!(version(), env!("CARGO_PKG_VERSION")); + } +} diff --git a/rust-toolchain.toml b/rust-toolchain.toml new file mode 100644 index 0000000..92a57c5 --- /dev/null +++ b/rust-toolchain.toml @@ -0,0 +1,4 @@ +[toolchain] +channel = "stable" +components = ["clippy", "rustfmt"] +profile = "minimal" diff --git a/rustfmt.toml b/rustfmt.toml new file mode 100644 index 0000000..d6155da --- /dev/null +++ b/rustfmt.toml @@ -0,0 +1,3 @@ +edition = "2024" +max_width = 100 +newline_style = "Unix"