From 3da39c6fb6131469a8cb0ec23292625d0a37b0e5 Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Thu, 20 Jul 2023 11:00:34 +1000 Subject: [PATCH] Run test with recent/minimal lock files Update the CI scripts to use the minimal/recent lockfiles, requires using `--locked` for various `cargo` incantations. --- contrib/_test.sh | 44 ++++++++++++++++++++++---------------------- contrib/test.sh | 21 ++++++++++++++++++++- 2 files changed, 42 insertions(+), 23 deletions(-) diff --git a/contrib/_test.sh b/contrib/_test.sh index 38c7315..c2f057e 100755 --- a/contrib/_test.sh +++ b/contrib/_test.sh @@ -29,50 +29,50 @@ cargo test -- --ignored --exact 'tests::test_panic_raw_ctx_should_terminate_abno export CARGO_TERM_VERBOSE=true # Defaults / sanity checks -cargo build --all -cargo test --all +cargo build --locked --all +cargo test --locked --all if [ "$DO_FEATURE_MATRIX" = true ]; then - cargo build --all --no-default-features - cargo test --all --no-default-features + cargo build --locked --all --no-default-features + cargo test --locked --all --no-default-features # All features - cargo build --all --no-default-features --features="$FEATURES" - cargo test --all --no-default-features --features="$FEATURES" + cargo build --locked --all --no-default-features --features="$FEATURES" + cargo test --locked --all --no-default-features --features="$FEATURES" # Single features for feature in ${FEATURES} do - cargo build --all --no-default-features --features="$feature" - cargo test --all --no-default-features --features="$feature" + cargo build --locked --all --no-default-features --features="$feature" + cargo test --locked --all --no-default-features --features="$feature" done # Features tested with 'std' feature enabled. for feature in ${FEATURES} do - cargo build --all --no-default-features --features="std,$feature" - cargo test --all --no-default-features --features="std,$feature" + cargo build --locked --all --no-default-features --features="std,$feature" + cargo test --locked --all --no-default-features --features="std,$feature" done # Other combos - RUSTFLAGS='--cfg=secp256k1_fuzz' RUSTDOCFLAGS='--cfg=secp256k1_fuzz' cargo test --all - RUSTFLAGS='--cfg=secp256k1_fuzz' RUSTDOCFLAGS='--cfg=secp256k1_fuzz' cargo test --all --features="$FEATURES" - cargo test --all --features="rand serde" + RUSTFLAGS='--cfg=secp256k1_fuzz' RUSTDOCFLAGS='--cfg=secp256k1_fuzz' cargo test --locked --all + RUSTFLAGS='--cfg=secp256k1_fuzz' RUSTDOCFLAGS='--cfg=secp256k1_fuzz' cargo test --locked --all --features="$FEATURES" + cargo test --locked --all --features="rand serde" if [ "$NIGHTLY" = true ]; then - cargo test --all --all-features - RUSTFLAGS='--cfg=secp256k1_fuzz' RUSTDOCFLAGS='--cfg=secp256k1_fuzz' cargo test --all --all-features + cargo test --locked --all --all-features + RUSTFLAGS='--cfg=secp256k1_fuzz' RUSTDOCFLAGS='--cfg=secp256k1_fuzz' cargo test --locked --all --all-features fi # Examples - cargo run --example sign_verify --features=bitcoin-hashes-std - cargo run --example sign_verify_recovery --features=recovery,bitcoin-hashes-std - cargo run --example generate_keys --features=rand-std + cargo run --locked --example sign_verify --features=bitcoin-hashes-std + cargo run --locked --example sign_verify_recovery --features=recovery,bitcoin-hashes-std + cargo run --locked --example generate_keys --features=rand-std fi if [ "$DO_LINT" = true ] then - cargo clippy --all-features --all-targets -- -D warnings - cargo clippy --example sign_verify --features=bitcoin-hashes-std -- -D warnings - cargo clippy --example sign_verify_recovery --features=recovery,bitcoin-hashes-std -- -D warnings - cargo clippy --example generate_keys --features=rand-std -- -D warnings + cargo clippy --locked --all-features --all-targets -- -D warnings + cargo clippy --locked --example sign_verify --features=bitcoin-hashes-std -- -D warnings + cargo clippy --locked --example sign_verify_recovery --features=recovery,bitcoin-hashes-std -- -D warnings + cargo clippy --locked --example generate_keys --features=rand-std -- -D warnings fi # Build the docs if told to (this only works with the nightly toolchain) diff --git a/contrib/test.sh b/contrib/test.sh index cd742e2..fa6c14a 100755 --- a/contrib/test.sh +++ b/contrib/test.sh @@ -3,6 +3,7 @@ set -ex REPO_DIR=$(git rev-parse --show-toplevel) +DEPS="recent minimal" # Webassembly stuff # @@ -18,4 +19,22 @@ if [ "$DO_WASM" = true ]; then exit 0 fi -$REPO_DIR/contrib/_test.sh +for dep in $DEPS +do + cp "Cargo-$dep.lock" Cargo.lock + $REPO_DIR/contrib/_test.sh + + if [ "$dep" = recent ]; + then + # We always test committed dependencies but we want to warn if they could've been updated + cargo update + if diff Cargo-recent.lock Cargo.lock; + then + echo "Dependencies are up to date" + else + echo "::warning file=Cargo-recent.lock::Dependencies could be updated" + fi + fi +done + +exit 0