-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test-features recipe to justfile
Created a `.sh` script using the `cargo-hack` tool in order to easily test all feature combinations. This is done in `--release` mode to reduce the size of the compiled artifacts. The script is located in a new `contrib` directory (same approach followed by `rust-bitcoin` crates). This will be useful for CI as well.
- Loading branch information
Showing
2 changed files
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/bin/sh | ||
|
||
# Exit immediately if any command fails | ||
set -e | ||
|
||
# Install or update cargo-hack (will skip if up-to-date) | ||
cargo install cargo-hack --locked | ||
|
||
crates="\ | ||
floresta-chain \ | ||
floresta-cli \ | ||
floresta-common \ | ||
floresta-compact-filters \ | ||
floresta-electrum \ | ||
floresta-watch-only \ | ||
floresta-wire \ | ||
floresta \ | ||
florestad" | ||
|
||
for crate in $crates; do | ||
# Determine the path to the crate | ||
if [ "$crate" = "florestad" ]; then | ||
path="$crate" | ||
else | ||
path="crates/$crate" | ||
fi | ||
|
||
# The default feature, if not used to conditionally compile code, can be skipped as the combinations already | ||
# include that case (see https://github.com/taiki-e/cargo-hack/issues/155#issuecomment-2474330839) | ||
if [ "$crate" = "floresta-compact-filters" ] || [ "$crate" = "floresta-electrum" ]; then | ||
# These two crates don't have a default feature | ||
skip_default="" | ||
else | ||
skip_default="--skip default" | ||
fi | ||
|
||
# Navigate to the crate's directory | ||
cd "$path" || exit 1 | ||
echo "Testing all feature combinations for $crate..." | ||
export RUSTFLAGS="-Awarnings" | ||
|
||
# Test all feature combinations | ||
# shellcheck disable=SC2086 | ||
cargo hack test --release --feature-powerset $skip_default --quiet | ||
cd - > /dev/null || exit 1 | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters