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
19 # 1.59.0 is the MSRV for lightning-transaction-sync
29 platform: macos-latest
35 test-custom-message: true
37 platform: macos-latest
43 platform: windows-latest
49 platform: windows-latest
60 test-custom-message: true
63 test-log-variants: true
67 build-net-old-tokio: true
77 build-net-tokio: false
81 runs-on: ${{ matrix.platform }}
83 - name: Checkout source code
84 uses: actions/checkout@v3
85 - name: Install Rust ${{ matrix.toolchain }} toolchain
86 uses: actions-rs/toolchain@v1
88 toolchain: ${{ matrix.toolchain }}
91 - name: Pin tokio to 1.14 for Rust 1.45
92 if: "matrix.build-net-old-tokio"
93 run: cargo update -p tokio --precise "1.14.0" --verbose
95 CARGO_NET_GIT_FETCH_WITH_CLI: "true"
96 - name: Build on Rust ${{ matrix.toolchain }} with net-tokio and tx-sync
97 if: "matrix.build-net-tokio && !matrix.coverage && matrix.build-tx-sync"
98 run: cargo build --verbose --color always
99 - name: Build on Rust ${{ matrix.toolchain }} with net-tokio, tx-sync, and full code-linking for coverage generation
101 run: RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always
102 - name: Build on Rust ${{ matrix.toolchain }}
103 if: "! matrix.build-net-tokio"
105 cargo build --verbose --color always -p lightning
106 cargo build --verbose --color always -p lightning-invoice
107 cargo build --verbose --color always -p lightning-persister
108 - name: Build on Rust ${{ matrix.toolchain }} with all Log-Limiting features
109 if: matrix.test-log-variants
112 for FEATURE in $(cat Cargo.toml | grep '^max_level_' | awk '{ print $1 }'); do
113 cargo build --verbose --color always --features $FEATURE
115 - name: Build Block Sync Clients on Rust ${{ matrix.toolchain }} with features
116 if: "matrix.build-net-tokio && !matrix.coverage"
118 cd lightning-block-sync
119 cargo build --verbose --color always --features rest-client
120 cargo build --verbose --color always --features rpc-client
121 cargo build --verbose --color always --features rpc-client,rest-client
122 cargo build --verbose --color always --features rpc-client,rest-client,tokio
123 - name: Build Block Sync Clients on Rust ${{ matrix.toolchain }} with features and full code-linking for coverage generation
126 cd lightning-block-sync
127 RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always --features rest-client
128 RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always --features rpc-client
129 RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always --features rpc-client,rest-client
130 RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always --features rpc-client,rest-client,tokio
131 - name: Build Transaction Sync Clients on Rust ${{ matrix.toolchain }} with features
132 if: "matrix.build-tx-sync && !matrix.coverage"
134 cd lightning-transaction-sync
135 cargo build --verbose --color always --features esplora-blocking
136 cargo build --verbose --color always --features esplora-async
137 - name: Build transaction sync clients on Rust ${{ matrix.toolchain }} with features and full code-linking for coverage generation
138 if: "matrix.build-tx-sync && matrix.coverage"
140 cd lightning-transaction-sync
141 RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always --features esplora-blocking
142 RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always --features esplora-async
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 - name: Test backtrace-debug builds on Rust ${{ matrix.toolchain }}
150 if: "matrix.toolchain == 'stable'"
152 cd lightning && cargo test --verbose --color always --features backtrace
153 - name: Test on Rust ${{ matrix.toolchain }} with net-tokio
154 if: "matrix.build-net-tokio && !matrix.coverage && matrix.build-tx-sync"
155 run: cargo test --verbose --color always
156 - name: Test on Rust ${{ matrix.toolchain }} with net-tokio, tx-sync, and full code-linking for coverage generation
158 run: RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always
159 - name: Test no-std builds on Rust ${{ matrix.toolchain }}
160 if: "matrix.build-no-std && !matrix.coverage"
161 shell: bash # Default on Winblows is powershell
163 for DIR in lightning lightning-invoice lightning-rapid-gossip-sync; do
165 cargo test --verbose --color always --no-default-features --features no-std
166 # check if there is a conflict between no-std and the default std feature
167 cargo test --verbose --color always --features no-std
168 # check that things still pass without grind_signatures
169 # note that outbound_commitment_test only runs in this mode, because of hardcoded signature values
170 cargo test --verbose --color always --no-default-features --features std
171 # check if there is a conflict between no-std and the c_bindings cfg
172 RUSTFLAGS="--cfg=c_bindings" cargo test --verbose --color always --no-default-features --features=no-std
175 # check no-std compatibility across dependencies
177 cargo check --verbose --color always
178 - name: Build no-std-check on Rust ${{ matrix.toolchain }} for ARM Embedded
179 if: "matrix.build-no-std && matrix.platform == 'ubuntu-latest'"
182 rustup target add thumbv7m-none-eabi
183 sudo apt-get -y install gcc-arm-none-eabi
184 cargo build --target=thumbv7m-none-eabi
185 - name: Test on no-std builds Rust ${{ matrix.toolchain }} and full code-linking for coverage generation
186 if: "matrix.build-no-std && matrix.coverage"
189 RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --no-default-features --features no-std
190 - name: Test futures builds on Rust ${{ matrix.toolchain }}
191 if: "matrix.build-futures && !matrix.coverage"
192 shell: bash # Default on Winblows is powershell
194 cd lightning-background-processor
195 cargo test --verbose --color always --no-default-features --features futures
196 - name: Test futures builds on Rust ${{ matrix.toolchain }} and full code-linking for coverage generation
197 if: "matrix.build-futures && matrix.coverage"
198 shell: bash # Default on Winblows is powershell
200 cd lightning-background-processor
201 RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --no-default-features --features futures
202 - name: Test on Rust ${{ matrix.toolchain }}
203 if: "! matrix.build-net-tokio"
205 cargo test --verbose --color always -p lightning
206 cargo test --verbose --color always -p lightning-invoice
207 cargo test --verbose --color always -p lightning-rapid-gossip-sync
208 cargo test --verbose --color always -p lightning-persister
209 cargo test --verbose --color always -p lightning-background-processor
210 - name: Test C Bindings Modifications on Rust ${{ matrix.toolchain }}
211 if: "! matrix.build-net-tokio"
213 RUSTFLAGS="--cfg=c_bindings" cargo test --verbose --color always -p lightning
214 RUSTFLAGS="--cfg=c_bindings" cargo test --verbose --color always -p lightning-invoice
215 RUSTFLAGS="--cfg=c_bindings" cargo build --verbose --color always -p lightning-persister
216 RUSTFLAGS="--cfg=c_bindings" cargo build --verbose --color always -p lightning-background-processor
217 - name: Test Block Sync Clients on Rust ${{ matrix.toolchain }} with features
218 if: "matrix.build-net-tokio && !matrix.coverage"
220 cd lightning-block-sync
221 cargo test --verbose --color always --features rest-client
222 cargo test --verbose --color always --features rpc-client
223 cargo test --verbose --color always --features rpc-client,rest-client
224 cargo test --verbose --color always --features rpc-client,rest-client,tokio
225 - name: Test Block Sync Clients on Rust ${{ matrix.toolchain }} with features and full code-linking for coverage generation
228 cd lightning-block-sync
229 RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --features rest-client
230 RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --features rpc-client
231 RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --features rpc-client,rest-client
232 RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --features rpc-client,rest-client,tokio
233 - name: Test Custom Message Macros on Rust ${{ matrix.toolchain }}
234 if: "matrix.test-custom-message"
236 cd lightning-custom-message
237 cargo test --verbose --color always
238 - name: Install deps for kcov
242 sudo apt-get -y install binutils-dev libcurl4-openssl-dev zlib1g-dev libdw-dev libiberty-dev
246 wget https://github.com/SimonKagstrom/kcov/archive/master.tar.gz
247 tar xzf master.tar.gz
248 cd kcov-master && mkdir build && cd build
251 make install DESTDIR=../../kcov-build
252 cd ../.. && rm -rf kcov-master master.tar.gz
253 - name: Generate coverage report
256 for file in target/debug/deps/lightning*; do
257 [ -x "${file}" ] || continue;
258 mkdir -p "target/cov/$(basename $file)";
259 ./kcov-build/usr/local/bin/kcov --exclude-pattern=/.cargo,/usr/lib --verify "target/cov/$(basename $file)" "$file";
261 - name: Upload coverage
263 uses: codecov/codecov-action@v3
265 # Could you use this to fake the coverage report for your PR? Sure.
266 # Will anyone be impressed by your amazing coverage? No
267 # Maybe if codecov wasn't broken we wouldn't need to do this...
268 token: f421b687-4dc2-4387-ac3d-dc3b2528af57
269 fail_ci_if_error: true
272 runs-on: ubuntu-latest
276 - name: Checkout source code
277 uses: actions/checkout@v3
278 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
279 uses: actions-rs/toolchain@v1
281 toolchain: ${{ env.TOOLCHAIN }}
284 - name: Cache routing graph snapshot
286 uses: actions/cache@v3
288 path: lightning/net_graph-2023-01-18.bin
289 key: ldk-net_graph-v0.0.113-2023-01-18.bin
290 - name: Fetch routing graph snapshot
291 if: steps.cache-graph.outputs.cache-hit != 'true'
293 curl --verbose -L -o lightning/net_graph-2023-01-18.bin https://bitcoin.ninja/ldk-net_graph-v0.0.113-2023-01-18.bin
294 echo "Sha sum: $(sha256sum lightning/net_graph-2023-01-18.bin | awk '{ print $1 }')"
295 if [ "$(sha256sum lightning/net_graph-2023-01-18.bin | awk '{ print $1 }')" != "${EXPECTED_ROUTING_GRAPH_SNAPSHOT_SHASUM}" ]; then
300 EXPECTED_ROUTING_GRAPH_SNAPSHOT_SHASUM: da6066f2bddcddbe7d8a6debbd53545697137b310bbb8c4911bc8c81fc5ff48c
301 - name: Fetch rapid graph sync reference input
303 curl --verbose -L -o lightning-rapid-gossip-sync/res/full_graph.lngossip https://bitcoin.ninja/ldk-compressed_graph-285cb27df79-2022-07-21.bin
304 echo "Sha sum: $(sha256sum lightning-rapid-gossip-sync/res/full_graph.lngossip | awk '{ print $1 }')"
305 if [ "$(sha256sum lightning-rapid-gossip-sync/res/full_graph.lngossip | awk '{ print $1 }')" != "${EXPECTED_RAPID_GOSSIP_SHASUM}" ]; then
310 EXPECTED_RAPID_GOSSIP_SHASUM: e0f5d11641c11896d7af3a2246d3d6c3f1720b7d2d17aab321ecce82e6b7deb8
311 - name: Test with Network Graph on Rust ${{ matrix.toolchain }}
314 RUSTFLAGS="--cfg=require_route_graph_test" cargo test
315 RUSTFLAGS="--cfg=require_route_graph_test" cargo test --features hashbrown
317 - name: Run benchmarks on Rust ${{ matrix.toolchain }}
319 RUSTC_BOOTSTRAP=1 cargo bench --features _bench_unstable
322 runs-on: ubuntu-latest
326 - name: Checkout source code
327 uses: actions/checkout@v3
330 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
331 uses: actions-rs/toolchain@v1
333 toolchain: ${{ env.TOOLCHAIN }}
336 - name: Fetch full tree and rebase on upstream
338 git remote add upstream https://github.com/lightningdevkit/rust-lightning
340 export GIT_COMMITTER_EMAIL="rl-ci@example.com"
341 export GIT_COMMITTER_NAME="RL CI"
342 git rebase upstream/main
343 - name: For each commit, run cargo check (including in fuzz)
344 run: ci/check-each-commit.sh upstream/main
347 runs-on: ubuntu-latest
351 - name: Checkout source code
352 uses: actions/checkout@v3
355 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
356 uses: actions-rs/toolchain@v1
358 toolchain: ${{ env.TOOLCHAIN }}
361 - name: Run cargo check for release build.
363 cargo check --release
364 cargo check --no-default-features --features=no-std --release
365 cargo check --no-default-features --features=futures --release
369 runs-on: ubuntu-latest
373 - name: Checkout source code
374 uses: actions/checkout@v3
375 - name: Install Rust 1.58 toolchain
376 uses: actions-rs/toolchain@v1
381 - name: Install dependencies for honggfuzz
384 sudo apt-get -y install build-essential binutils-dev libunwind-dev
385 - name: Sanity check fuzz targets on Rust ${{ env.TOOLCHAIN }}
386 run: cd fuzz && RUSTFLAGS="--cfg=fuzzing" cargo test --verbose --color always
388 run: cd fuzz && ./ci-fuzz.sh && cd ..
389 - name: Run lightning-invoice fuzzers
390 run: cd lightning-invoice/fuzz && RUSTFLAGS="--cfg=fuzzing" cargo test --verbose && ./ci-fuzz.sh
393 runs-on: ubuntu-latest
397 - name: Checkout source code
398 uses: actions/checkout@v3
399 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
400 uses: actions-rs/toolchain@v1
402 toolchain: ${{ env.TOOLCHAIN }}
405 - name: Install clippy
407 rustup component add clippy
408 - name: Run default clippy linting
410 cargo clippy -- -Aclippy::erasing_op -Aclippy::never_loop -Aclippy::if_same_then_else -Dclippy::try_err