4 RUSTC_MINOR_VERSION=$(rustc --version | awk '{ split($2,a,"."); print a[2] }')
5 HOST_PLATFORM="$(rustc --version --verbose | grep "host:" | awk '{ print $2 }')"
7 # Tokio MSRV on versions 1.17 through 1.26 is rustc 1.49. Above 1.26 MSRV is 1.56.
8 [ "$RUSTC_MINOR_VERSION" -lt 49 ] && cargo update -p tokio --precise "1.14.0" --verbose
9 [[ "$RUSTC_MINOR_VERSION" -gt 48 && "$RUSTC_MINOR_VERSION" -lt 56 ]] && cargo update -p tokio --precise "1.26.0" --verbose
10 [ "$LDK_COVERAGE_BUILD" != "" ] && export RUSTFLAGS="-C link-dead-code"
12 export RUST_BACKTRACE=1
14 echo -e "\n\nBuilding and testing all workspace crates..."
15 cargo build --verbose --color always
16 cargo test --verbose --color always
18 echo -e "\n\nBuilding with all Log-Limiting features"
20 grep '^max_level_' Cargo.toml | awk '{ print $1 }'| while read -r FEATURE; do
21 cargo build --verbose --color always --features "$FEATURE"
25 if [ "$RUSTC_MINOR_VERSION" -gt 51 ]; then # Current `object` MSRV, subject to change
26 echo -e "\n\nTest backtrace-debug builds"
28 cargo test --verbose --color always --features backtrace
32 echo -e "\n\nTesting no-std flags in various combinations"
33 for DIR in lightning lightning-invoice lightning-rapid-gossip-sync; do
35 cargo test --verbose --color always --no-default-features --features no-std
36 # check if there is a conflict between no-std and the default std feature
37 cargo test --verbose --color always --features no-std
38 # check that things still pass without grind_signatures
39 # note that outbound_commitment_test only runs in this mode, because of hardcoded signature values
40 cargo test --verbose --color always --no-default-features --features std
41 # check if there is a conflict between no-std and the c_bindings cfg
42 RUSTFLAGS="--cfg=c_bindings" cargo test --verbose --color always --no-default-features --features=no-std
46 echo -e "\n\nTesting no-std build on a downstream no-std crate"
47 # check no-std compatibility across dependencies
49 cargo check --verbose --color always --features lightning-transaction-sync
52 if [ -f "$(which arm-none-eabi-gcc)" ]; then
54 cargo build --target=thumbv7m-none-eabi
58 echo -e "\n\nBuilding and testing Block Sync Clients with features"
59 pushd lightning-block-sync
60 cargo build --verbose --color always --features rest-client
61 cargo test --verbose --color always --features rest-client
62 cargo build --verbose --color always --features rpc-client
63 cargo test --verbose --color always --features rpc-client
64 cargo build --verbose --color always --features rpc-client,rest-client
65 cargo test --verbose --color always --features rpc-client,rest-client
66 cargo build --verbose --color always --features rpc-client,rest-client,tokio
67 cargo test --verbose --color always --features rpc-client,rest-client,tokio
70 if [[ $RUSTC_MINOR_VERSION -gt 67 && "$HOST_PLATFORM" != *windows* ]]; then
71 echo -e "\n\nBuilding and testing Transaction Sync Clients with features"
72 pushd lightning-transaction-sync
73 cargo build --verbose --color always --features esplora-blocking
74 cargo test --verbose --color always --features esplora-blocking
75 cargo build --verbose --color always --features esplora-async
76 cargo test --verbose --color always --features esplora-async
77 cargo build --verbose --color always --features esplora-async-https
78 cargo test --verbose --color always --features esplora-async-https
82 echo -e "\n\nTest futures builds"
83 pushd lightning-background-processor
84 cargo test --verbose --color always --no-default-features --features futures
87 if [ "$RUSTC_MINOR_VERSION" -gt 55 ]; then
88 echo -e "\n\nTest Custom Message Macros"
89 pushd lightning-custom-message
90 cargo test --verbose --color always
94 echo -e "\n\nTest anchors builds"
96 RUSTFLAGS="$RUSTFLAGS --cfg=anchors" cargo test --verbose --color always -p lightning
97 echo -e "\n\nTest Taproot builds"
98 RUSTFLAGS="$RUSTFLAGS --cfg=anchors --cfg=taproot" cargo test --verbose --color always -p lightning