From e121956acbe2973105b0fe8f7b9d7997339c5abe Mon Sep 17 00:00:00 2001 From: "blink-so[bot]" <211532188+blink-so[bot]@users.noreply.github.com> Date: Thu, 11 Sep 2025 01:56:42 +0000 Subject: [PATCH 1/3] ci: check for unused dependencies with cargo-udeps\n\nFail CI when unused dependencies are detected.\n\nCo-authored-by: ammario <7416144+ammario@users.noreply.github.com> --- .github/workflows/tests.yml | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index d30f5ecf..126b1aa1 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -195,3 +195,38 @@ 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 + uses: dtolnay/rust-toolchain@stable + with: + toolchain: stable + + - 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 + OUTPUT=$(cargo udeps --all-targets --all-features 2>&1 || true) + echo \"$OUTPUT\" + if echo \"$OUTPUT\" | grep -qi \"no crates were unused\"; then + exit 0 + elif echo \"$OUTPUT\" | grep -qiE \"unused (crates|dependencies)\"; then + echo \"Unused dependencies detected\" + exit 1 + else + echo \"cargo-udeps completed without explicit confirmation; treating as success\" + exit 0 + fi \ No newline at end of file From 139a9efa298ec458f97c73e25a5eab893b75ada1 Mon Sep 17 00:00:00 2001 From: "blink-so[bot]" <211532188+blink-so[bot]@users.noreply.github.com> Date: Thu, 11 Sep 2025 01:59:27 +0000 Subject: [PATCH 2/3] ci: run cargo-udeps on nightly and simplify check logic\n\n- Use nightly toolchain for udeps\n- Avoid shell regex grouping; grep on captured output instead\n\nCo-authored-by: ammario <7416144+ammario@users.noreply.github.com> --- .github/workflows/tests.yml | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 126b1aa1..866f873a 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -203,10 +203,10 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Install Rust + - name: Install Rust (nightly for cargo-udeps) uses: dtolnay/rust-toolchain@stable with: - toolchain: stable + toolchain: nightly - name: Setup Rust cache uses: Swatinem/rust-cache@v2 @@ -219,14 +219,24 @@ jobs: - name: Check for unused dependencies run: | set -euo pipefail - OUTPUT=$(cargo udeps --all-targets --all-features 2>&1 || true) - echo \"$OUTPUT\" - if echo \"$OUTPUT\" | grep -qi \"no crates were unused\"; then - exit 0 - elif echo \"$OUTPUT\" | grep -qiE \"unused (crates|dependencies)\"; then - echo \"Unused dependencies detected\" + # 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 - else - echo \"cargo-udeps completed without explicit confirmation; treating as success\" - exit 0 fi \ No newline at end of file From a3920923665c78777b3d13532d805c83db527a2a Mon Sep 17 00:00:00 2001 From: "blink-so[bot]" <211532188+blink-so[bot]@users.noreply.github.com> Date: Thu, 11 Sep 2025 02:08:00 +0000 Subject: [PATCH 3/3] chore: remove unused dependencies to satisfy udeps\n\n- Remove tower, rustls-pemfile, serde, serde_yaml, serde_json\n\nCo-authored-by: ammario <7416144+ammario@users.noreply.github.com> --- Cargo.toml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) 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