1 name: Continuous Integration Checks
3 on: [push, pull_request]
10 platform: [ ubuntu-latest ]
13 # 1.48.0 is the MSRV for all LDK crates except lightning-transaction-sync and Windows
23 platform: macos-latest
29 test-custom-message: true
31 platform: macos-latest
37 platform: windows-latest
43 platform: windows-latest
54 test-custom-message: true
59 runs-on: ${{ matrix.platform }}
61 - name: Checkout source code
62 uses: actions/checkout@v3
63 - name: Install Rust ${{ matrix.toolchain }} toolchain
64 uses: actions-rs/toolchain@v1
66 toolchain: ${{ matrix.toolchain }}
69 - name: Pin tokio to 1.14 for Rust 1.45
70 if: "matrix.build-net-old-tokio"
71 run: cargo update -p tokio --precise "1.14.0" --verbose
73 CARGO_NET_GIT_FETCH_WITH_CLI: "true"
74 - name: Pin tokio to 1.26 for Windows
75 if: "matrix.platform == 'windows-latest'"
76 run: cargo update -p tokio --precise "1.26.0" --verbose
78 CARGO_NET_GIT_FETCH_WITH_CLI: "true"
79 - name: Build on Rust ${{ matrix.toolchain }} with net-tokio
80 if: "matrix.build-net-tokio && !matrix.coverage"
81 run: cargo build --verbose --color always
82 - name: Build on Rust ${{ matrix.toolchain }} with net-tokio, and full code-linking for coverage generation
84 run: RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always
85 - name: Build on Rust ${{ matrix.toolchain }}
86 if: "! matrix.build-net-tokio"
88 cargo build --verbose --color always -p lightning
89 cargo build --verbose --color always -p lightning-invoice
90 cargo build --verbose --color always -p lightning-persister
91 - name: Build on Rust ${{ matrix.toolchain }} with all Log-Limiting features
92 if: matrix.test-log-variants
95 for FEATURE in $(cat Cargo.toml | grep '^max_level_' | awk '{ print $1 }'); do
96 cargo build --verbose --color always --features $FEATURE
98 - name: Build Block Sync Clients on Rust ${{ matrix.toolchain }} with features
99 if: "matrix.build-net-tokio && !matrix.coverage"
101 cd lightning-block-sync
102 cargo build --verbose --color always --features rest-client
103 cargo build --verbose --color always --features rpc-client
104 cargo build --verbose --color always --features rpc-client,rest-client
105 cargo build --verbose --color always --features rpc-client,rest-client,tokio
106 - name: Build Block Sync Clients on Rust ${{ matrix.toolchain }} with features and full code-linking for coverage generation
109 cd lightning-block-sync
110 RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always --features rest-client
111 RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always --features rpc-client
112 RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always --features rpc-client,rest-client
113 RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always --features rpc-client,rest-client,tokio
114 - name: Build Transaction Sync Clients on Rust ${{ matrix.toolchain }} with features
115 if: "matrix.build-tx-sync && !matrix.coverage"
117 cd lightning-transaction-sync
118 cargo build --verbose --color always --features esplora-blocking
119 cargo build --verbose --color always --features esplora-async
120 cargo build --verbose --color always --features esplora-async-https
121 - name: Build transaction sync clients on Rust ${{ matrix.toolchain }} with features and full code-linking for coverage generation
122 if: "matrix.build-tx-sync && matrix.coverage"
124 cd lightning-transaction-sync
125 RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always --features esplora-blocking
126 RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always --features esplora-async
127 RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always --features esplora-async-https
128 - name: Test transaction sync clients on Rust ${{ matrix.toolchain }} with features
129 if: "matrix.build-tx-sync"
131 cd lightning-transaction-sync
132 cargo test --verbose --color always --features esplora-blocking
133 cargo test --verbose --color always --features esplora-async
134 cargo test --verbose --color always --features esplora-async-https
135 - name: Test backtrace-debug builds on Rust ${{ matrix.toolchain }}
136 if: "matrix.toolchain == 'stable'"
137 shell: bash # Default on Winblows is powershell
139 cd lightning && RUST_BACKTRACE=1 cargo test --verbose --color always --features backtrace
140 - name: Test on Rust ${{ matrix.toolchain }} with net-tokio
141 if: "matrix.build-net-tokio && !matrix.coverage"
142 run: cargo test --verbose --color always
143 - name: Test on Rust ${{ matrix.toolchain }} with net-tokio, and full code-linking for coverage generation
145 run: RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always
146 - name: Test no-std builds on Rust ${{ matrix.toolchain }}
147 if: "matrix.build-no-std && !matrix.coverage"
148 shell: bash # Default on Winblows is powershell
150 for DIR in lightning lightning-invoice lightning-rapid-gossip-sync; do
152 cargo test --verbose --color always --no-default-features --features no-std
153 # check if there is a conflict between no-std and the default std feature
154 cargo test --verbose --color always --features no-std
155 # check that things still pass without grind_signatures
156 # note that outbound_commitment_test only runs in this mode, because of hardcoded signature values
157 cargo test --verbose --color always --no-default-features --features std
158 # check if there is a conflict between no-std and the c_bindings cfg
159 RUSTFLAGS="--cfg=c_bindings" cargo test --verbose --color always --no-default-features --features=no-std
162 # check no-std compatibility across dependencies
164 cargo check --verbose --color always --features lightning-transaction-sync
165 - name: Build no-std-check on Rust ${{ matrix.toolchain }} for ARM Embedded
166 if: "matrix.build-no-std && matrix.platform == 'ubuntu-latest'"
169 rustup target add thumbv7m-none-eabi
170 sudo apt-get -y install gcc-arm-none-eabi
171 cargo build --target=thumbv7m-none-eabi
172 - name: Test on no-std builds Rust ${{ matrix.toolchain }} and full code-linking for coverage generation
173 if: "matrix.build-no-std && matrix.coverage"
176 RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --no-default-features --features no-std
177 - name: Test futures builds on Rust ${{ matrix.toolchain }}
178 if: "matrix.build-futures && !matrix.coverage"
179 shell: bash # Default on Winblows is powershell
181 cd lightning-background-processor
182 cargo test --verbose --color always --no-default-features --features futures
183 - name: Test futures builds on Rust ${{ matrix.toolchain }} and full code-linking for coverage generation
184 if: "matrix.build-futures && matrix.coverage"
185 shell: bash # Default on Winblows is powershell
187 cd lightning-background-processor
188 RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --no-default-features --features futures
189 - name: Test on Rust ${{ matrix.toolchain }}
190 if: "! matrix.build-net-tokio"
192 cargo test --verbose --color always -p lightning
193 cargo test --verbose --color always -p lightning-invoice
194 cargo test --verbose --color always -p lightning-rapid-gossip-sync
195 cargo test --verbose --color always -p lightning-persister
196 cargo test --verbose --color always -p lightning-background-processor
197 - name: Test C Bindings Modifications on Rust ${{ matrix.toolchain }}
198 if: "! matrix.build-net-tokio"
200 RUSTFLAGS="--cfg=c_bindings" cargo test --verbose --color always -p lightning
201 RUSTFLAGS="--cfg=c_bindings" cargo test --verbose --color always -p lightning-invoice
202 RUSTFLAGS="--cfg=c_bindings" cargo build --verbose --color always -p lightning-persister
203 RUSTFLAGS="--cfg=c_bindings" cargo build --verbose --color always -p lightning-background-processor
204 - name: Test Block Sync Clients on Rust ${{ matrix.toolchain }} with features
205 if: "matrix.build-net-tokio && !matrix.coverage"
207 cd lightning-block-sync
208 cargo test --verbose --color always --features rest-client
209 cargo test --verbose --color always --features rpc-client
210 cargo test --verbose --color always --features rpc-client,rest-client
211 cargo test --verbose --color always --features rpc-client,rest-client,tokio
212 - name: Test Block Sync Clients on Rust ${{ matrix.toolchain }} with features and full code-linking for coverage generation
215 cd lightning-block-sync
216 RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --features rest-client
217 RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --features rpc-client
218 RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --features rpc-client,rest-client
219 RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --features rpc-client,rest-client,tokio
220 - name: Test Custom Message Macros on Rust ${{ matrix.toolchain }}
221 if: "matrix.test-custom-message"
223 cd lightning-custom-message
224 cargo test --verbose --color always
225 - name: Install deps for kcov
229 sudo apt-get -y install binutils-dev libcurl4-openssl-dev zlib1g-dev libdw-dev libiberty-dev
233 wget https://github.com/SimonKagstrom/kcov/archive/master.tar.gz
234 tar xzf master.tar.gz
235 cd kcov-master && mkdir build && cd build
238 make install DESTDIR=../../kcov-build
239 cd ../.. && rm -rf kcov-master master.tar.gz
240 - name: Generate coverage report
243 for file in target/debug/deps/lightning*; do
244 [ -x "${file}" ] || continue;
245 mkdir -p "target/cov/$(basename $file)";
246 ./kcov-build/usr/local/bin/kcov --exclude-pattern=/.cargo,/usr/lib --verify "target/cov/$(basename $file)" "$file";
248 - name: Upload coverage
250 uses: codecov/codecov-action@v3
252 # Could you use this to fake the coverage report for your PR? Sure.
253 # Will anyone be impressed by your amazing coverage? No
254 # Maybe if codecov wasn't broken we wouldn't need to do this...
255 token: f421b687-4dc2-4387-ac3d-dc3b2528af57
256 fail_ci_if_error: true
259 runs-on: ubuntu-latest
263 - name: Checkout source code
264 uses: actions/checkout@v3
265 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
266 uses: actions-rs/toolchain@v1
268 toolchain: ${{ env.TOOLCHAIN }}
271 - name: Cache routing graph snapshot
273 uses: actions/cache@v3
275 path: lightning/net_graph-2023-01-18.bin
276 key: ldk-net_graph-v0.0.113-2023-01-18.bin
277 - name: Fetch routing graph snapshot
278 if: steps.cache-graph.outputs.cache-hit != 'true'
280 curl --verbose -L -o lightning/net_graph-2023-01-18.bin https://bitcoin.ninja/ldk-net_graph-v0.0.113-2023-01-18.bin
281 echo "Sha sum: $(sha256sum lightning/net_graph-2023-01-18.bin | awk '{ print $1 }')"
282 if [ "$(sha256sum lightning/net_graph-2023-01-18.bin | awk '{ print $1 }')" != "${EXPECTED_ROUTING_GRAPH_SNAPSHOT_SHASUM}" ]; then
287 EXPECTED_ROUTING_GRAPH_SNAPSHOT_SHASUM: da6066f2bddcddbe7d8a6debbd53545697137b310bbb8c4911bc8c81fc5ff48c
288 - name: Fetch rapid graph sync reference input
290 curl --verbose -L -o lightning-rapid-gossip-sync/res/full_graph.lngossip https://bitcoin.ninja/ldk-compressed_graph-285cb27df79-2022-07-21.bin
291 echo "Sha sum: $(sha256sum lightning-rapid-gossip-sync/res/full_graph.lngossip | awk '{ print $1 }')"
292 if [ "$(sha256sum lightning-rapid-gossip-sync/res/full_graph.lngossip | awk '{ print $1 }')" != "${EXPECTED_RAPID_GOSSIP_SHASUM}" ]; then
297 EXPECTED_RAPID_GOSSIP_SHASUM: e0f5d11641c11896d7af3a2246d3d6c3f1720b7d2d17aab321ecce82e6b7deb8
298 - name: Test with Network Graph on Rust ${{ matrix.toolchain }}
301 RUSTFLAGS="--cfg=require_route_graph_test" cargo test
302 RUSTFLAGS="--cfg=require_route_graph_test" cargo test --features hashbrown
304 - name: Run benchmarks on Rust ${{ matrix.toolchain }}
306 RUSTC_BOOTSTRAP=1 cargo bench --features _bench_unstable
309 runs-on: ubuntu-latest
313 - name: Checkout source code
314 uses: actions/checkout@v3
317 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
318 uses: actions-rs/toolchain@v1
320 toolchain: ${{ env.TOOLCHAIN }}
323 - name: Fetch full tree and rebase on upstream
325 git remote add upstream https://github.com/lightningdevkit/rust-lightning
327 export GIT_COMMITTER_EMAIL="rl-ci@example.com"
328 export GIT_COMMITTER_NAME="RL CI"
329 git rebase upstream/main
330 - name: For each commit, run cargo check (including in fuzz)
331 run: ci/check-each-commit.sh upstream/main
334 runs-on: ubuntu-latest
338 - name: Checkout source code
339 uses: actions/checkout@v3
342 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
343 uses: actions-rs/toolchain@v1
345 toolchain: ${{ env.TOOLCHAIN }}
348 - name: Run cargo check for release build.
350 cargo check --release
351 cargo check --no-default-features --features=no-std --release
352 cargo check --no-default-features --features=futures --release
356 runs-on: ubuntu-latest
360 - name: Checkout source code
361 uses: actions/checkout@v3
362 - name: Install Rust 1.58 toolchain
363 uses: actions-rs/toolchain@v1
368 - name: Install dependencies for honggfuzz
371 sudo apt-get -y install build-essential binutils-dev libunwind-dev
372 - name: Sanity check fuzz targets on Rust ${{ env.TOOLCHAIN }}
373 run: cd fuzz && RUSTFLAGS="--cfg=fuzzing" cargo test --verbose --color always
375 run: cd fuzz && ./ci-fuzz.sh && cd ..
376 - name: Run lightning-invoice fuzzers
377 run: cd lightning-invoice/fuzz && RUSTFLAGS="--cfg=fuzzing" cargo test --verbose && ./ci-fuzz.sh
380 runs-on: ubuntu-latest
384 - name: Checkout source code
385 uses: actions/checkout@v3
386 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
387 uses: actions-rs/toolchain@v1
389 toolchain: ${{ env.TOOLCHAIN }}
392 - name: Install clippy
394 rustup component add clippy
395 - name: Run default clippy linting
397 cargo clippy -- -Aclippy::erasing_op -Aclippy::never_loop -Aclippy::if_same_then_else -Dclippy::try_err