From cda097dda8c1f1200c8f3997b8376a90a90898be Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Thu, 21 Jul 2022 11:10:07 +1000 Subject: [PATCH] Add ci check for duplicate dependencies Add a call to `cargo tree --duplicates` in the ci script to ensure that we do not have any duplicated dependencies. Kudos to Martin for the idea. --- contrib/test.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/contrib/test.sh b/contrib/test.sh index cdc7255f..0bb0771b 100755 --- a/contrib/test.sh +++ b/contrib/test.sh @@ -22,6 +22,15 @@ if cargo --version | grep nightly; then NIGHTLY=true fi +# We should not have any duplicate dependencies. This catches mistakes made upgrading dependencies +# in one crate and not in another (e.g. upgrade bitcoin_hashes in bitcoin but not in secp). +duplicate_dependencies=$(cargo tree --target=all --all-features --duplicates | wc -l) +if [ "$duplicate_dependencies" -ne 0 ]; then + echo "Dependency tree is broken, contains duplicates" + cargo tree --target=all --all-features --duplicates + exit 1 +fi + echo "********* Testing std *************" # Test without any features other than std first cargo test --verbose --no-default-features --features="std"