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 platform: macos-latest
41 platform: windows-latest
47 platform: windows-latest
59 test-log-variants: true
63 build-net-old-tokio: true
73 build-net-tokio: false
77 runs-on: ${{ matrix.platform }}
79 - name: Checkout source code
80 uses: actions/checkout@v3
81 - name: Install Rust ${{ matrix.toolchain }} toolchain
82 uses: actions-rs/toolchain@v1
84 toolchain: ${{ matrix.toolchain }}
87 - name: Pin tokio to 1.14 for Rust 1.45
88 if: "matrix.build-net-old-tokio"
89 run: cargo update -p tokio --precise "1.14.0" --verbose
91 CARGO_NET_GIT_FETCH_WITH_CLI: "true"
92 - name: Build on Rust ${{ matrix.toolchain }} with net-tokio and tx-sync
93 if: "matrix.build-net-tokio && !matrix.coverage && matrix.build-tx-sync"
94 run: cargo build --verbose --color always
95 - name: Build on Rust ${{ matrix.toolchain }} with net-tokio, tx-sync, and full code-linking for coverage generation
97 run: RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always
98 - name: Build on Rust ${{ matrix.toolchain }}
99 if: "! matrix.build-net-tokio"
101 cargo build --verbose --color always -p lightning
102 cargo build --verbose --color always -p lightning-invoice
103 cargo build --verbose --color always -p lightning-persister
104 - name: Build on Rust ${{ matrix.toolchain }} with all Log-Limiting features
105 if: matrix.test-log-variants
108 for FEATURE in $(cat Cargo.toml | grep '^max_level_' | awk '{ print $1 }'); do
109 cargo build --verbose --color always --features $FEATURE
111 - name: Build Block Sync Clients on Rust ${{ matrix.toolchain }} with features
112 if: "matrix.build-net-tokio && !matrix.coverage"
114 cd lightning-block-sync
115 cargo build --verbose --color always --features rest-client
116 cargo build --verbose --color always --features rpc-client
117 cargo build --verbose --color always --features rpc-client,rest-client
118 cargo build --verbose --color always --features rpc-client,rest-client,tokio
119 - name: Build Block Sync Clients on Rust ${{ matrix.toolchain }} with features and full code-linking for coverage generation
122 cd lightning-block-sync
123 RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always --features rest-client
124 RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always --features rpc-client
125 RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always --features rpc-client,rest-client
126 RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always --features rpc-client,rest-client,tokio
127 - name: Build Transaction Sync Clients on Rust ${{ matrix.toolchain }} with features
128 if: "matrix.build-tx-sync && !matrix.coverage"
130 cd lightning-transaction-sync
131 cargo build --verbose --color always --features esplora-blocking
132 cargo build --verbose --color always --features esplora-async
133 - name: Build transaction sync clients on Rust ${{ matrix.toolchain }} with features and full code-linking for coverage generation
134 if: "matrix.build-tx-sync && matrix.coverage"
136 cd lightning-transaction-sync
137 RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always --features esplora-blocking
138 RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always --features esplora-async
139 - name: Test transaction sync clients on Rust ${{ matrix.toolchain }} with features
140 if: "matrix.build-tx-sync"
142 cd lightning-transaction-sync
143 cargo test --verbose --color always --features esplora-blocking
144 cargo test --verbose --color always --features esplora-async
145 - name: Test backtrace-debug builds on Rust ${{ matrix.toolchain }}
146 if: "matrix.toolchain == 'stable'"
148 cd lightning && cargo test --verbose --color always --features backtrace
149 - name: Test on Rust ${{ matrix.toolchain }} with net-tokio
150 if: "matrix.build-net-tokio && !matrix.coverage && matrix.build-tx-sync"
151 run: cargo test --verbose --color always
152 - name: Test on Rust ${{ matrix.toolchain }} with net-tokio, tx-sync, and full code-linking for coverage generation
154 run: RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always
155 - name: Test no-std builds on Rust ${{ matrix.toolchain }}
156 if: "matrix.build-no-std && !matrix.coverage"
157 shell: bash # Default on Winblows is powershell
159 for DIR in lightning lightning-invoice lightning-rapid-gossip-sync; do
161 cargo test --verbose --color always --no-default-features --features no-std
162 # check if there is a conflict between no-std and the default std feature
163 cargo test --verbose --color always --features no-std
164 # check that things still pass without grind_signatures
165 # note that outbound_commitment_test only runs in this mode, because of hardcoded signature values
166 cargo test --verbose --color always --no-default-features --features std
167 # check if there is a conflict between no-std and the c_bindings cfg
168 RUSTFLAGS="--cfg=c_bindings" cargo test --verbose --color always --no-default-features --features=no-std
171 # check no-std compatibility across dependencies
173 cargo check --verbose --color always
174 - name: Build no-std-check on Rust ${{ matrix.toolchain }} for ARM Embedded
175 if: "matrix.build-no-std && matrix.platform == 'ubuntu-latest'"
178 rustup target add thumbv7m-none-eabi
179 sudo apt-get -y install gcc-arm-none-eabi
180 cargo build --target=thumbv7m-none-eabi
181 - name: Test on no-std builds Rust ${{ matrix.toolchain }} and full code-linking for coverage generation
182 if: "matrix.build-no-std && matrix.coverage"
185 RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --no-default-features --features no-std
186 - name: Test futures builds on Rust ${{ matrix.toolchain }}
187 if: "matrix.build-futures && !matrix.coverage"
188 shell: bash # Default on Winblows is powershell
190 cd lightning-background-processor
191 cargo test --verbose --color always --no-default-features --features futures
192 - name: Test futures builds on Rust ${{ matrix.toolchain }} and full code-linking for coverage generation
193 if: "matrix.build-futures && matrix.coverage"
194 shell: bash # Default on Winblows is powershell
196 cd lightning-background-processor
197 RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --no-default-features --features futures
198 - name: Test on Rust ${{ matrix.toolchain }}
199 if: "! matrix.build-net-tokio"
201 cargo test --verbose --color always -p lightning
202 cargo test --verbose --color always -p lightning-invoice
203 cargo test --verbose --color always -p lightning-rapid-gossip-sync
204 cargo test --verbose --color always -p lightning-persister
205 cargo test --verbose --color always -p lightning-background-processor
206 - name: Test C Bindings Modifications on Rust ${{ matrix.toolchain }}
207 if: "! matrix.build-net-tokio"
209 RUSTFLAGS="--cfg=c_bindings" cargo test --verbose --color always -p lightning
210 RUSTFLAGS="--cfg=c_bindings" cargo test --verbose --color always -p lightning-invoice
211 RUSTFLAGS="--cfg=c_bindings" cargo build --verbose --color always -p lightning-persister
212 RUSTFLAGS="--cfg=c_bindings" cargo build --verbose --color always -p lightning-background-processor
213 - name: Test Block Sync Clients on Rust ${{ matrix.toolchain }} with features
214 if: "matrix.build-net-tokio && !matrix.coverage"
216 cd lightning-block-sync
217 cargo test --verbose --color always --features rest-client
218 cargo test --verbose --color always --features rpc-client
219 cargo test --verbose --color always --features rpc-client,rest-client
220 cargo test --verbose --color always --features rpc-client,rest-client,tokio
221 - name: Test Block Sync Clients on Rust ${{ matrix.toolchain }} with features and full code-linking for coverage generation
224 cd lightning-block-sync
225 RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --features rest-client
226 RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --features rpc-client
227 RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --features rpc-client,rest-client
228 RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --features rpc-client,rest-client,tokio
229 - name: Install deps for kcov
233 sudo apt-get -y install binutils-dev libcurl4-openssl-dev zlib1g-dev libdw-dev libiberty-dev
237 wget https://github.com/SimonKagstrom/kcov/archive/master.tar.gz
238 tar xzf master.tar.gz
239 cd kcov-master && mkdir build && cd build
242 make install DESTDIR=../../kcov-build
243 cd ../.. && rm -rf kcov-master master.tar.gz
244 - name: Generate coverage report
247 for file in target/debug/deps/lightning*; do
248 [ -x "${file}" ] || continue;
249 mkdir -p "target/cov/$(basename $file)";
250 ./kcov-build/usr/local/bin/kcov --exclude-pattern=/.cargo,/usr/lib --verify "target/cov/$(basename $file)" "$file";
252 - name: Upload coverage
254 uses: codecov/codecov-action@v3
256 # Could you use this to fake the coverage report for your PR? Sure.
257 # Will anyone be impressed by your amazing coverage? No
258 # Maybe if codecov wasn't broken we wouldn't need to do this...
259 token: f421b687-4dc2-4387-ac3d-dc3b2528af57
260 fail_ci_if_error: true
263 runs-on: ubuntu-latest
267 - name: Checkout source code
268 uses: actions/checkout@v3
269 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
270 uses: actions-rs/toolchain@v1
272 toolchain: ${{ env.TOOLCHAIN }}
275 - name: Cache routing graph snapshot
277 uses: actions/cache@v3
279 path: lightning/net_graph-2023-01-18.bin
280 key: ldk-net_graph-v0.0.113-2023-01-18.bin
281 - name: Fetch routing graph snapshot
282 if: steps.cache-graph.outputs.cache-hit != 'true'
284 curl --verbose -L -o lightning/net_graph-2023-01-18.bin https://bitcoin.ninja/ldk-net_graph-v0.0.113-2023-01-18.bin
285 echo "Sha sum: $(sha256sum lightning/net_graph-2023-01-18.bin | awk '{ print $1 }')"
286 if [ "$(sha256sum lightning/net_graph-2023-01-18.bin | awk '{ print $1 }')" != "${EXPECTED_ROUTING_GRAPH_SNAPSHOT_SHASUM}" ]; then
291 EXPECTED_ROUTING_GRAPH_SNAPSHOT_SHASUM: da6066f2bddcddbe7d8a6debbd53545697137b310bbb8c4911bc8c81fc5ff48c
292 - name: Fetch rapid graph sync reference input
294 curl --verbose -L -o lightning-rapid-gossip-sync/res/full_graph.lngossip https://bitcoin.ninja/ldk-compressed_graph-285cb27df79-2022-07-21.bin
295 echo "Sha sum: $(sha256sum lightning-rapid-gossip-sync/res/full_graph.lngossip | awk '{ print $1 }')"
296 if [ "$(sha256sum lightning-rapid-gossip-sync/res/full_graph.lngossip | awk '{ print $1 }')" != "${EXPECTED_RAPID_GOSSIP_SHASUM}" ]; then
301 EXPECTED_RAPID_GOSSIP_SHASUM: e0f5d11641c11896d7af3a2246d3d6c3f1720b7d2d17aab321ecce82e6b7deb8
302 - name: Test with Network Graph on Rust ${{ matrix.toolchain }}
305 RUSTFLAGS="--cfg=require_route_graph_test" cargo test
306 RUSTFLAGS="--cfg=require_route_graph_test" cargo test --features hashbrown
308 - name: Run benchmarks on Rust ${{ matrix.toolchain }}
310 RUSTC_BOOTSTRAP=1 cargo bench --features _bench_unstable
313 runs-on: ubuntu-latest
317 - name: Checkout source code
318 uses: actions/checkout@v3
321 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
322 uses: actions-rs/toolchain@v1
324 toolchain: ${{ env.TOOLCHAIN }}
327 - name: Fetch full tree and rebase on upstream
329 git remote add upstream https://github.com/lightningdevkit/rust-lightning
331 export GIT_COMMITTER_EMAIL="rl-ci@example.com"
332 export GIT_COMMITTER_NAME="RL CI"
333 git rebase upstream/main
334 - name: For each commit, run cargo check (including in fuzz)
335 run: ci/check-each-commit.sh upstream/main
338 runs-on: ubuntu-latest
342 - name: Checkout source code
343 uses: actions/checkout@v3
346 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
347 uses: actions-rs/toolchain@v1
349 toolchain: ${{ env.TOOLCHAIN }}
352 - name: Run cargo check for release build.
354 cargo check --release
355 cargo check --no-default-features --features=no-std --release
356 cargo check --no-default-features --features=futures --release
360 runs-on: ubuntu-latest
364 - name: Checkout source code
365 uses: actions/checkout@v3
366 - name: Install Rust 1.58 toolchain
367 uses: actions-rs/toolchain@v1
372 - name: Install dependencies for honggfuzz
375 sudo apt-get -y install build-essential binutils-dev libunwind-dev
376 - name: Sanity check fuzz targets on Rust ${{ env.TOOLCHAIN }}
377 run: cd fuzz && RUSTFLAGS="--cfg=fuzzing" cargo test --verbose --color always
379 run: cd fuzz && ./ci-fuzz.sh && cd ..
380 - name: Run lightning-invoice fuzzers
381 run: cd lightning-invoice/fuzz && RUSTFLAGS="--cfg=fuzzing" cargo test --verbose && ./ci-fuzz.sh
384 runs-on: ubuntu-latest
388 - name: Checkout source code
389 uses: actions/checkout@v3
390 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
391 uses: actions-rs/toolchain@v1
393 toolchain: ${{ env.TOOLCHAIN }}
396 - name: Install clippy
398 rustup component add clippy
399 - name: Run default clippy linting
401 cargo clippy -- -Aclippy::erasing_op -Aclippy::never_loop -Aclippy::if_same_then_else -Dclippy::try_err