diff options
Diffstat (limited to 'ci/check-minimal-versions.sh')
-rw-r--r-- | ci/check-minimal-versions.sh | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/ci/check-minimal-versions.sh b/ci/check-minimal-versions.sh index a11d2cb..6152c15 100644 --- a/ci/check-minimal-versions.sh +++ b/ci/check-minimal-versions.sh @@ -1,8 +1,8 @@ #!/bin/bash # Check all public crates with minimal version dependencies. # -# Note that this script modifies Cargo.toml and Cargo.lock and does not restore -# them after a run. +# Note that this script modifies Cargo.toml and Cargo.lock while this script is +# running, and it is an error if there are any unstaged changes. # # Refs: # * minimal versions: https://github.com/rust-lang/cargo/issues/5657 @@ -10,10 +10,18 @@ set -euo pipefail +# This script modifies Cargo.toml and Cargo.lock, so make sure there are no +# unstaged changes. +git diff --exit-code + # Remove dev-dependencies from Cargo.toml to prevent the next `cargo update` # from determining minimal versions based on dev-dependencies. cargo hack --remove-dev-deps --workspace + # Update Cargo.lock to minimal version dependencies. cargo update -Zminimal-versions # Run check for all public members of the workspace. cargo hack check --workspace --all-features --ignore-private -Zfeatures=all + +# Restore original Cargo.toml and Cargo.lock. +git checkout . |