diff --git a/.cargo-husky/hooks/pre-commit b/.cargo-husky/hooks/pre-commit new file mode 100755 index 0000000..72835c9 --- /dev/null +++ b/.cargo-husky/hooks/pre-commit @@ -0,0 +1,14 @@ +#!/bin/sh + +set -e + +echo "Running cargo fmt..." +cargo fmt --all -- --check + +echo "Running cargo clippy..." +cargo clippy --all-targets --all-features -- -D warnings + +echo "Checking docs..." +RUSTDOCFLAGS="-D warnings" cargo doc --no-deps --all-features + +echo "Pre-commit checks passed!" diff --git a/.cargo-husky/hooks/pre-push b/.cargo-husky/hooks/pre-push new file mode 100755 index 0000000..7401f85 --- /dev/null +++ b/.cargo-husky/hooks/pre-push @@ -0,0 +1,8 @@ +#!/bin/sh + +set -e + +echo "Running cargo nextest..." +cargo nextest run --all-features + +echo "Pre-push checks passed!" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 127228e..03e1b40 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,7 +12,7 @@ jobs: name: Format runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - uses: dtolnay/rust-toolchain@nightly with: components: rustfmt @@ -21,7 +21,7 @@ jobs: name: Clippy runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - uses: dtolnay/rust-toolchain@stable with: components: clippy @@ -31,9 +31,19 @@ jobs: name: Test runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - uses: dtolnay/rust-toolchain@stable - uses: Swatinem/rust-cache@v2 - uses: taiki-e/install-action@nextest - run: cargo nextest run --all-features - run: cargo test --doc + docs: + name: Docs + runs-on: ubuntu-latest + env: + RUSTDOCFLAGS: -Dwarnings + steps: + - uses: actions/checkout@v5 + - uses: dtolnay/rust-toolchain@stable + - uses: Swatinem/rust-cache@v2 + - run: cargo doc --no-deps --all-features diff --git a/Cargo.lock b/Cargo.lock index f390fb7..cb98a53 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -176,6 +176,12 @@ version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b35204fbdc0b3f4446b89fc1ac2cf84a8a68971995d0bf2e925ec7cd960f9cb3" +[[package]] +name = "cargo-husky" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b02b629252fe8ef6460461409564e2c21d0c8e77e0944f3d189ff06c4e932ad" + [[package]] name = "cc" version = "1.2.54" @@ -253,6 +259,7 @@ checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" name = "common" version = "0.1.0" dependencies = [ + "cargo-husky", "rcgen", "serde", "serde_json", diff --git a/Cargo.toml b/Cargo.toml index 6b345b6..1f4500a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,19 +10,28 @@ license = "MIT OR Apache-2.0" [workspace.dependencies] aws-lc-rs = "1" -common = { path = "common" } +cargo-husky = { version = "1", default-features = false, features = [ + "user-hooks", +] } claims = "0.8" clap = { version = "4.5", features = ["derive"] } +common = { path = "common" } miette = { version = "7", features = ["fancy"] } rcgen = "0.14" rstest = "0.26" -rustls = { version = "0.23", default-features = false, features = ["std", "tls12", "aws_lc_rs"] } +rustls = { version = "0.23", default-features = false, features = [ + "std", + "tls12", + "aws_lc_rs", +] } serde = { version = "1", features = ["derive"] } serde_json = "1" strum = { version = "0.27", features = ["derive"] } thiserror = "2" tokio = { version = "1", features = ["full"] } -tokio-rustls = { version = "0.26", default-features = false, features = ["tls12"] } +tokio-rustls = { version = "0.26", default-features = false, features = [ + "tls12", +] } [workspace.lints.clippy] nursery = "warn" diff --git a/README.md b/README.md index 1ab4116..e172ffc 100644 --- a/README.md +++ b/README.md @@ -46,5 +46,4 @@ All experiments should record: ## License -Licensed under either of [Apache License, Version 2.0](LICENSE-APACHE) or -[MIT license](LICENSE-MIT) at your option. +Licensed under either of [Apache License, Version 2.0](LICENSE-APACHE) or [MIT license](LICENSE-MIT) at your option. diff --git a/common/Cargo.toml b/common/Cargo.toml index daf7eb1..87af3e5 100644 --- a/common/Cargo.toml +++ b/common/Cargo.toml @@ -11,5 +11,8 @@ serde_json.workspace = true strum.workspace = true tokio.workspace = true +[dev-dependencies] +cargo-husky.workspace = true + [lints] workspace = true