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 # Some crates require pinning to meet our MSRV even for our downstream users,
9 # Further crates which appear only as dev-dependencies are pinned further down.
10 function PIN_RELEASE_DEPS {
11 return 0 # Don't fail the script if our rustc is higher than the last check
14 PIN_RELEASE_DEPS # pin the release dependencies in our main workspace
16 # Starting with version 1.10.0, the `regex` crate has an MSRV of rustc 1.65.0.
17 [ "$RUSTC_MINOR_VERSION" -lt 65 ] && cargo update -p regex --precise "1.9.6" --verbose
19 # The addr2line v0.21 crate (a dependency of `backtrace` starting with 0.3.69) relies on rustc 1.65
20 [ "$RUSTC_MINOR_VERSION" -lt 65 ] && cargo update -p backtrace --precise "0.3.68" --verbose
22 export RUST_BACKTRACE=1
24 echo -e "\n\nBuilding and testing all workspace crates..."
25 cargo test --verbose --color always
26 cargo check --verbose --color always
28 echo -e "\n\nBuilding and testing Block Sync Clients with features"
29 pushd lightning-block-sync
30 cargo test --verbose --color always --features rest-client
31 cargo check --verbose --color always --features rest-client
32 cargo test --verbose --color always --features rpc-client
33 cargo check --verbose --color always --features rpc-client
34 cargo test --verbose --color always --features rpc-client,rest-client
35 cargo check --verbose --color always --features rpc-client,rest-client
36 cargo test --verbose --color always --features rpc-client,rest-client,tokio
37 cargo check --verbose --color always --features rpc-client,rest-client,tokio
40 if [[ "$HOST_PLATFORM" != *windows* ]]; then
41 echo -e "\n\nBuilding and testing Transaction Sync Clients with features"
42 pushd lightning-transaction-sync
44 # zstd-sys 2.0.9+zstd.1.5.5 requires rustc 1.64.0
45 [ "$RUSTC_MINOR_VERSION" -lt 64 ] && cargo update -p zstd-sys --precise "2.0.8+zstd.1.5.5" --verbose
46 # reqwest 0.11.21 had a regression that broke its 1.63.0 MSRV
47 [ "$RUSTC_MINOR_VERSION" -lt 65 ] && cargo update -p reqwest --precise "0.11.20" --verbose
48 # jobserver 0.1.27 requires rustc 1.66.0
49 [ "$RUSTC_MINOR_VERSION" -lt 66 ] && cargo update -p jobserver --precise "0.1.26" --verbose
50 # Starting with version 1.10.0, the `regex` crate has an MSRV of rustc 1.65.0.
51 [ "$RUSTC_MINOR_VERSION" -lt 65 ] && cargo update -p regex --precise "1.9.6" --verbose
53 cargo test --verbose --color always --features esplora-blocking
54 cargo check --verbose --color always --features esplora-blocking
55 cargo test --verbose --color always --features esplora-async
56 cargo check --verbose --color always --features esplora-async
57 cargo test --verbose --color always --features esplora-async-https
58 cargo check --verbose --color always --features esplora-async-https
59 cargo test --verbose --color always --features electrum
60 cargo check --verbose --color always --features electrum
65 echo -e "\n\nTest futures builds"
66 pushd lightning-background-processor
67 cargo test --verbose --color always --features futures
70 echo -e "\n\nTest Custom Message Macros"
71 pushd lightning-custom-message
72 cargo test --verbose --color always
73 [ "$CI_MINIMIZE_DISK_USAGE" != "" ] && cargo clean
76 echo -e "\n\nTest backtrace-debug builds"
78 cargo test --verbose --color always --features backtrace
81 echo -e "\n\nBuilding with all Log-Limiting features"
83 grep '^max_level_' Cargo.toml | awk '{ print $1 }'| while read -r FEATURE; do
84 cargo check --verbose --color always --features "$FEATURE"
88 echo -e "\n\nTesting no-std flags in various combinations"
89 for DIR in lightning lightning-invoice lightning-rapid-gossip-sync; do
90 cargo test -p $DIR --verbose --color always --no-default-features --features no-std
91 # check if there is a conflict between no-std and the default std feature
92 cargo test -p $DIR --verbose --color always --features no-std
95 for DIR in lightning lightning-invoice lightning-rapid-gossip-sync; do
96 # check if there is a conflict between no-std and the c_bindings cfg
97 RUSTFLAGS="--cfg=c_bindings" cargo test -p $DIR --verbose --color always --no-default-features --features=no-std
99 RUSTFLAGS="--cfg=c_bindings" cargo test --verbose --color always
101 # Note that outbound_commitment_test only runs in this mode because of hardcoded signature values
103 cargo test --verbose --color always --no-default-features --features=std,_test_vectors
105 # This one only works for lightning-invoice
106 pushd lightning-invoice
107 # check that compile with no-std and serde works in lightning-invoice
108 cargo test --verbose --color always --no-default-features --features no-std --features serde
111 echo -e "\n\nTesting no-std build on a downstream no-std crate"
112 # check no-std compatibility across dependencies
114 cargo check --verbose --color always --features lightning-transaction-sync
115 [ "$CI_MINIMIZE_DISK_USAGE" != "" ] && cargo clean
118 # Test that we can build downstream code with only the "release pins".
119 pushd msrv-no-dev-deps-check
122 [ "$CI_MINIMIZE_DISK_USAGE" != "" ] && cargo clean
125 if [ -f "$(which arm-none-eabi-gcc)" ]; then
127 cargo build --target=thumbv7m-none-eabi
128 [ "$CI_MINIMIZE_DISK_USAGE" != "" ] && cargo clean
132 echo -e "\n\nTest Taproot builds"
134 RUSTFLAGS="$RUSTFLAGS --cfg=taproot" cargo test --verbose --color always -p lightning