mirror of
https://github.com/lightningdevkit/rust-lightning.git
synced 2025-03-13 14:52:21 +01:00
Ensure we always pass a path
for in-workspace dependencies
In order to ensure our crates depend on the workspace copies of each other in test builds we need to override the crates.io dependency with a local `path`. We can do this in one of two ways - either specify the `path` in the dependency listing in each crate's `Cargo.toml` or use the workspace `Cargo.toml` to `patch` all dependencies. The first is tedious while the second lets us have it all in one place. However, the second option does break `cargo *` in individual crate directories (forcing the use of `cargo -p crate *` instead) and makes it rather difficult to depend on local versions of workspace crates. Thus, here we drop the `patch.crates-io` from our top-level `Cargo.toml` entirely. Still, we do update the `ci/ci-tests.sh` script here to use `cargo -p crate` instead of switching to each crate's directory as it allows `cargo` to use a shared `target` and may speed up tests.
This commit is contained in:
parent
f8b7ad242d
commit
9ca38c59f4
4 changed files with 26 additions and 47 deletions
|
@ -41,9 +41,6 @@ opt-level = 3
|
||||||
lto = true
|
lto = true
|
||||||
panic = "abort"
|
panic = "abort"
|
||||||
|
|
||||||
[patch.crates-io.possiblyrandom]
|
|
||||||
path = "possiblyrandom"
|
|
||||||
|
|
||||||
[workspace.lints.rust.unexpected_cfgs]
|
[workspace.lints.rust.unexpected_cfgs]
|
||||||
level = "forbid"
|
level = "forbid"
|
||||||
# When adding a new cfg attribute, ensure that it is added to this list.
|
# When adding a new cfg attribute, ensure that it is added to this list.
|
||||||
|
|
|
@ -32,60 +32,49 @@ cargo test --verbose --color always
|
||||||
cargo check --verbose --color always
|
cargo check --verbose --color always
|
||||||
|
|
||||||
echo -e "\n\nBuilding and testing Block Sync Clients with features"
|
echo -e "\n\nBuilding and testing Block Sync Clients with features"
|
||||||
pushd lightning-block-sync
|
|
||||||
cargo test --verbose --color always --features rest-client
|
cargo test -p lightning-block-sync --verbose --color always --features rest-client
|
||||||
cargo check --verbose --color always --features rest-client
|
cargo check -p lightning-block-sync --verbose --color always --features rest-client
|
||||||
cargo test --verbose --color always --features rpc-client
|
cargo test -p lightning-block-sync --verbose --color always --features rpc-client
|
||||||
cargo check --verbose --color always --features rpc-client
|
cargo check -p lightning-block-sync --verbose --color always --features rpc-client
|
||||||
cargo test --verbose --color always --features rpc-client,rest-client
|
cargo test -p lightning-block-sync --verbose --color always --features rpc-client,rest-client
|
||||||
cargo check --verbose --color always --features rpc-client,rest-client
|
cargo check -p lightning-block-sync --verbose --color always --features rpc-client,rest-client
|
||||||
cargo test --verbose --color always --features rpc-client,rest-client,tokio
|
cargo test -p lightning-block-sync --verbose --color always --features rpc-client,rest-client,tokio
|
||||||
cargo check --verbose --color always --features rpc-client,rest-client,tokio
|
cargo check -p lightning-block-sync --verbose --color always --features rpc-client,rest-client,tokio
|
||||||
popd
|
|
||||||
|
|
||||||
if [[ "$HOST_PLATFORM" != *windows* ]]; then
|
if [[ "$HOST_PLATFORM" != *windows* ]]; then
|
||||||
pushd lightning-transaction-sync
|
|
||||||
echo -e "\n\nChecking Transaction Sync Clients with features."
|
echo -e "\n\nChecking Transaction Sync Clients with features."
|
||||||
cargo check --verbose --color always --features esplora-blocking
|
cargo check -p lightning-transaction-sync --verbose --color always --features esplora-blocking
|
||||||
cargo check --verbose --color always --features esplora-async
|
cargo check -p lightning-transaction-sync --verbose --color always --features esplora-async
|
||||||
cargo check --verbose --color always --features esplora-async-https
|
cargo check -p lightning-transaction-sync --verbose --color always --features esplora-async-https
|
||||||
cargo check --verbose --color always --features electrum
|
cargo check -p lightning-transaction-sync --verbose --color always --features electrum
|
||||||
|
|
||||||
if [ -z "$CI_ENV" ] && [[ -z "$BITCOIND_EXE" || -z "$ELECTRS_EXE" ]]; then
|
if [ -z "$CI_ENV" ] && [[ -z "$BITCOIND_EXE" || -z "$ELECTRS_EXE" ]]; then
|
||||||
echo -e "\n\nSkipping testing Transaction Sync Clients due to BITCOIND_EXE or ELECTRS_EXE being unset."
|
echo -e "\n\nSkipping testing Transaction Sync Clients due to BITCOIND_EXE or ELECTRS_EXE being unset."
|
||||||
cargo check --tests
|
cargo check -p lightning-transaction-sync --tests
|
||||||
else
|
else
|
||||||
echo -e "\n\nTesting Transaction Sync Clients with features."
|
echo -e "\n\nTesting Transaction Sync Clients with features."
|
||||||
cargo test --verbose --color always --features esplora-blocking
|
cargo test -p lightning-transaction-sync --verbose --color always --features esplora-blocking
|
||||||
cargo test --verbose --color always --features esplora-async
|
cargo test -p lightning-transaction-sync --verbose --color always --features esplora-async
|
||||||
cargo test --verbose --color always --features esplora-async-https
|
cargo test -p lightning-transaction-sync --verbose --color always --features esplora-async-https
|
||||||
cargo test --verbose --color always --features electrum
|
cargo test -p lightning-transaction-sync --verbose --color always --features electrum
|
||||||
fi
|
fi
|
||||||
popd
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo -e "\n\nTest futures builds"
|
echo -e "\n\nTest futures builds"
|
||||||
pushd lightning-background-processor
|
cargo test -p lightning-background-processor --verbose --color always --features futures
|
||||||
cargo test --verbose --color always --features futures
|
|
||||||
popd
|
|
||||||
|
|
||||||
echo -e "\n\nTest Custom Message Macros"
|
echo -e "\n\nTest Custom Message Macros"
|
||||||
pushd lightning-custom-message
|
cargo test -p lightning-custom-message --verbose --color always
|
||||||
cargo test --verbose --color always
|
|
||||||
[ "$CI_MINIMIZE_DISK_USAGE" != "" ] && cargo clean
|
[ "$CI_MINIMIZE_DISK_USAGE" != "" ] && cargo clean
|
||||||
popd
|
|
||||||
|
|
||||||
echo -e "\n\nTest backtrace-debug builds"
|
echo -e "\n\nTest backtrace-debug builds"
|
||||||
pushd lightning
|
cargo test -p lightning --verbose --color always --features backtrace
|
||||||
cargo test --verbose --color always --features backtrace
|
|
||||||
popd
|
|
||||||
|
|
||||||
echo -e "\n\nBuilding with all Log-Limiting features"
|
echo -e "\n\nBuilding with all Log-Limiting features"
|
||||||
pushd lightning
|
grep '^max_level_' lightning/Cargo.toml | awk '{ print $1 }'| while read -r FEATURE; do
|
||||||
grep '^max_level_' Cargo.toml | awk '{ print $1 }'| while read -r FEATURE; do
|
RUSTFLAGS="$RUSTFLAGS -A unused_variables -A unused_macros -A unused_imports -A dead_code" cargo check -p lightning --verbose --color always --features "$FEATURE"
|
||||||
RUSTFLAGS="$RUSTFLAGS -A unused_variables -A unused_macros -A unused_imports -A dead_code" cargo check --verbose --color always --features "$FEATURE"
|
|
||||||
done
|
done
|
||||||
popd
|
|
||||||
|
|
||||||
echo -e "\n\nTesting no-std flags in various combinations"
|
echo -e "\n\nTesting no-std flags in various combinations"
|
||||||
for DIR in lightning lightning-invoice lightning-rapid-gossip-sync; do
|
for DIR in lightning lightning-invoice lightning-rapid-gossip-sync; do
|
||||||
|
@ -101,14 +90,10 @@ done
|
||||||
RUSTFLAGS="$RUSTFLAGS --cfg=c_bindings" cargo test --verbose --color always
|
RUSTFLAGS="$RUSTFLAGS --cfg=c_bindings" cargo test --verbose --color always
|
||||||
|
|
||||||
# Note that outbound_commitment_test only runs in this mode because of hardcoded signature values
|
# Note that outbound_commitment_test only runs in this mode because of hardcoded signature values
|
||||||
pushd lightning
|
cargo test -p lightning --verbose --color always --no-default-features --features=std,_test_vectors
|
||||||
cargo test --verbose --color always --no-default-features --features=std,_test_vectors
|
|
||||||
popd
|
|
||||||
# This one only works for lightning-invoice
|
# This one only works for lightning-invoice
|
||||||
pushd lightning-invoice
|
|
||||||
# check that compile with no-std and serde works in lightning-invoice
|
# check that compile with no-std and serde works in lightning-invoice
|
||||||
cargo test --verbose --color always --no-default-features --features no-std --features serde
|
cargo test -p lightning-invoice --verbose --color always --no-default-features --features no-std --features serde
|
||||||
popd
|
|
||||||
|
|
||||||
echo -e "\n\nTesting no-std build on a downstream no-std crate"
|
echo -e "\n\nTesting no-std build on a downstream no-std crate"
|
||||||
# check no-std compatibility across dependencies
|
# check no-std compatibility across dependencies
|
||||||
|
|
|
@ -47,7 +47,7 @@ bech32 = { version = "0.9.1", default-features = false }
|
||||||
bitcoin = { version = "0.32.2", default-features = false, features = ["secp-recovery"] }
|
bitcoin = { version = "0.32.2", default-features = false, features = ["secp-recovery"] }
|
||||||
|
|
||||||
hashbrown = { version = "0.13", optional = true, default-features = false }
|
hashbrown = { version = "0.13", optional = true, default-features = false }
|
||||||
possiblyrandom = { version = "0.2", optional = true, default-features = false }
|
possiblyrandom = { version = "0.2", path = "../possiblyrandom", optional = true, default-features = false }
|
||||||
regex = { version = "1.5.6", optional = true }
|
regex = { version = "1.5.6", optional = true }
|
||||||
backtrace = { version = "0.3", optional = true }
|
backtrace = { version = "0.3", optional = true }
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,3 @@ lightning-background-processor = { path = "../lightning-background-processor", f
|
||||||
# Obviously lightning-transaction-sync doesn't support no-std, but it should build
|
# Obviously lightning-transaction-sync doesn't support no-std, but it should build
|
||||||
# even if lightning is built with no-std.
|
# even if lightning is built with no-std.
|
||||||
lightning-transaction-sync = { path = "../lightning-transaction-sync", optional = true }
|
lightning-transaction-sync = { path = "../lightning-transaction-sync", optional = true }
|
||||||
|
|
||||||
[patch.crates-io]
|
|
||||||
possiblyrandom = { path = "../possiblyrandom" }
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue