1 name: Continuous Integration Checks
3 on: [push, pull_request]
10 platform: [ ubuntu-latest ]
13 # 1.41.1 is MSRV for Rust-Lightning, lightning-invoice, and lightning-persister
15 # 1.45.2 is MSRV for lightning-net-tokio, lightning-block-sync, lightning-background-processor
17 # 1.47.0 will be the MSRV for no-std builds using hashbrown once core2 is updated
27 platform: macos-latest
33 test-custom-message: true
35 platform: macos-latest
41 platform: windows-latest
47 platform: windows-latest
58 test-custom-message: true
61 test-log-variants: true
65 build-net-old-tokio: true
74 runs-on: ${{ matrix.platform }}
76 - name: Checkout source code
77 uses: actions/checkout@v3
78 - name: Install Rust ${{ matrix.toolchain }} toolchain
79 uses: actions-rs/toolchain@v1
81 toolchain: ${{ matrix.toolchain }}
84 - name: Pin tokio to 1.14 for Rust 1.45
85 if: "matrix.build-net-old-tokio"
86 run: cargo update -p tokio --precise "1.14.0" --verbose
88 CARGO_NET_GIT_FETCH_WITH_CLI: "true"
89 - name: Pin tokio to 1.26 for Windows
90 if: "matrix.platform == 'windows-latest'"
91 run: cargo update -p tokio --precise "1.26.0" --verbose
93 CARGO_NET_GIT_FETCH_WITH_CLI: "true"
94 - name: Build on Rust ${{ matrix.toolchain }} with net-tokio
95 if: "matrix.build-net-tokio && !matrix.coverage"
96 run: cargo build --verbose --color always
97 - name: Build on Rust ${{ matrix.toolchain }} with net-tokio, and full code-linking for coverage generation
99 run: RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always
100 - name: Build on Rust ${{ matrix.toolchain }}
101 if: "! matrix.build-net-tokio"
103 cargo build --verbose --color always -p lightning
104 cargo build --verbose --color always -p lightning-invoice
105 cargo build --verbose --color always -p lightning-persister
106 - name: Build on Rust ${{ matrix.toolchain }} with all Log-Limiting features
107 if: matrix.test-log-variants
110 for FEATURE in $(cat Cargo.toml | grep '^max_level_' | awk '{ print $1 }'); do
111 cargo build --verbose --color always --features $FEATURE
113 - name: Build Block Sync Clients on Rust ${{ matrix.toolchain }} with features
114 if: "matrix.build-net-tokio && !matrix.coverage"
116 cd lightning-block-sync
117 cargo build --verbose --color always --features rest-client
118 cargo build --verbose --color always --features rpc-client
119 cargo build --verbose --color always --features rpc-client,rest-client
120 cargo build --verbose --color always --features rpc-client,rest-client,tokio
121 - name: Build Block Sync Clients on Rust ${{ matrix.toolchain }} with features and full code-linking for coverage generation
124 cd lightning-block-sync
125 RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always --features rest-client
126 RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always --features rpc-client
127 RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always --features rpc-client,rest-client
128 RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always --features rpc-client,rest-client,tokio
129 - name: Build Transaction Sync Clients on Rust ${{ matrix.toolchain }} with features
130 if: "matrix.build-tx-sync && !matrix.coverage"
132 cd lightning-transaction-sync
133 cargo build --verbose --color always --features esplora-blocking
134 cargo build --verbose --color always --features esplora-async
135 cargo build --verbose --color always --features esplora-async-https
136 - name: Build transaction sync clients on Rust ${{ matrix.toolchain }} with features and full code-linking for coverage generation
137 if: "matrix.build-tx-sync && matrix.coverage"
139 cd lightning-transaction-sync
140 RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always --features esplora-blocking
141 RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always --features esplora-async
142 RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always --features esplora-async-https
143 - name: Test transaction sync clients on Rust ${{ matrix.toolchain }} with features
144 if: "matrix.build-tx-sync"
146 cd lightning-transaction-sync
147 cargo test --verbose --color always --features esplora-blocking
148 cargo test --verbose --color always --features esplora-async
149 cargo test --verbose --color always --features esplora-async-https
150 - name: Test backtrace-debug builds on Rust ${{ matrix.toolchain }}
151 if: "matrix.toolchain == 'stable'"
152 shell: bash # Default on Winblows is powershell
154 cd lightning && RUST_BACKTRACE=1 cargo test --verbose --color always --features backtrace
155 - name: Test on Rust ${{ matrix.toolchain }} with net-tokio
156 if: "matrix.build-net-tokio && !matrix.coverage"
157 run: cargo test --verbose --color always
158 - name: Test on Rust ${{ matrix.toolchain }} with net-tokio, and full code-linking for coverage generation
160 run: RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always
161 - name: Test no-std builds on Rust ${{ matrix.toolchain }}
162 if: "matrix.build-no-std && !matrix.coverage"
163 shell: bash # Default on Winblows is powershell
165 for DIR in lightning lightning-invoice lightning-rapid-gossip-sync; do
167 cargo test --verbose --color always --no-default-features --features no-std
168 # check if there is a conflict between no-std and the default std feature
169 cargo test --verbose --color always --features no-std
170 # check that things still pass without grind_signatures
171 # note that outbound_commitment_test only runs in this mode, because of hardcoded signature values
172 cargo test --verbose --color always --no-default-features --features std
173 # check if there is a conflict between no-std and the c_bindings cfg
174 RUSTFLAGS="--cfg=c_bindings" cargo test --verbose --color always --no-default-features --features=no-std
177 # check no-std compatibility across dependencies
179 cargo check --verbose --color always --features lightning-transaction-sync
180 - name: Build no-std-check on Rust ${{ matrix.toolchain }} for ARM Embedded
181 if: "matrix.build-no-std && matrix.platform == 'ubuntu-latest'"
184 rustup target add thumbv7m-none-eabi
185 sudo apt-get -y install gcc-arm-none-eabi
186 cargo build --target=thumbv7m-none-eabi
187 - name: Test on no-std builds Rust ${{ matrix.toolchain }} and full code-linking for coverage generation
188 if: "matrix.build-no-std && matrix.coverage"
191 RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --no-default-features --features no-std
192 - name: Test futures builds on Rust ${{ matrix.toolchain }}
193 if: "matrix.build-futures && !matrix.coverage"
194 shell: bash # Default on Winblows is powershell
196 cd lightning-background-processor
197 cargo test --verbose --color always --no-default-features --features futures
198 - name: Test futures builds on Rust ${{ matrix.toolchain }} and full code-linking for coverage generation
199 if: "matrix.build-futures && matrix.coverage"
200 shell: bash # Default on Winblows is powershell
202 cd lightning-background-processor
203 RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --no-default-features --features futures
204 - name: Test on Rust ${{ matrix.toolchain }}
205 if: "! matrix.build-net-tokio"
207 cargo test --verbose --color always -p lightning
208 cargo test --verbose --color always -p lightning-invoice
209 cargo test --verbose --color always -p lightning-rapid-gossip-sync
210 cargo test --verbose --color always -p lightning-persister
211 cargo test --verbose --color always -p lightning-background-processor
212 - name: Test C Bindings Modifications on Rust ${{ matrix.toolchain }}
213 if: "! matrix.build-net-tokio"
215 RUSTFLAGS="--cfg=c_bindings" cargo test --verbose --color always -p lightning
216 RUSTFLAGS="--cfg=c_bindings" cargo test --verbose --color always -p lightning-invoice
217 RUSTFLAGS="--cfg=c_bindings" cargo build --verbose --color always -p lightning-persister
218 RUSTFLAGS="--cfg=c_bindings" cargo build --verbose --color always -p lightning-background-processor
219 - name: Test Block Sync Clients on Rust ${{ matrix.toolchain }} with features
220 if: "matrix.build-net-tokio && !matrix.coverage"
222 cd lightning-block-sync
223 cargo test --verbose --color always --features rest-client
224 cargo test --verbose --color always --features rpc-client
225 cargo test --verbose --color always --features rpc-client,rest-client
226 cargo test --verbose --color always --features rpc-client,rest-client,tokio
227 - name: Test Block Sync Clients on Rust ${{ matrix.toolchain }} with features and full code-linking for coverage generation
230 cd lightning-block-sync
231 RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --features rest-client
232 RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --features rpc-client
233 RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --features rpc-client,rest-client
234 RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --features rpc-client,rest-client,tokio
235 - name: Test Custom Message Macros on Rust ${{ matrix.toolchain }}
236 if: "matrix.test-custom-message"
238 cd lightning-custom-message
239 cargo test --verbose --color always
240 - name: Install deps for kcov
244 sudo apt-get -y install binutils-dev libcurl4-openssl-dev zlib1g-dev libdw-dev libiberty-dev
248 wget https://github.com/SimonKagstrom/kcov/archive/master.tar.gz
249 tar xzf master.tar.gz
250 cd kcov-master && mkdir build && cd build
253 make install DESTDIR=../../kcov-build
254 cd ../.. && rm -rf kcov-master master.tar.gz
255 - name: Generate coverage report
258 for file in target/debug/deps/lightning*; do
259 [ -x "${file}" ] || continue;
260 mkdir -p "target/cov/$(basename $file)";
261 ./kcov-build/usr/local/bin/kcov --exclude-pattern=/.cargo,/usr/lib --verify "target/cov/$(basename $file)" "$file";
263 - name: Upload coverage
265 uses: codecov/codecov-action@v3
267 # Could you use this to fake the coverage report for your PR? Sure.
268 # Will anyone be impressed by your amazing coverage? No
269 # Maybe if codecov wasn't broken we wouldn't need to do this...
270 token: f421b687-4dc2-4387-ac3d-dc3b2528af57
271 fail_ci_if_error: true
274 runs-on: ubuntu-latest
278 - name: Checkout source code
279 uses: actions/checkout@v3
280 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
281 uses: actions-rs/toolchain@v1
283 toolchain: ${{ env.TOOLCHAIN }}
286 - name: Cache routing graph snapshot
288 uses: actions/cache@v3
290 path: lightning/net_graph-2023-01-18.bin
291 key: ldk-net_graph-v0.0.113-2023-01-18.bin
292 - name: Fetch routing graph snapshot
293 if: steps.cache-graph.outputs.cache-hit != 'true'
295 curl --verbose -L -o lightning/net_graph-2023-01-18.bin https://bitcoin.ninja/ldk-net_graph-v0.0.113-2023-01-18.bin
296 echo "Sha sum: $(sha256sum lightning/net_graph-2023-01-18.bin | awk '{ print $1 }')"
297 if [ "$(sha256sum lightning/net_graph-2023-01-18.bin | awk '{ print $1 }')" != "${EXPECTED_ROUTING_GRAPH_SNAPSHOT_SHASUM}" ]; then
302 EXPECTED_ROUTING_GRAPH_SNAPSHOT_SHASUM: da6066f2bddcddbe7d8a6debbd53545697137b310bbb8c4911bc8c81fc5ff48c
303 - name: Fetch rapid graph sync reference input
305 curl --verbose -L -o lightning-rapid-gossip-sync/res/full_graph.lngossip https://bitcoin.ninja/ldk-compressed_graph-285cb27df79-2022-07-21.bin
306 echo "Sha sum: $(sha256sum lightning-rapid-gossip-sync/res/full_graph.lngossip | awk '{ print $1 }')"
307 if [ "$(sha256sum lightning-rapid-gossip-sync/res/full_graph.lngossip | awk '{ print $1 }')" != "${EXPECTED_RAPID_GOSSIP_SHASUM}" ]; then
312 EXPECTED_RAPID_GOSSIP_SHASUM: e0f5d11641c11896d7af3a2246d3d6c3f1720b7d2d17aab321ecce82e6b7deb8
313 - name: Test with Network Graph on Rust ${{ matrix.toolchain }}
316 RUSTFLAGS="--cfg=require_route_graph_test" cargo test
317 RUSTFLAGS="--cfg=require_route_graph_test" cargo test --features hashbrown
319 - name: Run benchmarks on Rust ${{ matrix.toolchain }}
321 RUSTC_BOOTSTRAP=1 cargo bench --features _bench_unstable
324 runs-on: ubuntu-latest
328 - name: Checkout source code
329 uses: actions/checkout@v3
332 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
333 uses: actions-rs/toolchain@v1
335 toolchain: ${{ env.TOOLCHAIN }}
338 - name: Fetch full tree and rebase on upstream
340 git remote add upstream https://github.com/lightningdevkit/rust-lightning
342 export GIT_COMMITTER_EMAIL="rl-ci@example.com"
343 export GIT_COMMITTER_NAME="RL CI"
344 git rebase upstream/main
345 - name: For each commit, run cargo check (including in fuzz)
346 run: ci/check-each-commit.sh upstream/main
349 runs-on: ubuntu-latest
353 - name: Checkout source code
354 uses: actions/checkout@v3
357 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
358 uses: actions-rs/toolchain@v1
360 toolchain: ${{ env.TOOLCHAIN }}
363 - name: Run cargo check for release build.
365 cargo check --release
366 cargo check --no-default-features --features=no-std --release
367 cargo check --no-default-features --features=futures --release
371 runs-on: ubuntu-latest
375 - name: Checkout source code
376 uses: actions/checkout@v3
377 - name: Install Rust 1.58 toolchain
378 uses: actions-rs/toolchain@v1
383 - name: Install dependencies for honggfuzz
386 sudo apt-get -y install build-essential binutils-dev libunwind-dev
387 - name: Sanity check fuzz targets on Rust ${{ env.TOOLCHAIN }}
388 run: cd fuzz && RUSTFLAGS="--cfg=fuzzing" cargo test --verbose --color always
390 run: cd fuzz && ./ci-fuzz.sh && cd ..
391 - name: Run lightning-invoice fuzzers
392 run: cd lightning-invoice/fuzz && RUSTFLAGS="--cfg=fuzzing" cargo test --verbose && ./ci-fuzz.sh
395 runs-on: ubuntu-latest
399 - name: Checkout source code
400 uses: actions/checkout@v3
401 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
402 uses: actions-rs/toolchain@v1
404 toolchain: ${{ env.TOOLCHAIN }}
407 - name: Install clippy
409 rustup component add clippy
410 - name: Run default clippy linting
412 cargo clippy -- -Aclippy::erasing_op -Aclippy::never_loop -Aclippy::if_same_then_else -Dclippy::try_err