diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index d30f5ecf..866f873a 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -195,3 +195,48 @@ jobs: - name: Check formatting run: cargo fmt -- --check + + udeps: + name: Unused dependency check + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Install Rust (nightly for cargo-udeps) + uses: dtolnay/rust-toolchain@stable + with: + toolchain: nightly + + - name: Setup Rust cache + uses: Swatinem/rust-cache@v2 + with: + shared-key: ${{ runner.os }} + + - name: Install cargo-udeps + uses: taiki-e/install-action@cargo-udeps + + - name: Check for unused dependencies + run: | + set -euo pipefail + # Run with nightly; capture output without failing the step + set +e + cargo +nightly udeps --all-targets --all-features 2>&1 | tee udeps_output.txt + STATUS=$? + set -e + cat udeps_output.txt + # If cargo-udeps failed due to nightly requirement or other errors, surface that + if [ $STATUS -ne 0 ]; then + echo "cargo-udeps exited with status $STATUS" + # If unused deps are present, cargo-udeps typically exits non-zero; still explicitly check text + if grep -qi "unused" udeps_output.txt; then + echo "Unused dependencies detected" + exit 1 + fi + exit $STATUS + fi + # Treat any mention of 'unused' as a failure signal + if grep -qi "unused" udeps_output.txt; then + echo "Unused dependencies detected" + exit 1 + fi \ No newline at end of file diff --git a/Cargo.toml b/Cargo.toml index 81bbdcec..ee76eede 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,11 +19,9 @@ tokio = { version = "1.35", features = ["full"] } hyper = { version = "1.7", features = ["full"] } hyper-util = { version = "0.1", features = ["full"] } http-body-util = "0.1" -tower = { version = "0.5", features = ["full"] } bytes = "1.5" tokio-rustls = "0.26" rustls = "0.23" -rustls-pemfile = "2.0" rcgen = "0.13" webpki-roots = "0.26" lru = "0.12" @@ -32,9 +30,6 @@ anyhow = "1.0" tracing = "0.1" tracing-subscriber = { version = "0.3", features = ["env-filter", "chrono"] } chrono = "0.4" -serde = { version = "1.0", features = ["derive"] } -serde_yaml = "0.9" -serde_json = "1.0" dirs = "6.0.0" hyper-rustls = "0.27.7" tls-parser = "0.12.2" @@ -53,4 +48,4 @@ libc = "0.2" tempfile = "3.8" assert_cmd = "2.0" predicates = "3.0" -serial_test = "3.0" +serial_test = "3.0" \ No newline at end of file