@@ -24,30 +24,89 @@ PIN_RELEASE_DEPS # pin the release dependencies in our main workspace
2424
2525export RUST_BACKTRACE=1
2626
27- echo -e " \n\nChecking the workspace, except lightning-transaction-sync."
28- cargo check --quiet --color always
27+ # All steps in order, matching the original script flow
28+ ALL_STEPS="
29+ check-workspace
30+ test-workspace
31+ test-ldk-upgrade
32+ check-workspace-members
33+ test-lightning-dnssec
34+ test-lightning-block-sync
35+ check-lightning-transaction-sync
36+ test-lightning-transaction-sync
37+ test-lightning-persister
38+ test-lightning-custom-message
39+ test-lightning-backtrace
40+ test-no-std
41+ test-c-bindings
42+ test-crate-specific
43+ check-no-std
44+ check-msrv-no-dev-deps
45+ build-no-std-arm
46+ test-cfg-flags
47+ "
48+
49+ # If a step name is passed, run just that step. Otherwise run all.
50+ if [ -n " $1 " ]; then
51+ STEPS_TO_RUN=" $1 "
52+ else
53+ STEPS_TO_RUN=" $ALL_STEPS "
54+ fi
2955
3056WORKSPACE_MEMBERS=( $( cat Cargo.toml | tr ' \n' ' \r' | sed ' s/\r //g' | tr ' \r' ' \n' | grep ' ^members =' | sed ' s/members.*=.*\[//' | tr -d ' "' | tr ' ,' ' ' ) )
3157
58+ # Verify that all steps were executed (called at the end of CI)
59+ if [ " $1 " = " --verify-complete" ]; then
60+ MISSING_STEPS=" "
61+ for STEP in $ALL_STEPS ; do
62+ if [[ ! " $CI_COMPLETED_STEPS " == * " $STEP " * ]]; then
63+ MISSING_STEPS=" $MISSING_STEPS $STEP "
64+ fi
65+ done
66+ if [ -n " $MISSING_STEPS " ]; then
67+ echo " ERROR: The following CI steps were not executed:$MISSING_STEPS "
68+ exit 1
69+ fi
70+ echo " All CI steps were executed successfully."
71+ exit 0
72+ fi
73+
74+ for STEP in $STEPS_TO_RUN ; do
75+ case " $STEP " in
76+
77+ check-workspace)
78+ echo -e " \n\nChecking the workspace, except lightning-transaction-sync."
79+ cargo check --quiet --color always
80+ ;;
81+
82+ test-workspace)
3283echo -e " \n\nTesting the workspace, except lightning-transaction-sync."
3384cargo test --quiet --color always
85+ ;;
3486
87+ test-ldk-upgrade)
3588echo -e " \n\nTesting upgrade from prior versions of LDK"
3689pushd lightning-tests
3790cargo test --quiet
3891popd
92+ ;;
3993
94+ check-workspace-members)
4095echo -e " \n\nChecking and building docs for all workspace members individually..."
4196for DIR in " ${WORKSPACE_MEMBERS[@]} " ; do
4297 cargo check -p " $DIR " --quiet --color always
4398 cargo doc -p " $DIR " --quiet --document-private-items
4499done
100+ ;;
45101
102+ test-lightning-dnssec)
46103echo -e " \n\nChecking and testing lightning with features"
47104cargo test -p lightning --quiet --color always --features dnssec
48105cargo check -p lightning --quiet --color always --features dnssec
49106cargo doc -p lightning --quiet --document-private-items --features dnssec
107+ ;;
50108
109+ test-lightning-block-sync)
51110echo -e " \n\nChecking and testing Block Sync Clients with features"
52111
53112cargo test -p lightning-block-sync --quiet --color always --features rest-client
@@ -58,13 +117,17 @@ cargo test -p lightning-block-sync --quiet --color always --features rpc-client,
58117cargo check -p lightning-block-sync --quiet --color always --features rpc-client,rest-client
59118cargo test -p lightning-block-sync --quiet --color always --features rpc-client,rest-client,tokio
60119cargo check -p lightning-block-sync --quiet --color always --features rpc-client,rest-client,tokio
120+ ;;
61121
122+ check-lightning-transaction-sync)
62123echo -e " \n\nChecking Transaction Sync Clients with features."
63124cargo check -p lightning-transaction-sync --quiet --color always --features esplora-blocking
64125cargo check -p lightning-transaction-sync --quiet --color always --features esplora-async
65126cargo check -p lightning-transaction-sync --quiet --color always --features esplora-async-https
66127cargo check -p lightning-transaction-sync --quiet --color always --features electrum
128+ ;;
67129
130+ test-lightning-transaction-sync)
68131if [ -z " $CI_ENV " ] && [[ -z " $BITCOIND_EXE " || -z " $ELECTRS_EXE " ]]; then
69132 echo -e " \n\nSkipping testing Transaction Sync Clients due to BITCOIND_EXE or ELECTRS_EXE being unset."
70133 cargo check -p lightning-transaction-sync --tests
@@ -75,27 +138,37 @@ else
75138 cargo test -p lightning-transaction-sync --quiet --color always --features esplora-async-https
76139 cargo test -p lightning-transaction-sync --quiet --color always --features electrum
77140fi
141+ ;;
78142
143+ test-lightning-persister)
79144echo -e " \n\nChecking and testing lightning-persister with features"
80145cargo test -p lightning-persister --quiet --color always --features tokio
81146cargo check -p lightning-persister --quiet --color always --features tokio
82147cargo doc -p lightning-persister --quiet --document-private-items --features tokio
148+ ;;
83149
150+ test-lightning-custom-message)
84151echo -e " \n\nTest Custom Message Macros"
85152cargo test -p lightning-custom-message --quiet --color always
86153[ " $CI_MINIMIZE_DISK_USAGE " != " " ] && cargo clean
154+ ;;
87155
156+ test-lightning-backtrace)
88157echo -e " \n\nTest backtrace-debug builds"
89158cargo test -p lightning --quiet --color always --features backtrace
159+ ;;
90160
161+ test-no-std)
91162echo -e " \n\nTesting no_std builds"
92163for DIR in lightning-invoice lightning-rapid-gossip-sync lightning-liquidity; do
93164 cargo test -p $DIR --quiet --color always --no-default-features
94165done
95166
96167cargo test -p lightning --quiet --color always --no-default-features
97168cargo test -p lightning-background-processor --quiet --color always --no-default-features
169+ ;;
98170
171+ test-c-bindings)
99172echo -e " \n\nTesting c_bindings builds"
100173# Note that because `$RUSTFLAGS` is not passed through to doctest builds we cannot selectively
101174# disable doctests in `c_bindings` so we skip doctests entirely here.
@@ -110,35 +183,45 @@ done
110183# disable doctests in `c_bindings` so we skip doctests entirely here.
111184RUSTFLAGS=" $RUSTFLAGS --cfg=c_bindings" cargo test -p lightning-background-processor --quiet --color always --no-default-features --lib --bins --tests
112185RUSTFLAGS=" $RUSTFLAGS --cfg=c_bindings" cargo test -p lightning --quiet --color always --no-default-features --lib --bins --tests
186+ ;;
113187
188+ test-crate-specific)
114189echo -e " \n\nTesting other crate-specific builds"
115190# Note that outbound_commitment_test only runs in this mode because of hardcoded signature values
116191RUSTFLAGS=" $RUSTFLAGS --cfg=ldk_test_vectors" cargo test -p lightning --quiet --color always --no-default-features --features=std
117192# This one only works for lightning-invoice
118193# check that compile with no_std and serde works in lightning-invoice
119194cargo test -p lightning-invoice --quiet --color always --no-default-features --features serde
195+ ;;
120196
197+ check-no-std)
121198echo -e " \n\nTesting no_std build on a downstream no-std crate"
122199# check no-std compatibility across dependencies
123200pushd no-std-check
124201cargo check --quiet --color always
125202[ " $CI_MINIMIZE_DISK_USAGE " != " " ] && cargo clean
126203popd
204+ ;;
127205
206+ check-msrv-no-dev-deps)
128207# Test that we can build downstream code with only the "release pins".
129208pushd msrv-no-dev-deps-check
130209PIN_RELEASE_DEPS
131210cargo check --quiet
132211[ " $CI_MINIMIZE_DISK_USAGE " != " " ] && cargo clean
133212popd
213+ ;;
134214
215+ build-no-std-arm)
135216if [ -f " $( which arm-none-eabi-gcc) " ]; then
136217 pushd no-std-check
137218 cargo build --quiet --target=thumbv7m-none-eabi
138219 [ " $CI_MINIMIZE_DISK_USAGE " != " " ] && cargo clean
139220 popd
140221fi
222+ ;;
141223
224+ test-cfg-flags)
142225echo -e " \n\nTest cfg-flag builds"
143226RUSTFLAGS=" --cfg=taproot" cargo test --quiet --color always -p lightning
144227[ " $CI_MINIMIZE_DISK_USAGE " != " " ] && cargo clean
@@ -147,3 +230,17 @@ RUSTFLAGS="--cfg=simple_close" cargo test --quiet --color always -p lightning
147230RUSTFLAGS=" --cfg=lsps1_service" cargo test --quiet --color always -p lightning-liquidity
148231[ " $CI_MINIMIZE_DISK_USAGE " != " " ] && cargo clean
149232RUSTFLAGS=" --cfg=peer_storage" cargo test --quiet --color always -p lightning
233+ ;;
234+
235+ * )
236+ echo " Unknown step: $STEP "
237+ exit 1
238+ ;;
239+
240+ esac
241+
242+ # Log the completed step to GITHUB_ENV for the verification step
243+ if [ -n " $GITHUB_ENV " ]; then
244+ echo " CI_COMPLETED_STEPS=${CI_COMPLETED_STEPS:- } $STEP " >> " $GITHUB_ENV "
245+ fi
246+ done
0 commit comments