Skip to content

Commit 4a16151

Browse files
committed
Replace the bulk of CI with a (much simpler) bash script
1 parent 28cc71f commit 4a16151

File tree

2 files changed

+109
-153
lines changed

2 files changed

+109
-153
lines changed

.github/workflows/build.yml

+18-153
Original file line numberDiff line numberDiff line change
@@ -7,35 +7,21 @@ jobs:
77
strategy:
88
fail-fast: false
99
matrix:
10-
platform: [ ubuntu-latest ]
11-
toolchain: [ stable,
12-
beta,
13-
# 1.48.0 is the MSRV for all LDK crates except lightning-transaction-sync and Windows
14-
1.48.0]
10+
platform: [ ubuntu-latest, windows-latest, macos-latest ]
11+
toolchain: [ stable, beta ]
1512
include:
1613
- toolchain: stable
17-
build-tx-sync: true
14+
platform: ubuntu-latest
1815
coverage: true
19-
- toolchain: stable
20-
platform: macos-latest
21-
build-tx-sync: true
22-
- toolchain: stable
23-
test-custom-message: true
24-
- toolchain: beta
25-
platform: macos-latest
26-
build-tx-sync: true
27-
- toolchain: stable
28-
platform: windows-latest
29-
build-tx-sync: false
30-
- toolchain: beta
31-
platform: windows-latest
32-
build-tx-sync: false
33-
- toolchain: beta
34-
build-tx-sync: true
35-
- toolchain: beta
36-
test-custom-message: true
16+
# 1.48.0 is the MSRV for all crates except lightning-transaction-sync and Win/Mac
3717
- toolchain: 1.48.0
38-
build-tx-sync: false
18+
platform: ubuntu-latest
19+
# Windows requires 1.49.0 because that's the MSRV for supported Tokio
20+
- toolchain: 1.49.0
21+
platform: windows-latest
22+
# MacOS-latest requires 1.54.0 because that's what's required for linking to work properly
23+
- toolchain: 1.54.0
24+
platform: macos-latest
3925
runs-on: ${{ matrix.platform }}
4026
steps:
4127
- name: Checkout source code
@@ -46,140 +32,19 @@ jobs:
4632
toolchain: ${{ matrix.toolchain }}
4733
override: true
4834
profile: minimal
49-
- name: Pin tokio to 1.14 for Rust 1.45
50-
run: cargo update -p tokio --precise "1.14.0" --verbose
51-
env:
52-
CARGO_NET_GIT_FETCH_WITH_CLI: "true"
53-
- name: Pin tokio to 1.26 for Windows
54-
if: "matrix.platform == 'windows-latest'"
55-
run: cargo update -p tokio --precise "1.26.0" --verbose
56-
env:
57-
CARGO_NET_GIT_FETCH_WITH_CLI: "true"
58-
- name: Build on Rust ${{ matrix.toolchain }} with net-tokio
59-
if: "!matrix.coverage"
60-
run: cargo build --verbose --color always
61-
- name: Build on Rust ${{ matrix.toolchain }} with net-tokio, and full code-linking for coverage generation
62-
if: matrix.coverage
63-
run: RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always
64-
- name: Build on Rust ${{ matrix.toolchain }} with all Log-Limiting features
65-
if: matrix.test-log-variants
66-
run: |
67-
cd lightning
68-
for FEATURE in $(cat Cargo.toml | grep '^max_level_' | awk '{ print $1 }'); do
69-
cargo build --verbose --color always --features $FEATURE
70-
done
71-
- name: Build Block Sync Clients on Rust ${{ matrix.toolchain }} with features
72-
if: "!matrix.coverage"
73-
run: |
74-
cd lightning-block-sync
75-
cargo build --verbose --color always --features rest-client
76-
cargo build --verbose --color always --features rpc-client
77-
cargo build --verbose --color always --features rpc-client,rest-client
78-
cargo build --verbose --color always --features rpc-client,rest-client,tokio
79-
- name: Build Block Sync Clients on Rust ${{ matrix.toolchain }} with features and full code-linking for coverage generation
80-
if: matrix.coverage
81-
run: |
82-
cd lightning-block-sync
83-
RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always --features rest-client
84-
RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always --features rpc-client
85-
RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always --features rpc-client,rest-client
86-
RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always --features rpc-client,rest-client,tokio
87-
- name: Build Transaction Sync Clients on Rust ${{ matrix.toolchain }} with features
88-
if: "matrix.build-tx-sync && !matrix.coverage"
89-
run: |
90-
cd lightning-transaction-sync
91-
cargo build --verbose --color always --features esplora-blocking
92-
cargo build --verbose --color always --features esplora-async
93-
cargo build --verbose --color always --features esplora-async-https
94-
- name: Build transaction sync clients on Rust ${{ matrix.toolchain }} with features and full code-linking for coverage generation
95-
if: "matrix.build-tx-sync && matrix.coverage"
96-
run: |
97-
cd lightning-transaction-sync
98-
RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always --features esplora-blocking
99-
RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always --features esplora-async
100-
RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always --features esplora-async-https
101-
- name: Test transaction sync clients on Rust ${{ matrix.toolchain }} with features
102-
if: "matrix.build-tx-sync"
103-
run: |
104-
cd lightning-transaction-sync
105-
cargo test --verbose --color always --features esplora-blocking
106-
cargo test --verbose --color always --features esplora-async
107-
cargo test --verbose --color always --features esplora-async-https
108-
- name: Test backtrace-debug builds on Rust ${{ matrix.toolchain }}
109-
if: "matrix.toolchain == 'stable'"
110-
shell: bash # Default on Winblows is powershell
111-
run: |
112-
cd lightning && RUST_BACKTRACE=1 cargo test --verbose --color always --features backtrace
113-
- name: Test on Rust ${{ matrix.toolchain }} with net-tokio
114-
if: "!matrix.coverage"
115-
run: cargo test --verbose --color always
116-
- name: Test on Rust ${{ matrix.toolchain }} with net-tokio, and full code-linking for coverage generation
117-
if: matrix.coverage
118-
run: RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always
119-
- name: Test no-std builds on Rust ${{ matrix.toolchain }}
120-
if: "!matrix.coverage"
121-
shell: bash # Default on Winblows is powershell
122-
run: |
123-
for DIR in lightning lightning-invoice lightning-rapid-gossip-sync; do
124-
cd $DIR
125-
cargo test --verbose --color always --no-default-features --features no-std
126-
# check if there is a conflict between no-std and the default std feature
127-
cargo test --verbose --color always --features no-std
128-
# check that things still pass without grind_signatures
129-
# note that outbound_commitment_test only runs in this mode, because of hardcoded signature values
130-
cargo test --verbose --color always --no-default-features --features std
131-
# check if there is a conflict between no-std and the c_bindings cfg
132-
RUSTFLAGS="--cfg=c_bindings" cargo test --verbose --color always --no-default-features --features=no-std
133-
cd ..
134-
done
135-
# check no-std compatibility across dependencies
136-
cd no-std-check
137-
cargo check --verbose --color always --features lightning-transaction-sync
138-
- name: Build no-std-check on Rust ${{ matrix.toolchain }} for ARM Embedded
35+
- name: Install no-std-check dependencies for ARM Embedded
13936
if: "matrix.platform == 'ubuntu-latest'"
14037
run: |
141-
cd no-std-check
14238
rustup target add thumbv7m-none-eabi
14339
sudo apt-get -y install gcc-arm-none-eabi
144-
cargo build --target=thumbv7m-none-eabi
145-
- name: Test on no-std builds Rust ${{ matrix.toolchain }} and full code-linking for coverage generation
146-
if: "matrix.coverage"
147-
run: |
148-
cd lightning
149-
RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --no-default-features --features no-std
150-
- name: Test futures builds on Rust ${{ matrix.toolchain }}
151-
if: "!matrix.coverage"
152-
shell: bash # Default on Winblows is powershell
153-
run: |
154-
cd lightning-background-processor
155-
cargo test --verbose --color always --no-default-features --features futures
156-
- name: Test futures builds on Rust ${{ matrix.toolchain }} and full code-linking for coverage generation
157-
if: "matrix.coverage"
40+
- name: Run CI script with coverage generation
41+
if: matrix.coverage
15842
shell: bash # Default on Winblows is powershell
159-
run: |
160-
cd lightning-background-processor
161-
RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --no-default-features --features futures
162-
- name: Test Block Sync Clients on Rust ${{ matrix.toolchain }} with features
43+
run: LDK_COVERAGE_BUILD=true ./ci/ci-tests.sh
44+
- name: Run CI script
16345
if: "!matrix.coverage"
164-
run: |
165-
cd lightning-block-sync
166-
cargo test --verbose --color always --features rest-client
167-
cargo test --verbose --color always --features rpc-client
168-
cargo test --verbose --color always --features rpc-client,rest-client
169-
cargo test --verbose --color always --features rpc-client,rest-client,tokio
170-
- name: Test Block Sync Clients on Rust ${{ matrix.toolchain }} with features and full code-linking for coverage generation
171-
if: matrix.coverage
172-
run: |
173-
cd lightning-block-sync
174-
RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --features rest-client
175-
RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --features rpc-client
176-
RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --features rpc-client,rest-client
177-
RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --features rpc-client,rest-client,tokio
178-
- name: Test Custom Message Macros on Rust ${{ matrix.toolchain }}
179-
if: "matrix.test-custom-message"
180-
run: |
181-
cd lightning-custom-message
182-
cargo test --verbose --color always
46+
shell: bash # Default on Winblows is powershell
47+
run: ./ci/ci-tests.sh
18348
- name: Install deps for kcov
18449
if: matrix.coverage
18550
run: |

ci/ci-tests.sh

+91
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
#!/bin/bash
2+
set -eox pipefail
3+
4+
RUSTC_MINOR_VERSION=$(rustc --version | awk '{ split($2,a,"."); print a[2] }')
5+
HOST_PLATFORM="$(rustc --version --verbose | grep "host:" | awk '{ print $2 }')"
6+
7+
# Tokio MSRV on versions newer than 1.14 is rustc 1.49
8+
[ $RUSTC_MINOR_VERSION -lt 49 ] && cargo update -p tokio --precise "1.14.0" --verbose
9+
[ "$LDK_COVERAGE_BUILD" != "" ] && export RUSTFLAGS="-C link-dead-code"
10+
11+
export RUST_BACKTRACE=1
12+
13+
echo -e "\n\nBuilding and testing all workspace crates..."
14+
cargo build --verbose --color always
15+
cargo test --verbose --color always
16+
17+
echo -e "\n\nBuilding with all Log-Limiting features"
18+
pushd lightning
19+
for FEATURE in $(cat Cargo.toml | grep '^max_level_' | awk '{ print $1 }'); do
20+
cargo build --verbose --color always --features $FEATURE
21+
done
22+
popd
23+
24+
if [ $RUSTC_MINOR_VERSION -gt 51 ]; then # Current `object` MSRV, subject to change
25+
echo -e "\n\nTest backtrace-debug builds"
26+
pushd lightning
27+
cargo test --verbose --color always --features backtrace
28+
popd
29+
fi
30+
31+
echo -e "\n\nTesting no-std flags in various combinations"
32+
for DIR in lightning lightning-invoice lightning-rapid-gossip-sync; do
33+
pushd $DIR
34+
cargo test --verbose --color always --no-default-features --features no-std
35+
# check if there is a conflict between no-std and the default std feature
36+
cargo test --verbose --color always --features no-std
37+
# check that things still pass without grind_signatures
38+
# note that outbound_commitment_test only runs in this mode, because of hardcoded signature values
39+
cargo test --verbose --color always --no-default-features --features std
40+
# check if there is a conflict between no-std and the c_bindings cfg
41+
RUSTFLAGS="--cfg=c_bindings" cargo test --verbose --color always --no-default-features --features=no-std
42+
popd
43+
done
44+
45+
echo -e "\n\nTesting no-std build on a downstream no-std crate"
46+
# check no-std compatibility across dependencies
47+
pushd no-std-check
48+
cargo check --verbose --color always --features lightning-transaction-sync
49+
popd
50+
51+
if [ -f "$(which arm-none-eabi-gcc)" ]; then
52+
pushd no-std-check
53+
cargo build --target=thumbv7m-none-eabi
54+
popd
55+
fi
56+
57+
echo -e "\n\nBuilding and testing Block Sync Clients with features"
58+
pushd lightning-block-sync
59+
cargo build --verbose --color always --features rest-client
60+
cargo test --verbose --color always --features rest-client
61+
cargo build --verbose --color always --features rpc-client
62+
cargo test --verbose --color always --features rpc-client
63+
cargo build --verbose --color always --features rpc-client,rest-client
64+
cargo test --verbose --color always --features rpc-client,rest-client
65+
cargo build --verbose --color always --features rpc-client,rest-client,tokio
66+
cargo test --verbose --color always --features rpc-client,rest-client,tokio
67+
popd
68+
69+
if [ $RUSTC_MINOR_VERSION -gt 67 ]; then
70+
echo -e "\n\nBuilding and testing Transaction Sync Clients with features"
71+
pushd lightning-transaction-sync
72+
cargo build --verbose --color always --features esplora-blocking
73+
cargo test --verbose --color always --features esplora-blocking
74+
cargo build --verbose --color always --features esplora-async
75+
cargo test --verbose --color always --features esplora-async
76+
cargo build --verbose --color always --features esplora-async-https
77+
cargo test --verbose --color always --features esplora-async-https
78+
popd
79+
fi
80+
81+
echo -e "\n\nTest futures builds"
82+
pushd lightning-background-processor
83+
cargo test --verbose --color always --no-default-features --features futures
84+
popd
85+
86+
if [ $RUSTC_MINOR_VERSION -gt 55 ]; then
87+
echo -e "\n\nTest Custom Message Macros"
88+
pushd lightning-custom-message
89+
cargo test --verbose --color always
90+
popd
91+
fi

0 commit comments

Comments
 (0)