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: Build on Rust ${{ matrix.toolchain }} with net-tokio and tx-sync
90 if: "matrix.build-net-tokio && !matrix.coverage && matrix.build-tx-sync"
91 run: cargo build --verbose --color always
92 - name: Build on Rust ${{ matrix.toolchain }} with net-tokio, tx-sync, and full code-linking for coverage generation
94 run: RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always
95 - name: Build on Rust ${{ matrix.toolchain }}
96 if: "! matrix.build-net-tokio"
98 cargo build --verbose --color always -p lightning
99 cargo build --verbose --color always -p lightning-invoice
100 cargo build --verbose --color always -p lightning-persister
101 - name: Build on Rust ${{ matrix.toolchain }} with all Log-Limiting features
102 if: matrix.test-log-variants
105 for FEATURE in $(cat Cargo.toml | grep '^max_level_' | awk '{ print $1 }'); do
106 cargo build --verbose --color always --features $FEATURE
108 - name: Build Block Sync Clients on Rust ${{ matrix.toolchain }} with features
109 if: "matrix.build-net-tokio && !matrix.coverage"
111 cd lightning-block-sync
112 cargo build --verbose --color always --features rest-client
113 cargo build --verbose --color always --features rpc-client
114 cargo build --verbose --color always --features rpc-client,rest-client
115 cargo build --verbose --color always --features rpc-client,rest-client,tokio
116 - name: Build Block Sync Clients on Rust ${{ matrix.toolchain }} with features and full code-linking for coverage generation
119 cd lightning-block-sync
120 RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always --features rest-client
121 RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always --features rpc-client
122 RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always --features rpc-client,rest-client
123 RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always --features rpc-client,rest-client,tokio
124 - name: Build Transaction Sync Clients on Rust ${{ matrix.toolchain }} with features
125 if: "matrix.build-tx-sync && !matrix.coverage"
127 cd lightning-transaction-sync
128 cargo build --verbose --color always --features esplora-blocking
129 cargo build --verbose --color always --features esplora-async
130 - name: Build transaction sync clients on Rust ${{ matrix.toolchain }} with features and full code-linking for coverage generation
131 if: "matrix.build-tx-sync && matrix.coverage"
133 cd lightning-transaction-sync
134 RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always --features esplora-blocking
135 RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always --features esplora-async
136 - name: Test transaction sync clients on Rust ${{ matrix.toolchain }} with features
137 if: "matrix.build-tx-sync"
139 cd lightning-transaction-sync
140 cargo test --verbose --color always --features esplora-blocking
141 cargo test --verbose --color always --features esplora-async
142 - name: Test backtrace-debug builds on Rust ${{ matrix.toolchain }}
143 if: "matrix.toolchain == 'stable'"
145 cd lightning && cargo test --verbose --color always --features backtrace
146 - name: Test on Rust ${{ matrix.toolchain }} with net-tokio
147 if: "matrix.build-net-tokio && !matrix.coverage && matrix.build-tx-sync"
148 run: cargo test --verbose --color always
149 - name: Test on Rust ${{ matrix.toolchain }} with net-tokio, tx-sync, and full code-linking for coverage generation
151 run: RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always
152 - name: Test no-std builds on Rust ${{ matrix.toolchain }}
153 if: "matrix.build-no-std && !matrix.coverage"
154 shell: bash # Default on Winblows is powershell
156 for DIR in lightning lightning-invoice lightning-rapid-gossip-sync; do
158 cargo test --verbose --color always --no-default-features --features no-std
159 # check if there is a conflict between no-std and the default std feature
160 cargo test --verbose --color always --features no-std
161 # check that things still pass without grind_signatures
162 # note that outbound_commitment_test only runs in this mode, because of hardcoded signature values
163 cargo test --verbose --color always --no-default-features --features std
164 # check if there is a conflict between no-std and the c_bindings cfg
165 RUSTFLAGS="--cfg=c_bindings" cargo test --verbose --color always --no-default-features --features=no-std
168 # check no-std compatibility across dependencies
170 cargo check --verbose --color always
171 - name: Build no-std-check on Rust ${{ matrix.toolchain }} for ARM Embedded
172 if: "matrix.build-no-std && matrix.platform == 'ubuntu-latest'"
175 rustup target add thumbv7m-none-eabi
176 sudo apt-get -y install gcc-arm-none-eabi
177 cargo build --target=thumbv7m-none-eabi
178 - name: Test on no-std builds Rust ${{ matrix.toolchain }} and full code-linking for coverage generation
179 if: "matrix.build-no-std && matrix.coverage"
182 RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --no-default-features --features no-std
183 - name: Test futures builds on Rust ${{ matrix.toolchain }}
184 if: "matrix.build-futures && !matrix.coverage"
185 shell: bash # Default on Winblows is powershell
187 cd lightning-background-processor
188 cargo test --verbose --color always --no-default-features --features futures
189 - name: Test futures builds on Rust ${{ matrix.toolchain }} and full code-linking for coverage generation
190 if: "matrix.build-futures && matrix.coverage"
191 shell: bash # Default on Winblows is powershell
193 cd lightning-background-processor
194 RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --no-default-features --features futures
195 - name: Test on Rust ${{ matrix.toolchain }}
196 if: "! matrix.build-net-tokio"
198 cargo test --verbose --color always -p lightning
199 cargo test --verbose --color always -p lightning-invoice
200 cargo test --verbose --color always -p lightning-rapid-gossip-sync
201 cargo test --verbose --color always -p lightning-persister
202 cargo test --verbose --color always -p lightning-background-processor
203 - name: Test C Bindings Modifications on Rust ${{ matrix.toolchain }}
204 if: "! matrix.build-net-tokio"
206 RUSTFLAGS="--cfg=c_bindings" cargo test --verbose --color always -p lightning
207 RUSTFLAGS="--cfg=c_bindings" cargo test --verbose --color always -p lightning-invoice
208 RUSTFLAGS="--cfg=c_bindings" cargo build --verbose --color always -p lightning-persister
209 RUSTFLAGS="--cfg=c_bindings" cargo build --verbose --color always -p lightning-background-processor
210 - name: Test Block Sync Clients on Rust ${{ matrix.toolchain }} with features
211 if: "matrix.build-net-tokio && !matrix.coverage"
213 cd lightning-block-sync
214 cargo test --verbose --color always --features rest-client
215 cargo test --verbose --color always --features rpc-client
216 cargo test --verbose --color always --features rpc-client,rest-client
217 cargo test --verbose --color always --features rpc-client,rest-client,tokio
218 - name: Test Block Sync Clients on Rust ${{ matrix.toolchain }} with features and full code-linking for coverage generation
221 cd lightning-block-sync
222 RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --features rest-client
223 RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --features rpc-client
224 RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --features rpc-client,rest-client
225 RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --features rpc-client,rest-client,tokio
226 - name: Test Custom Message Macros on Rust ${{ matrix.toolchain }}
227 if: "matrix.test-custom-message"
229 cd lightning-custom-message
230 cargo test --verbose --color always
231 - name: Install deps for kcov
235 sudo apt-get -y install binutils-dev libcurl4-openssl-dev zlib1g-dev libdw-dev libiberty-dev
239 wget https://github.com/SimonKagstrom/kcov/archive/master.tar.gz
240 tar xzf master.tar.gz
241 cd kcov-master && mkdir build && cd build
244 make install DESTDIR=../../kcov-build
245 cd ../.. && rm -rf kcov-master master.tar.gz
246 - name: Generate coverage report
249 for file in target/debug/deps/lightning*; do
250 [ -x "${file}" ] || continue;
251 mkdir -p "target/cov/$(basename $file)";
252 ./kcov-build/usr/local/bin/kcov --exclude-pattern=/.cargo,/usr/lib --verify "target/cov/$(basename $file)" "$file";
254 - name: Upload coverage
256 uses: codecov/codecov-action@v3
258 # Could you use this to fake the coverage report for your PR? Sure.
259 # Will anyone be impressed by your amazing coverage? No
260 # Maybe if codecov wasn't broken we wouldn't need to do this...
261 token: f421b687-4dc2-4387-ac3d-dc3b2528af57
262 fail_ci_if_error: true
265 runs-on: ubuntu-latest
269 - name: Checkout source code
270 uses: actions/checkout@v3
271 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
272 uses: actions-rs/toolchain@v1
274 toolchain: ${{ env.TOOLCHAIN }}
277 - name: Cache routing graph snapshot
279 uses: actions/cache@v3
281 path: lightning/net_graph-2023-01-18.bin
282 key: ldk-net_graph-v0.0.113-2023-01-18.bin
283 - name: Fetch routing graph snapshot
284 if: steps.cache-graph.outputs.cache-hit != 'true'
286 curl --verbose -L -o lightning/net_graph-2023-01-18.bin https://bitcoin.ninja/ldk-net_graph-v0.0.113-2023-01-18.bin
287 echo "Sha sum: $(sha256sum lightning/net_graph-2023-01-18.bin | awk '{ print $1 }')"
288 if [ "$(sha256sum lightning/net_graph-2023-01-18.bin | awk '{ print $1 }')" != "${EXPECTED_ROUTING_GRAPH_SNAPSHOT_SHASUM}" ]; then
293 EXPECTED_ROUTING_GRAPH_SNAPSHOT_SHASUM: da6066f2bddcddbe7d8a6debbd53545697137b310bbb8c4911bc8c81fc5ff48c
294 - name: Fetch rapid graph sync reference input
296 curl --verbose -L -o lightning-rapid-gossip-sync/res/full_graph.lngossip https://bitcoin.ninja/ldk-compressed_graph-285cb27df79-2022-07-21.bin
297 echo "Sha sum: $(sha256sum lightning-rapid-gossip-sync/res/full_graph.lngossip | awk '{ print $1 }')"
298 if [ "$(sha256sum lightning-rapid-gossip-sync/res/full_graph.lngossip | awk '{ print $1 }')" != "${EXPECTED_RAPID_GOSSIP_SHASUM}" ]; then
303 EXPECTED_RAPID_GOSSIP_SHASUM: e0f5d11641c11896d7af3a2246d3d6c3f1720b7d2d17aab321ecce82e6b7deb8
304 - name: Test with Network Graph on Rust ${{ matrix.toolchain }}
307 RUSTFLAGS="--cfg=require_route_graph_test" cargo test
308 RUSTFLAGS="--cfg=require_route_graph_test" cargo test --features hashbrown
310 - name: Run benchmarks on Rust ${{ matrix.toolchain }}
312 RUSTC_BOOTSTRAP=1 cargo bench --features _bench_unstable
315 runs-on: ubuntu-latest
319 - name: Checkout source code
320 uses: actions/checkout@v3
323 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
324 uses: actions-rs/toolchain@v1
326 toolchain: ${{ env.TOOLCHAIN }}
329 - name: Fetch full tree and rebase on upstream
331 git remote add upstream https://github.com/lightningdevkit/rust-lightning
333 export GIT_COMMITTER_EMAIL="rl-ci@example.com"
334 export GIT_COMMITTER_NAME="RL CI"
335 git rebase upstream/main
336 - name: For each commit, run cargo check (including in fuzz)
337 run: ci/check-each-commit.sh upstream/main
340 runs-on: ubuntu-latest
344 - name: Checkout source code
345 uses: actions/checkout@v3
348 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
349 uses: actions-rs/toolchain@v1
351 toolchain: ${{ env.TOOLCHAIN }}
354 - name: Run cargo check for release build.
356 cargo check --release
357 cargo check --no-default-features --features=no-std --release
358 cargo check --no-default-features --features=futures --release
362 runs-on: ubuntu-latest
366 - name: Checkout source code
367 uses: actions/checkout@v3
368 - name: Install Rust 1.58 toolchain
369 uses: actions-rs/toolchain@v1
374 - name: Install dependencies for honggfuzz
377 sudo apt-get -y install build-essential binutils-dev libunwind-dev
378 - name: Sanity check fuzz targets on Rust ${{ env.TOOLCHAIN }}
379 run: cd fuzz && RUSTFLAGS="--cfg=fuzzing" cargo test --verbose --color always
381 run: cd fuzz && ./ci-fuzz.sh && cd ..
382 - name: Run lightning-invoice fuzzers
383 run: cd lightning-invoice/fuzz && RUSTFLAGS="--cfg=fuzzing" cargo test --verbose && ./ci-fuzz.sh
386 runs-on: ubuntu-latest
390 - name: Checkout source code
391 uses: actions/checkout@v3
392 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
393 uses: actions-rs/toolchain@v1
395 toolchain: ${{ env.TOOLCHAIN }}
398 - name: Install clippy
400 rustup component add clippy
401 - name: Run default clippy linting
403 cargo clippy -- -Aclippy::erasing_op -Aclippy::never_loop -Aclippy::if_same_then_else -Dclippy::try_err