From 96cde672080d9b7181ec95dde12305de4e491fe1 Mon Sep 17 00:00:00 2001 From: Jonathan Woollett-Light Date: Tue, 26 Sep 2023 13:29:20 +0100 Subject: [PATCH] ci: Test for unused dependencies Adds a test for unused cargo dependencies. Signed-off-by: Jonathan Woollett-Light --- tests/integration_tests/build/test_dependencies.py | 7 +++++++ tools/devctr/Dockerfile | 3 ++- tools/devctr/poetry.lock | 14 +++++++------- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/tests/integration_tests/build/test_dependencies.py b/tests/integration_tests/build/test_dependencies.py index 778f5facc228..04c72da93a37 100644 --- a/tests/integration_tests/build/test_dependencies.py +++ b/tests/integration_tests/build/test_dependencies.py @@ -25,3 +25,10 @@ def test_licenses(): ) cargo("deny", f"--manifest-path {toml_file} check licenses bans") + + +def test_unused_dependencies(): + """ + Test that there are no unused dependencies. + """ + cargo("+nightly udeps --all") diff --git a/tools/devctr/Dockerfile b/tools/devctr/Dockerfile index d3fd64d893de..9ada623be373 100644 --- a/tools/devctr/Dockerfile +++ b/tools/devctr/Dockerfile @@ -71,9 +71,10 @@ RUN cd /tmp/poetry && \ # Install the Rust toolchain. Kani only work on x86, so only try to install it there. RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain "$RUST_TOOLCHAIN" \ + && rustup install nightly \ && rustup target add $ARCH-unknown-linux-musl \ && rustup component add llvm-tools-preview \ - && cargo install cargo-audit cargo-deny grcov cargo-sort \ + && cargo install cargo-audit cargo-deny grcov cargo-sort cargo-udeps \ && (if [ "$ARCH" = "x86_64" ]; then cargo install kani-verifier && cargo kani setup; else true; fi) \ && rm -rf "$CARGO_HOME/registry" \ && ln -s "$CARGO_REGISTRY_DIR" "$CARGO_HOME/registry" \ diff --git a/tools/devctr/poetry.lock b/tools/devctr/poetry.lock index f9da59986e4a..790470d568b1 100644 --- a/tools/devctr/poetry.lock +++ b/tools/devctr/poetry.lock @@ -160,13 +160,13 @@ python-dateutil = ">=2.7.0" [[package]] name = "astroid" -version = "2.15.6" +version = "2.15.7" description = "An abstract syntax tree for Python with inference support." optional = false python-versions = ">=3.7.2" files = [ - {file = "astroid-2.15.6-py3-none-any.whl", hash = "sha256:389656ca57b6108f939cf5d2f9a2a825a3be50ba9d589670f393236e0a03b91c"}, - {file = "astroid-2.15.6.tar.gz", hash = "sha256:903f024859b7c7687d7a7f3a3f73b17301f8e42dfd9cc9df9d4418172d3e2dbd"}, + {file = "astroid-2.15.7-py3-none-any.whl", hash = "sha256:958f280532e36ca84a13023f15cb1556fb6792d193acb87e1f3ca536b6fa6bd2"}, + {file = "astroid-2.15.7.tar.gz", hash = "sha256:c522f2832a900e27a7d284b9b6ef670d2495f760ede3c8c0b004a5641d3c5987"}, ] [package.dependencies] @@ -1256,17 +1256,17 @@ plugins = ["importlib-metadata"] [[package]] name = "pylint" -version = "2.17.5" +version = "2.17.6" description = "python code static checker" optional = false python-versions = ">=3.7.2" files = [ - {file = "pylint-2.17.5-py3-none-any.whl", hash = "sha256:73995fb8216d3bed149c8d51bba25b2c52a8251a2c8ac846ec668ce38fab5413"}, - {file = "pylint-2.17.5.tar.gz", hash = "sha256:f7b601cbc06fef7e62a754e2b41294c2aa31f1cb659624b9a85bcba29eaf8252"}, + {file = "pylint-2.17.6-py3-none-any.whl", hash = "sha256:18a1412e873caf8ffb56b760ce1b5643675af23e6173a247b502406b24c716af"}, + {file = "pylint-2.17.6.tar.gz", hash = "sha256:be928cce5c76bf9acdc65ad01447a1e0b1a7bccffc609fb7fc40f2513045bd05"}, ] [package.dependencies] -astroid = ">=2.15.6,<=2.17.0-dev0" +astroid = ">=2.15.7,<=2.17.0-dev0" colorama = {version = ">=0.4.5", markers = "sys_platform == \"win32\""} dill = {version = ">=0.2", markers = "python_version < \"3.11\""} isort = ">=4.2.5,<6"