Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ jobs:

steps:
- uses: actions/checkout@v4
- uses: taiki-e/install-action@cargo-hack

- name: Install latest nightly
uses: dtolnay/rust-toolchain@nightly
Expand All @@ -24,7 +25,8 @@ jobs:
run: cargo +nightly fmt --all --check

- name: Run cargo clippy
run: cargo +nightly clippy --all-targets -- -D warnings
run: ./contrib/feature_matrix.sh clippy '-- -D warnings'
shell: bash # Ensure the script runs using bash on all platforms

cross-testing:
strategy:
Expand Down Expand Up @@ -71,7 +73,7 @@ jobs:

# Run the feature testing script
- name: Run feature tests
run: ./contrib/test_features.sh --verbose
run: ./contrib/feature_matrix.sh test --verbose
shell: bash # Ensure the script runs using bash on all platforms

# Save cache only if the previous steps succeeded and there was not an exact cache key match
Expand Down
25 changes: 18 additions & 7 deletions contrib/test_features.sh → contrib/feature_matrix.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
#!/bin/sh

# Exit immediately if any command fails
set -e

# Pass the first argument to the script as a cargo argument, defaults to empty string
cargo_arg="${1:-}"
# The first argument specifies the action: "clippy" or "test".
action="${1:-}"
if [ "$action" != "clippy" ] && [ "$action" != "test" ]; then
echo "Usage: $0 {clippy|test} [cargo_arg]" >&2
exit 1
fi

# The second argument is passed to cargo (e.g., "-- -D warnings"); defaults to empty.
cargo_arg="${2:-}"

crates="\
floresta-chain \
Expand Down Expand Up @@ -36,10 +42,15 @@ for crate in $crates; do

# Navigate to the crate's directory
cd "$path" || exit 1
printf "\033[1;35mTesting all feature combinations for %s...\033[0m\n" "$crate"
printf "\033[1;35mRunning cargo %s for all feature combinations in %s...\033[0m\n" "$action" "$crate"

if [ "$action" = "clippy" ]; then
# shellcheck disable=SC2086
cargo +nightly hack clippy --all-targets --feature-powerset $skip_default $cargo_arg
elif [ "$action" = "test" ]; then
# shellcheck disable=SC2086
cargo hack test --release --feature-powerset $skip_default -v $cargo_arg
fi

# Test all feature combinations (to run with verbose output the `cargo_arg` must also be -v/--verbose)
# shellcheck disable=SC2086
cargo hack test --release --feature-powerset $skip_default -v $cargo_arg
cd - > /dev/null || exit 1
done
1 change: 1 addition & 0 deletions crates/floresta-common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ use sha2::Digest;
pub mod macros;
pub mod spsc;

#[cfg(any(feature = "descriptors-std", feature = "descriptors-no-std"))]
use prelude::*;
pub use spsc::Channel;

Expand Down
8 changes: 2 additions & 6 deletions florestad/src/florestad.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use core::panic;
use std::fmt::Arguments;
use std::fs::File;
use std::io::BufReader;
Expand Down Expand Up @@ -45,8 +44,6 @@ use log::error;
use log::info;
use log::warn;
use log::Record;
#[cfg(feature = "metrics")]
use metrics;
use rustreexo::accumulator::pollard::Pollard;
use tokio::net::TcpListener;
use tokio::sync::RwLock;
Expand Down Expand Up @@ -443,8 +440,7 @@ impl Florestad {
{
info!("Starting ZMQ server");
if let Ok(zserver) = ZMQServer::new(
&self
.config
self.config
.zmq_address
.as_ref()
.unwrap_or(&"tcp://127.0.0.1:5150".to_string()),
Expand Down Expand Up @@ -477,7 +473,7 @@ impl Florestad {
));

if self.json_rpc.set(server).is_err() {
panic!("We should be the first one setting this");
core::panic!("We should be the first one setting this");
}
}

Expand Down
18 changes: 14 additions & 4 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ doc:

# Format code and run configured linters
lint:
cargo +nightly fmt --all && cargo +nightly clippy --all-targets
@just fmt
cargo +nightly clippy --all-targets --no-default-features
cargo +nightly clippy --all-targets --all-features

# Format code
fmt:
Expand All @@ -71,14 +73,22 @@ fmt:
format:
cargo +nightly fmt --all --check

# Test all feature combinations for each crate using cargo-hack (arg: optional, e.g., --quiet or --verbose)
# Test all feature combinations in each crate (arg: optional, e.g., --quiet or --verbose)
test-features arg="":
cargo install cargo-hack --locked
./contrib/test_features.sh {{arg}}
./contrib/feature_matrix.sh test {{arg}}

# Run clippy for all feature combinations in each crate (arg: optional, e.g., '-- -D warnings')
lint-features arg="":
cargo install cargo-hack --locked
./contrib/feature_matrix.sh clippy '{{arg}}'

# Remove test-generated data
clean-data:
./contrib/clean_data.sh

# Run all needed checks before contributing code (pre-commit check)
pcc: lint test-features
pcc:
@just fmt
@just lint-features '-- -D warnings'
@just test-features