Skip to content

Commit d566539

Browse files
joostjagerclaude
andcommitted
Split ci-tests.sh into individual steps for better CI visibility
Refactor ci-tests.sh to support running individual test steps by name, allowing the GitHub Actions workflow to display each step separately. This provides clearer feedback when a specific test fails, as each step now appears as its own workflow step rather than being buried in one monolithic script run. The script now accepts an optional step name argument to run a single step, or runs all steps when no argument is provided. A verification step ensures all expected steps were executed. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent f43803d commit d566539

2 files changed

Lines changed: 156 additions & 5 deletions

File tree

.github/workflows/build.yml

Lines changed: 57 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,63 @@ jobs:
8888
run: |
8989
echo "BITCOIND_EXE=$( pwd )/bin/bitcoind-${{ runner.os }}-${{ runner.arch }}" >> "$GITHUB_ENV"
9090
echo "ELECTRS_EXE=$( pwd )/bin/electrs-${{ runner.os }}-${{ runner.arch }}" >> "$GITHUB_ENV"
91-
- name: Run CI script
92-
shell: bash # Default on Winblows is powershell
93-
run: CI_ENV=1 CI_MINIMIZE_DISK_USAGE=1 ./ci/ci-tests.sh
91+
- name: Check workspace (except lightning-transaction-sync)
92+
shell: bash
93+
run: CI_ENV=1 CI_MINIMIZE_DISK_USAGE=1 ./ci/ci-tests.sh check-workspace
94+
- name: Test workspace (except lightning-transaction-sync)
95+
shell: bash
96+
run: CI_ENV=1 CI_MINIMIZE_DISK_USAGE=1 ./ci/ci-tests.sh test-workspace
97+
- name: Test upgrade from prior LDK versions
98+
shell: bash
99+
run: CI_ENV=1 CI_MINIMIZE_DISK_USAGE=1 ./ci/ci-tests.sh test-ldk-upgrade
100+
- name: Check and build docs for workspace members
101+
shell: bash
102+
run: CI_ENV=1 CI_MINIMIZE_DISK_USAGE=1 ./ci/ci-tests.sh check-workspace-members
103+
- name: Test lightning with dnssec feature
104+
shell: bash
105+
run: CI_ENV=1 CI_MINIMIZE_DISK_USAGE=1 ./ci/ci-tests.sh test-lightning-dnssec
106+
- name: Test Block Sync Clients with features
107+
shell: bash
108+
run: CI_ENV=1 CI_MINIMIZE_DISK_USAGE=1 ./ci/ci-tests.sh test-lightning-block-sync
109+
- name: Check Transaction Sync Clients
110+
shell: bash
111+
run: CI_ENV=1 CI_MINIMIZE_DISK_USAGE=1 ./ci/ci-tests.sh check-lightning-transaction-sync
112+
- name: Test Transaction Sync Clients
113+
shell: bash
114+
run: CI_ENV=1 CI_MINIMIZE_DISK_USAGE=1 ./ci/ci-tests.sh test-lightning-transaction-sync
115+
- name: Test lightning-persister with tokio
116+
shell: bash
117+
run: CI_ENV=1 CI_MINIMIZE_DISK_USAGE=1 ./ci/ci-tests.sh test-lightning-persister
118+
- name: Test Custom Message Macros
119+
shell: bash
120+
run: CI_ENV=1 CI_MINIMIZE_DISK_USAGE=1 ./ci/ci-tests.sh test-lightning-custom-message
121+
- name: Test backtrace-debug builds
122+
shell: bash
123+
run: CI_ENV=1 CI_MINIMIZE_DISK_USAGE=1 ./ci/ci-tests.sh test-lightning-backtrace
124+
- name: Test no_std builds
125+
shell: bash
126+
run: CI_ENV=1 CI_MINIMIZE_DISK_USAGE=1 ./ci/ci-tests.sh test-no-std
127+
- name: Test c_bindings builds
128+
shell: bash
129+
run: CI_ENV=1 CI_MINIMIZE_DISK_USAGE=1 ./ci/ci-tests.sh test-c-bindings
130+
- name: Test other crate-specific builds
131+
shell: bash
132+
run: CI_ENV=1 CI_MINIMIZE_DISK_USAGE=1 ./ci/ci-tests.sh test-crate-specific
133+
- name: Check no_std downstream crate
134+
shell: bash
135+
run: CI_ENV=1 CI_MINIMIZE_DISK_USAGE=1 ./ci/ci-tests.sh check-no-std
136+
- name: Check MSRV with release pins only
137+
shell: bash
138+
run: CI_ENV=1 CI_MINIMIZE_DISK_USAGE=1 ./ci/ci-tests.sh check-msrv-no-dev-deps
139+
- name: Build no_std for ARM Embedded
140+
shell: bash
141+
run: CI_ENV=1 CI_MINIMIZE_DISK_USAGE=1 ./ci/ci-tests.sh build-no-std-arm
142+
- name: Test cfg-flag builds
143+
shell: bash
144+
run: CI_ENV=1 CI_MINIMIZE_DISK_USAGE=1 ./ci/ci-tests.sh test-cfg-flags
145+
- name: Verify all CI steps ran
146+
shell: bash
147+
run: ./ci/ci-tests.sh --verify-complete
94148

95149
coverage:
96150
needs: fuzz

ci/ci-tests.sh

Lines changed: 99 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,30 +24,89 @@ PIN_RELEASE_DEPS # pin the release dependencies in our main workspace
2424

2525
export 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

3056
WORKSPACE_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)
3283
echo -e "\n\nTesting the workspace, except lightning-transaction-sync."
3384
cargo test --quiet --color always
85+
;;
3486

87+
test-ldk-upgrade)
3588
echo -e "\n\nTesting upgrade from prior versions of LDK"
3689
pushd lightning-tests
3790
cargo test --quiet
3891
popd
92+
;;
3993

94+
check-workspace-members)
4095
echo -e "\n\nChecking and building docs for all workspace members individually..."
4196
for DIR in "${WORKSPACE_MEMBERS[@]}"; do
4297
cargo check -p "$DIR" --quiet --color always
4398
cargo doc -p "$DIR" --quiet --document-private-items
4499
done
100+
;;
45101

102+
test-lightning-dnssec)
46103
echo -e "\n\nChecking and testing lightning with features"
47104
cargo test -p lightning --quiet --color always --features dnssec
48105
cargo check -p lightning --quiet --color always --features dnssec
49106
cargo doc -p lightning --quiet --document-private-items --features dnssec
107+
;;
50108

109+
test-lightning-block-sync)
51110
echo -e "\n\nChecking and testing Block Sync Clients with features"
52111

53112
cargo 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,
58117
cargo check -p lightning-block-sync --quiet --color always --features rpc-client,rest-client
59118
cargo test -p lightning-block-sync --quiet --color always --features rpc-client,rest-client,tokio
60119
cargo check -p lightning-block-sync --quiet --color always --features rpc-client,rest-client,tokio
120+
;;
61121

122+
check-lightning-transaction-sync)
62123
echo -e "\n\nChecking Transaction Sync Clients with features."
63124
cargo check -p lightning-transaction-sync --quiet --color always --features esplora-blocking
64125
cargo check -p lightning-transaction-sync --quiet --color always --features esplora-async
65126
cargo check -p lightning-transaction-sync --quiet --color always --features esplora-async-https
66127
cargo check -p lightning-transaction-sync --quiet --color always --features electrum
128+
;;
67129

130+
test-lightning-transaction-sync)
68131
if [ -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
77140
fi
141+
;;
78142

143+
test-lightning-persister)
79144
echo -e "\n\nChecking and testing lightning-persister with features"
80145
cargo test -p lightning-persister --quiet --color always --features tokio
81146
cargo check -p lightning-persister --quiet --color always --features tokio
82147
cargo doc -p lightning-persister --quiet --document-private-items --features tokio
148+
;;
83149

150+
test-lightning-custom-message)
84151
echo -e "\n\nTest Custom Message Macros"
85152
cargo test -p lightning-custom-message --quiet --color always
86153
[ "$CI_MINIMIZE_DISK_USAGE" != "" ] && cargo clean
154+
;;
87155

156+
test-lightning-backtrace)
88157
echo -e "\n\nTest backtrace-debug builds"
89158
cargo test -p lightning --quiet --color always --features backtrace
159+
;;
90160

161+
test-no-std)
91162
echo -e "\n\nTesting no_std builds"
92163
for DIR in lightning-invoice lightning-rapid-gossip-sync lightning-liquidity; do
93164
cargo test -p $DIR --quiet --color always --no-default-features
94165
done
95166

96167
cargo test -p lightning --quiet --color always --no-default-features
97168
cargo test -p lightning-background-processor --quiet --color always --no-default-features
169+
;;
98170

171+
test-c-bindings)
99172
echo -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.
111184
RUSTFLAGS="$RUSTFLAGS --cfg=c_bindings" cargo test -p lightning-background-processor --quiet --color always --no-default-features --lib --bins --tests
112185
RUSTFLAGS="$RUSTFLAGS --cfg=c_bindings" cargo test -p lightning --quiet --color always --no-default-features --lib --bins --tests
186+
;;
113187

188+
test-crate-specific)
114189
echo -e "\n\nTesting other crate-specific builds"
115190
# Note that outbound_commitment_test only runs in this mode because of hardcoded signature values
116191
RUSTFLAGS="$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
119194
cargo test -p lightning-invoice --quiet --color always --no-default-features --features serde
195+
;;
120196

197+
check-no-std)
121198
echo -e "\n\nTesting no_std build on a downstream no-std crate"
122199
# check no-std compatibility across dependencies
123200
pushd no-std-check
124201
cargo check --quiet --color always
125202
[ "$CI_MINIMIZE_DISK_USAGE" != "" ] && cargo clean
126203
popd
204+
;;
127205

206+
check-msrv-no-dev-deps)
128207
# Test that we can build downstream code with only the "release pins".
129208
pushd msrv-no-dev-deps-check
130209
PIN_RELEASE_DEPS
131210
cargo check --quiet
132211
[ "$CI_MINIMIZE_DISK_USAGE" != "" ] && cargo clean
133212
popd
213+
;;
134214

215+
build-no-std-arm)
135216
if [ -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
140221
fi
222+
;;
141223

224+
test-cfg-flags)
142225
echo -e "\n\nTest cfg-flag builds"
143226
RUSTFLAGS="--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
147230
RUSTFLAGS="--cfg=lsps1_service" cargo test --quiet --color always -p lightning-liquidity
148231
[ "$CI_MINIMIZE_DISK_USAGE" != "" ] && cargo clean
149232
RUSTFLAGS="--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

Comments
 (0)