@@ -11,40 +11,6 @@ function PIN_RELEASE_DEPS {
1111 return 0 # Don't fail the script if our rustc is higher than the last check
1212}
1313
14- # Run a test command and emit GitHub Actions annotation on failure
15- # Usage: run_test "Test Name" command arg1 arg2 ...
16- function run_test {
17- local name=" $1 "
18- shift
19- local start duration
20-
21- echo -e " \n\n$name "
22- start=$( date +%s)
23- if " $@ " ; then
24- return 0
25- else
26- duration=$(( $(date +% s) - start))
27- mins=$(( duration / 60 ))
28- secs=$(( duration % 60 ))
29- if [ " $mins " -gt 0 ]; then
30- duration_str=" ${mins} m${secs} s"
31- else
32- duration_str=" ${secs} s"
33- fi
34- [ -n " $GITHUB_ACTIONS " ] && echo " ::error title=$name ::Test failed after ${duration_str} "
35- return 1
36- fi
37- }
38-
39- # Run a test command with custom RUSTFLAGS
40- # Usage: run_test_with_flags "Test Name" "extra flags" command arg1 arg2 ...
41- function run_test_with_flags {
42- local name=" $1 "
43- local extra_flags=" $2 "
44- shift 2
45- RUSTFLAGS=" $RUSTFLAGS $extra_flags " run_test " $name " " $@ "
46- }
47-
4814PIN_RELEASE_DEPS # pin the release dependencies in our main workspace
4915
5016# The backtrace v0.3.75 crate relies on rustc 1.82
@@ -58,98 +24,170 @@ PIN_RELEASE_DEPS # pin the release dependencies in our main workspace
5824
5925export RUST_BACKTRACE=1
6026
61- run_test " Workspace check" cargo check --verbose --color always
62-
6327WORKSPACE_MEMBERS=( $( cat Cargo.toml | tr ' \n' ' \r' | sed ' s/\r //g' | tr ' \r' ' \n' | grep ' ^members =' | sed ' s/members.*=.*\[//' | tr -d ' "' | tr ' ,' ' ' ) )
6428
65- run_test " Workspace tests" cargo test --verbose --color always
66-
67- run_test " LDK upgrade tests" bash -c ' pushd lightning-tests && cargo test && popd'
68-
69- for DIR in " ${WORKSPACE_MEMBERS[@]} " ; do
70- run_test " Check $DIR " cargo check -p " $DIR " --verbose --color always
71- run_test " Docs $DIR " cargo doc -p " $DIR " --document-private-items
72- done
73-
74- run_test " lightning tests (dnssec)" cargo test -p lightning --verbose --color always --features dnssec
75- run_test " lightning check (dnssec)" cargo check -p lightning --verbose --color always --features dnssec
76- run_test " lightning docs (dnssec)" cargo doc -p lightning --document-private-items --features dnssec
77-
78- run_test " block-sync test (rest-client)" cargo test -p lightning-block-sync --verbose --color always --features rest-client
79- run_test " block-sync check (rest-client)" cargo check -p lightning-block-sync --verbose --color always --features rest-client
80- run_test " block-sync test (rpc-client)" cargo test -p lightning-block-sync --verbose --color always --features rpc-client
81- run_test " block-sync check (rpc-client)" cargo check -p lightning-block-sync --verbose --color always --features rpc-client
82- run_test " block-sync test (rpc+rest)" cargo test -p lightning-block-sync --verbose --color always --features rpc-client,rest-client
83- run_test " block-sync check (rpc+rest)" cargo check -p lightning-block-sync --verbose --color always --features rpc-client,rest-client
84- run_test " block-sync test (rpc+rest+tokio)" cargo test -p lightning-block-sync --verbose --color always --features rpc-client,rest-client,tokio
85- run_test " block-sync check (rpc+rest+tokio)" cargo check -p lightning-block-sync --verbose --color always --features rpc-client,rest-client,tokio
86-
87- run_test " tx-sync check (esplora-blocking)" cargo check -p lightning-transaction-sync --verbose --color always --features esplora-blocking
88- run_test " tx-sync check (esplora-async)" cargo check -p lightning-transaction-sync --verbose --color always --features esplora-async
89- run_test " tx-sync check (esplora-async-https)" cargo check -p lightning-transaction-sync --verbose --color always --features esplora-async-https
90- run_test " tx-sync check (electrum)" cargo check -p lightning-transaction-sync --verbose --color always --features electrum
29+ run_step () {
30+ case " $1 " in
31+ workspace-check)
32+ cargo check --verbose --color always
33+ ;;
34+ workspace-tests)
35+ cargo test --verbose --color always
36+ ;;
37+ ldk-upgrade-tests)
38+ pushd lightning-tests && cargo test && popd
39+ ;;
40+ workspace-member-checks)
41+ for DIR in " ${WORKSPACE_MEMBERS[@]} " ; do
42+ cargo check -p " $DIR " --verbose --color always
43+ cargo doc -p " $DIR " --document-private-items
44+ done
45+ ;;
46+ lightning-dnssec)
47+ cargo test -p lightning --verbose --color always --features dnssec
48+ cargo check -p lightning --verbose --color always --features dnssec
49+ cargo doc -p lightning --document-private-items --features dnssec
50+ ;;
51+ block-sync-tests)
52+ cargo test -p lightning-block-sync --verbose --color always --features rest-client
53+ cargo check -p lightning-block-sync --verbose --color always --features rest-client
54+ cargo test -p lightning-block-sync --verbose --color always --features rpc-client
55+ cargo check -p lightning-block-sync --verbose --color always --features rpc-client
56+ cargo test -p lightning-block-sync --verbose --color always --features rpc-client,rest-client
57+ cargo check -p lightning-block-sync --verbose --color always --features rpc-client,rest-client
58+ cargo test -p lightning-block-sync --verbose --color always --features rpc-client,rest-client,tokio
59+ cargo check -p lightning-block-sync --verbose --color always --features rpc-client,rest-client,tokio
60+ ;;
61+ tx-sync-checks)
62+ cargo check -p lightning-transaction-sync --verbose --color always --features esplora-blocking
63+ cargo check -p lightning-transaction-sync --verbose --color always --features esplora-async
64+ cargo check -p lightning-transaction-sync --verbose --color always --features esplora-async-https
65+ cargo check -p lightning-transaction-sync --verbose --color always --features electrum
66+ ;;
67+ tx-sync-tests)
68+ if [ -z " $CI_ENV " ] && [[ -z " $BITCOIND_EXE " || -z " $ELECTRS_EXE " ]]; then
69+ echo -e " \n\nSkipping testing Transaction Sync Clients due to BITCOIND_EXE or ELECTRS_EXE being unset."
70+ cargo check -p lightning-transaction-sync --tests
71+ else
72+ cargo test -p lightning-transaction-sync --verbose --color always --features esplora-blocking
73+ cargo test -p lightning-transaction-sync --verbose --color always --features esplora-async
74+ cargo test -p lightning-transaction-sync --verbose --color always --features esplora-async-https
75+ cargo test -p lightning-transaction-sync --verbose --color always --features electrum
76+ fi
77+ ;;
78+ persister-tests)
79+ cargo test -p lightning-persister --verbose --color always --features tokio
80+ cargo check -p lightning-persister --verbose --color always --features tokio
81+ cargo doc -p lightning-persister --document-private-items --features tokio
82+ ;;
83+ custom-message-tests)
84+ cargo test -p lightning-custom-message --verbose --color always
85+ [ " $CI_MINIMIZE_DISK_USAGE " != " " ] && cargo clean
86+ ;;
87+ lightning-backtrace)
88+ cargo test -p lightning --verbose --color always --features backtrace
89+ ;;
90+ no-std-tests)
91+ for DIR in lightning-invoice lightning-rapid-gossip-sync lightning-liquidity; do
92+ cargo test -p $DIR --verbose --color always --no-default-features
93+ done
94+ cargo test -p lightning --verbose --color always --no-default-features
95+ cargo test -p lightning-background-processor --verbose --color always --no-default-features
96+ ;;
97+ c-bindings-tests)
98+ # Note that because `$RUSTFLAGS` is not passed through to doctest builds we cannot selectively
99+ # disable doctests in `c_bindings` so we skip doctests entirely here.
100+ RUSTFLAGS=" $RUSTFLAGS --cfg=c_bindings" cargo test --verbose --color always --lib --bins --tests
101+
102+ for DIR in lightning-invoice lightning-rapid-gossip-sync; do
103+ # check if there is a conflict between no_std and the c_bindings cfg
104+ RUSTFLAGS=" $RUSTFLAGS --cfg=c_bindings" cargo test -p $DIR --verbose --color always --no-default-features
105+ done
106+
107+ # Note that because `$RUSTFLAGS` is not passed through to doctest builds we cannot selectively
108+ # disable doctests in `c_bindings` so we skip doctests entirely here.
109+ RUSTFLAGS=" $RUSTFLAGS --cfg=c_bindings" cargo test -p lightning-background-processor --verbose --color always --no-default-features --lib --bins --tests
110+ RUSTFLAGS=" $RUSTFLAGS --cfg=c_bindings" cargo test -p lightning --verbose --color always --no-default-features --lib --bins --tests
111+ ;;
112+ test-vectors)
113+ # Note that outbound_commitment_test only runs in this mode because of hardcoded signature values
114+ RUSTFLAGS=" $RUSTFLAGS --cfg=ldk_test_vectors" cargo test -p lightning --verbose --color always --no-default-features --features=std
115+ ;;
116+ lightning-invoice-serde)
117+ # check that compile with no_std and serde works in lightning-invoice
118+ cargo test -p lightning-invoice --verbose --color always --no-default-features --features serde
119+ ;;
120+ no-std-check)
121+ pushd no-std-check && cargo check --verbose --color always && popd
122+ [ " $CI_MINIMIZE_DISK_USAGE " != " " ] && (cd no-std-check && cargo clean)
123+ ;;
124+ msrv-no-dev-deps-check)
125+ # Test that we can build downstream code with only the "release pins".
126+ pushd msrv-no-dev-deps-check && cargo check && popd
127+ [ " $CI_MINIMIZE_DISK_USAGE " != " " ] && (cd msrv-no-dev-deps-check && cargo clean)
128+ ;;
129+ no-std-check-arm)
130+ if [ -f " $( which arm-none-eabi-gcc) " ]; then
131+ pushd no-std-check && cargo build --target=thumbv7m-none-eabi && popd
132+ [ " $CI_MINIMIZE_DISK_USAGE " != " " ] && (cd no-std-check && cargo clean)
133+ else
134+ echo " Skipping ARM build (arm-none-eabi-gcc not found)"
135+ fi
136+ ;;
137+ taproot-tests)
138+ RUSTFLAGS=" $RUSTFLAGS --cfg=taproot" cargo test --verbose --color always -p lightning
139+ [ " $CI_MINIMIZE_DISK_USAGE " != " " ] && cargo clean
140+ ;;
141+ simple-close-tests)
142+ RUSTFLAGS=" $RUSTFLAGS --cfg=simple_close" cargo test --verbose --color always -p lightning
143+ [ " $CI_MINIMIZE_DISK_USAGE " != " " ] && cargo clean
144+ ;;
145+ lsps1-service-tests)
146+ RUSTFLAGS=" $RUSTFLAGS --cfg=lsps1_service" cargo test --verbose --color always -p lightning-liquidity
147+ [ " $CI_MINIMIZE_DISK_USAGE " != " " ] && cargo clean
148+ ;;
149+ peer-storage-tests)
150+ RUSTFLAGS=" $RUSTFLAGS --cfg=peer_storage" cargo test --verbose --color always -p lightning
151+ ;;
152+ * )
153+ echo " Unknown step: $1 "
154+ exit 1
155+ ;;
156+ esac
157+ }
91158
92- if [ -z " $CI_ENV " ] && [[ -z " $BITCOIND_EXE " || -z " $ELECTRS_EXE " ]]; then
93- echo -e " \n\nSkipping testing Transaction Sync Clients due to BITCOIND_EXE or ELECTRS_EXE being unset."
94- run_test " tx-sync check (tests only)" cargo check -p lightning-transaction-sync --tests
159+ # All steps in order
160+ ALL_STEPS=(
161+ workspace-check
162+ workspace-tests
163+ ldk-upgrade-tests
164+ workspace-member-checks
165+ lightning-dnssec
166+ block-sync-tests
167+ tx-sync-checks
168+ tx-sync-tests
169+ persister-tests
170+ custom-message-tests
171+ lightning-backtrace
172+ no-std-tests
173+ c-bindings-tests
174+ test-vectors
175+ lightning-invoice-serde
176+ no-std-check
177+ msrv-no-dev-deps-check
178+ no-std-check-arm
179+ taproot-tests
180+ simple-close-tests
181+ lsps1-service-tests
182+ peer-storage-tests
183+ )
184+
185+ # If a step name is passed, run just that step. Otherwise run all.
186+ if [ -n " $1 " ]; then
187+ run_step " $1 "
95188else
96- run_test " tx-sync test (esplora-blocking)" cargo test -p lightning-transaction-sync --verbose --color always --features esplora-blocking
97- run_test " tx-sync test (esplora-async)" cargo test -p lightning-transaction-sync --verbose --color always --features esplora-async
98- run_test " tx-sync test (esplora-async-https)" cargo test -p lightning-transaction-sync --verbose --color always --features esplora-async-https
99- run_test " tx-sync test (electrum)" cargo test -p lightning-transaction-sync --verbose --color always --features electrum
100- fi
101-
102- run_test " persister test (tokio)" cargo test -p lightning-persister --verbose --color always --features tokio
103- run_test " persister check (tokio)" cargo check -p lightning-persister --verbose --color always --features tokio
104- run_test " persister docs (tokio)" cargo doc -p lightning-persister --document-private-items --features tokio
105-
106- run_test " custom-message test" cargo test -p lightning-custom-message --verbose --color always
107- [ " $CI_MINIMIZE_DISK_USAGE " != " " ] && cargo clean
108-
109- run_test " lightning test (backtrace)" cargo test -p lightning --verbose --color always --features backtrace
110-
111- for DIR in lightning-invoice lightning-rapid-gossip-sync lightning-liquidity; do
112- run_test " $DIR test (no-std)" cargo test -p $DIR --verbose --color always --no-default-features
113- done
114-
115- run_test " lightning test (no-std)" cargo test -p lightning --verbose --color always --no-default-features
116- run_test " background-processor test (no-std)" cargo test -p lightning-background-processor --verbose --color always --no-default-features
117-
118- # Note that because `$RUSTFLAGS` is not passed through to doctest builds we cannot selectively
119- # disable doctests in `c_bindings` so we skip doctests entirely here.
120- run_test_with_flags " c_bindings test (workspace)" " --cfg=c_bindings" cargo test --verbose --color always --lib --bins --tests
121-
122- for DIR in lightning-invoice lightning-rapid-gossip-sync; do
123- # check if there is a conflict between no_std and the c_bindings cfg
124- run_test_with_flags " $DIR test (c_bindings+no-std)" " --cfg=c_bindings" cargo test -p $DIR --verbose --color always --no-default-features
125- done
126-
127- # Note that because `$RUSTFLAGS` is not passed through to doctest builds we cannot selectively
128- # disable doctests in `c_bindings` so we skip doctests entirely here.
129- run_test_with_flags " background-processor test (c_bindings+no-std)" " --cfg=c_bindings" cargo test -p lightning-background-processor --verbose --color always --no-default-features --lib --bins --tests
130- run_test_with_flags " lightning test (c_bindings+no-std)" " --cfg=c_bindings" cargo test -p lightning --verbose --color always --no-default-features --lib --bins --tests
131-
132- # Note that outbound_commitment_test only runs in this mode because of hardcoded signature values
133- run_test_with_flags " lightning test (test_vectors)" " --cfg=ldk_test_vectors" cargo test -p lightning --verbose --color always --no-default-features --features=std
134- # check that compile with no_std and serde works in lightning-invoice
135- run_test " lightning-invoice test (no-std+serde)" cargo test -p lightning-invoice --verbose --color always --no-default-features --features serde
136-
137- run_test " no-std-check" bash -c ' pushd no-std-check && cargo check --verbose --color always && popd'
138- [ " $CI_MINIMIZE_DISK_USAGE " != " " ] && (cd no-std-check && cargo clean)
139-
140- # Test that we can build downstream code with only the "release pins".
141- run_test " msrv-no-dev-deps-check" bash -c ' pushd msrv-no-dev-deps-check && cargo check && popd'
142- [ " $CI_MINIMIZE_DISK_USAGE " != " " ] && (cd msrv-no-dev-deps-check && cargo clean)
143-
144- if [ -f " $( which arm-none-eabi-gcc) " ]; then
145- run_test " no-std-check (ARM)" bash -c ' pushd no-std-check && cargo build --target=thumbv7m-none-eabi && popd'
146- [ " $CI_MINIMIZE_DISK_USAGE " != " " ] && (cd no-std-check && cargo clean)
189+ for step in " ${ALL_STEPS[@]} " ; do
190+ echo -e " \n\n=== Running step: $step ==="
191+ run_step " $step "
192+ done
147193fi
148-
149- run_test_with_flags " lightning test (taproot)" " --cfg=taproot" cargo test --verbose --color always -p lightning
150- [ " $CI_MINIMIZE_DISK_USAGE " != " " ] && cargo clean
151- run_test_with_flags " lightning test (simple_close)" " --cfg=simple_close" cargo test --verbose --color always -p lightning
152- [ " $CI_MINIMIZE_DISK_USAGE " != " " ] && cargo clean
153- run_test_with_flags " lightning-liquidity test (lsps1_service)" " --cfg=lsps1_service" cargo test --verbose --color always -p lightning-liquidity
154- [ " $CI_MINIMIZE_DISK_USAGE " != " " ] && cargo clean
155- run_test_with_flags " lightning test (peer_storage)" " --cfg=peer_storage" cargo test --verbose --color always -p lightning
0 commit comments