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, and coverage generation
17 # 1.47.0 will be the MSRV for no-std builds using hashbrown once core2 is updated
25 platform: macos-latest
30 platform: macos-latest
35 platform: windows-latest
40 platform: windows-latest
50 test-log-variants: true
53 build-net-old-tokio: true
61 runs-on: ${{ matrix.platform }}
63 - name: Checkout source code
64 uses: actions/checkout@v3
65 - name: Install Rust ${{ matrix.toolchain }} toolchain
66 uses: actions-rs/toolchain@v1
68 toolchain: ${{ matrix.toolchain }}
71 - name: Pin tokio to 1.14 for Rust 1.45
72 if: "matrix.build-net-old-tokio"
73 run: cargo update -p tokio --precise "1.14.0" --verbose
75 CARGO_NET_GIT_FETCH_WITH_CLI: "true"
76 - name: Build on Rust ${{ matrix.toolchain }} with net-tokio
77 if: "matrix.build-net-tokio && !matrix.coverage"
78 run: cargo build --verbose --color always
79 - name: Build on Rust ${{ matrix.toolchain }} with net-tokio and full code-linking for coverage generation
81 run: RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always
82 - name: Build on Rust ${{ matrix.toolchain }}
83 if: "! matrix.build-net-tokio"
85 cargo build --verbose --color always -p lightning
86 cargo build --verbose --color always -p lightning-invoice
87 cargo build --verbose --color always -p lightning-persister
88 - name: Build on Rust ${{ matrix.toolchain }} with all Log-Limiting features
89 if: matrix.test-log-variants
92 for FEATURE in $(cat Cargo.toml | grep '^max_level_' | awk '{ print $1 }'); do
93 cargo build --verbose --color always --features $FEATURE
95 - name: Build Block Sync Clients on Rust ${{ matrix.toolchain }} with features
96 if: "matrix.build-net-tokio && !matrix.coverage"
98 cd lightning-block-sync
99 cargo build --verbose --color always --features rest-client
100 cargo build --verbose --color always --features rpc-client
101 cargo build --verbose --color always --features rpc-client,rest-client
102 cargo build --verbose --color always --features rpc-client,rest-client,tokio
103 - name: Build Block Sync Clients on Rust ${{ matrix.toolchain }} with features and full code-linking for coverage generation
106 cd lightning-block-sync
107 RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always --features rest-client
108 RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always --features rpc-client
109 RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always --features rpc-client,rest-client
110 RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always --features rpc-client,rest-client,tokio
111 - name: Test backtrace-debug builds on Rust ${{ matrix.toolchain }}
112 if: "matrix.build-no-std"
114 cd lightning && cargo test --verbose --color always --features backtrace
115 - name: Test on Rust ${{ matrix.toolchain }} with net-tokio
116 if: "matrix.build-net-tokio && !matrix.coverage"
117 run: cargo test --verbose --color always
118 - name: Test on Rust ${{ matrix.toolchain }} with net-tokio and full code-linking for coverage generation
120 run: RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always
121 - name: Test no-std builds on Rust ${{ matrix.toolchain }}
122 if: "matrix.build-no-std && !matrix.coverage"
123 shell: bash # Default on Winblows is powershell
125 for DIR in lightning lightning-invoice lightning-rapid-gossip-sync; do
127 cargo test --verbose --color always --no-default-features --features no-std
128 # check if there is a conflict between no-std and the default std feature
129 cargo test --verbose --color always --features no-std
130 # check that things still pass without grind_signatures
131 # note that outbound_commitment_test only runs in this mode, because of hardcoded signature values
132 cargo test --verbose --color always --no-default-features --features std
133 # check if there is a conflict between no-std and the c_bindings cfg
134 RUSTFLAGS="--cfg=c_bindings" cargo test --verbose --color always --no-default-features --features=no-std
137 # check no-std compatibility across dependencies
139 cargo check --verbose --color always
140 - name: Build no-std-check on Rust ${{ matrix.toolchain }} for ARM Embedded
141 if: "matrix.build-no-std && matrix.platform == 'ubuntu-latest'"
144 rustup target add thumbv7m-none-eabi
145 sudo apt-get -y install gcc-arm-none-eabi
146 cargo build --target=thumbv7m-none-eabi
147 - name: Test on no-std builds Rust ${{ matrix.toolchain }} and full code-linking for coverage generation
148 if: "matrix.build-no-std && matrix.coverage"
151 RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --no-default-features --features no-std
152 - name: Test futures builds on Rust ${{ matrix.toolchain }}
153 if: "matrix.build-futures && !matrix.coverage"
154 shell: bash # Default on Winblows is powershell
156 cd lightning-background-processor
157 cargo test --verbose --color always --no-default-features --features futures
158 - name: Test futures builds on Rust ${{ matrix.toolchain }} and full code-linking for coverage generation
159 if: "matrix.build-futures && matrix.coverage"
160 shell: bash # Default on Winblows is powershell
162 cd lightning-background-processor
163 RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --no-default-features --features futures
164 - name: Test on Rust ${{ matrix.toolchain }}
165 if: "! matrix.build-net-tokio"
167 cargo test --verbose --color always -p lightning
168 cargo test --verbose --color always -p lightning-invoice
169 cargo test --verbose --color always -p lightning-rapid-gossip-sync
170 cargo test --verbose --color always -p lightning-persister
171 cargo test --verbose --color always -p lightning-background-processor
172 - name: Test C Bindings Modifications on Rust ${{ matrix.toolchain }}
173 if: "! matrix.build-net-tokio"
175 RUSTFLAGS="--cfg=c_bindings" cargo test --verbose --color always -p lightning
176 RUSTFLAGS="--cfg=c_bindings" cargo test --verbose --color always -p lightning-invoice
177 RUSTFLAGS="--cfg=c_bindings" cargo build --verbose --color always -p lightning-persister
178 RUSTFLAGS="--cfg=c_bindings" cargo build --verbose --color always -p lightning-background-processor
179 - name: Test Block Sync Clients on Rust ${{ matrix.toolchain }} with features
180 if: "matrix.build-net-tokio && !matrix.coverage"
182 cd lightning-block-sync
183 cargo test --verbose --color always --features rest-client
184 cargo test --verbose --color always --features rpc-client
185 cargo test --verbose --color always --features rpc-client,rest-client
186 cargo test --verbose --color always --features rpc-client,rest-client,tokio
187 - name: Test Block Sync Clients on Rust ${{ matrix.toolchain }} with features and full code-linking for coverage generation
190 cd lightning-block-sync
191 RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --features rest-client
192 RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --features rpc-client
193 RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --features rpc-client,rest-client
194 RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --features rpc-client,rest-client,tokio
195 - name: Install deps for kcov
199 sudo apt-get -y install binutils-dev libcurl4-openssl-dev zlib1g-dev libdw-dev libiberty-dev
203 wget https://github.com/SimonKagstrom/kcov/archive/master.tar.gz
204 tar xzf master.tar.gz
205 cd kcov-master && mkdir build && cd build
208 make install DESTDIR=../../kcov-build
209 cd ../.. && rm -rf kcov-master master.tar.gz
210 - name: Generate coverage report
213 for file in target/debug/deps/lightning*; do
214 [ -x "${file}" ] || continue;
215 mkdir -p "target/cov/$(basename $file)";
216 ./kcov-build/usr/local/bin/kcov --exclude-pattern=/.cargo,/usr/lib --verify "target/cov/$(basename $file)" "$file";
218 - name: Upload coverage
220 uses: codecov/codecov-action@v3
222 # Could you use this to fake the coverage report for your PR? Sure.
223 # Will anyone be impressed by your amazing coverage? No
224 # Maybe if codecov wasn't broken we wouldn't need to do this...
225 token: f421b687-4dc2-4387-ac3d-dc3b2528af57
226 fail_ci_if_error: true
229 runs-on: ubuntu-latest
233 - name: Checkout source code
234 uses: actions/checkout@v3
235 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
236 uses: actions-rs/toolchain@v1
238 toolchain: ${{ env.TOOLCHAIN }}
241 - name: Cache routing graph snapshot
243 uses: actions/cache@v3
245 path: lightning/net_graph-2021-05-31.bin
246 key: ldk-net_graph-v0.0.15-2021-05-31.bin
247 - name: Fetch routing graph snapshot
248 if: steps.cache-graph.outputs.cache-hit != 'true'
250 curl --verbose -L -o lightning/net_graph-2021-05-31.bin https://bitcoin.ninja/ldk-net_graph-v0.0.15-2021-05-31.bin
251 echo "Sha sum: $(sha256sum lightning/net_graph-2021-05-31.bin | awk '{ print $1 }')"
252 if [ "$(sha256sum lightning/net_graph-2021-05-31.bin | awk '{ print $1 }')" != "${EXPECTED_ROUTING_GRAPH_SNAPSHOT_SHASUM}" ]; then
257 EXPECTED_ROUTING_GRAPH_SNAPSHOT_SHASUM: 05a5361278f68ee2afd086cc04a1f927a63924be451f3221d380533acfacc303
258 - name: Fetch rapid graph sync reference input
260 curl --verbose -L -o lightning-rapid-gossip-sync/res/full_graph.lngossip https://bitcoin.ninja/ldk-compressed_graph-285cb27df79-2022-07-21.bin
261 echo "Sha sum: $(sha256sum lightning-rapid-gossip-sync/res/full_graph.lngossip | awk '{ print $1 }')"
262 if [ "$(sha256sum lightning-rapid-gossip-sync/res/full_graph.lngossip | awk '{ print $1 }')" != "${EXPECTED_RAPID_GOSSIP_SHASUM}" ]; then
267 EXPECTED_RAPID_GOSSIP_SHASUM: e0f5d11641c11896d7af3a2246d3d6c3f1720b7d2d17aab321ecce82e6b7deb8
268 - name: Test with Network Graph on Rust ${{ matrix.toolchain }}
271 RUSTFLAGS="--cfg=require_route_graph_test" cargo test
272 RUSTFLAGS="--cfg=require_route_graph_test" cargo test --features hashbrown
274 - name: Run benchmarks on Rust ${{ matrix.toolchain }}
276 RUSTC_BOOTSTRAP=1 cargo bench --features _bench_unstable
279 runs-on: ubuntu-latest
283 - name: Checkout source code
284 uses: actions/checkout@v3
287 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
288 uses: actions-rs/toolchain@v1
290 toolchain: ${{ env.TOOLCHAIN }}
293 - name: Fetch full tree and rebase on upstream
295 git remote add upstream https://github.com/lightningdevkit/rust-lightning
297 export GIT_COMMITTER_EMAIL="rl-ci@example.com"
298 export GIT_COMMITTER_NAME="RL CI"
299 git rebase upstream/main
300 - name: For each commit, run cargo check (including in fuzz)
301 run: ci/check-each-commit.sh upstream/main
304 runs-on: ubuntu-latest
308 - name: Checkout source code
309 uses: actions/checkout@v3
312 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
313 uses: actions-rs/toolchain@v1
315 toolchain: ${{ env.TOOLCHAIN }}
318 - name: Run cargo check for release build.
320 cargo check --release
321 cargo check --no-default-features --features=no-std --release
322 cargo check --no-default-features --features=futures --release
326 runs-on: ubuntu-latest
330 - name: Checkout source code
331 uses: actions/checkout@v3
332 - name: Install Rust 1.58 toolchain
333 uses: actions-rs/toolchain@v1
338 - name: Install dependencies for honggfuzz
341 sudo apt-get -y install build-essential binutils-dev libunwind-dev
342 - name: Sanity check fuzz targets on Rust ${{ env.TOOLCHAIN }}
343 run: cd fuzz && RUSTFLAGS="--cfg=fuzzing" cargo test --verbose --color always
345 run: cd fuzz && ./ci-fuzz.sh && cd ..
346 - name: Run lightning-invoice fuzzers
347 run: cd lightning-invoice/fuzz && RUSTFLAGS="--cfg=fuzzing" cargo test --verbose && ./ci-fuzz.sh
350 runs-on: ubuntu-latest
354 - name: Checkout source code
355 uses: actions/checkout@v3
356 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
357 uses: actions-rs/toolchain@v1
359 toolchain: ${{ env.TOOLCHAIN }}
362 - name: Install clippy
364 rustup component add clippy
365 - name: Run default clippy linting
367 cargo clippy -- -Aclippy::erasing_op -Aclippy::never_loop -Aclippy::if_same_then_else -Dclippy::try_err