diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..c092fc3 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,36 @@ +--- +name: ci + +on: + push: + workflow_dispatch: + +permissions: + contents: read + +jobs: + tests: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest] + env: + CARGO_TERM_COLOR: always + RUST_BACKTRACE: full + steps: + - uses: actions/checkout@v4 + - uses: jdx/rtx-action@v1 + - name: Cache cargo registry + uses: actions/cache@v3 + continue-on-error: false + with: + path: | + ~/.cargo/registry + ~/.cargo/git + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo- + - run: just check + - run: just lint + - run: just test diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..057168c --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,30 @@ +[workspace] +resolver = "2" +members = [ + "cdviz-svc", + # "examples/*", +] + +[workspace.package] +edition = "2021" +version = "0.1.0" +authors = ["David Bernard"] +license = "AGPL-3.0-or-later" +repository = "https://github.com/davidB/cdviz" +rust-version = "1.75" +publish = false + +[workspace.dependencies] +rstest = "0.18" + +[profile.dev.package.insta] +opt-level = 3 + +[profile.dev.package.similar] +opt-level = 3 + +[workspace.metadata.release] +pre-release-commit-message = "🚀 (cargo-release) version {{version}}" +tag-prefix = "" +tag-name = "{{prefix}}{{version}}" +tag-message = "🔖 {{version}}" diff --git a/cdviz-svc/Cargo.toml b/cdviz-svc/Cargo.toml new file mode 100644 index 0000000..0030739 --- /dev/null +++ b/cdviz-svc/Cargo.toml @@ -0,0 +1,19 @@ +[package] +name = "cvdiz-svc" +description = "The service to collect cdevents" +readme = "README.md" +keywords = ["cd"] +categories = [] +edition.workspace = true +version.workspace = true +authors.workspace = true +repository.workspace = true +license.workspace = true +publish.workspace = true + +[dependencies] +axum = "0.7" +tokio = { version = "1.0", features = ["full"] } + +[dev-dependencies] +rstest = { workspace = true } diff --git a/cdviz-svc/src/main.rs b/cdviz-svc/src/main.rs new file mode 100644 index 0000000..8be059f --- /dev/null +++ b/cdviz-svc/src/main.rs @@ -0,0 +1,24 @@ +//! Run with +//! +//! ```not_rust +//! cargo run +//! ``` + +use axum::{response::Html, routing::get, Router}; + +#[tokio::main] +async fn main() { + // build our application with a route + let app = Router::new().route("/", get(handler)); + + // run it + let listener = tokio::net::TcpListener::bind("127.0.0.1:3000") + .await + .unwrap(); + println!("listening on {}", listener.local_addr().unwrap()); + axum::serve(listener, app).await.unwrap(); +} + +async fn handler() -> Html<&'static str> { + Html("