Skip to content

Commit

Permalink
chore: add cargo hack check to bin/publish (#1950)
Browse files Browse the repository at this point in the history
This adds a check to the `bin/publish` script that the crate being
published builds successfully with all possible feature combinations,
using `cargo hack --feature-powerset`.

This would have prevented #1944.

We test this on CI for most crates in the repo, but it's disabled for some
crates because the powerset is very large, making the check too slow
to run on CI. However, adding it to the publish script will ensure that it's
at least always run before publishing a crate.
  • Loading branch information
hawkw committed Feb 21, 2022
1 parent 009dde2 commit 7c00d76
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions bin/publish
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,18 @@ verify() {
exit 1
fi

if ! cargo list | grep -q "hack"; then
status "Installing" "cargo-hack"
cargo install cargo-hack
fi

status "Checking" "if $CRATE builds across feature combinations"

if ! cargo hack check $VERBOSE --feature-powerset --no-dev-deps; then
err "$CRATE did not build with all feature combinations!"
exit 1
fi

if git tag -l | grep -Fxq "$TAG" ; then
err "git tag \`$TAG\` already exists"
exit 1
Expand Down

0 comments on commit 7c00d76

Please sign in to comment.