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, and coverage generation
17 # 1.47.0 will be the MSRV for no-std builds using hashbrown once core2 is updated
24 platform: macos-latest
28 platform: macos-latest
32 platform: windows-latest
36 platform: windows-latest
44 test-log-variants: true
46 build-net-old-tokio: true
52 runs-on: ${{ matrix.platform }}
54 - name: Checkout source code
55 uses: actions/checkout@v3
56 - name: Install Rust ${{ matrix.toolchain }} toolchain
57 uses: actions-rs/toolchain@v1
59 toolchain: ${{ matrix.toolchain }}
62 - name: Pin tokio to 1.14 for Rust 1.45
63 if: "matrix.build-net-old-tokio"
64 run: cargo update -p tokio --precise "1.14.0" --verbose
66 CARGO_NET_GIT_FETCH_WITH_CLI: "true"
67 - name: Build on Rust ${{ matrix.toolchain }} with net-tokio
68 if: "matrix.build-net-tokio && !matrix.coverage"
69 run: cargo build --verbose --color always
70 - name: Build on Rust ${{ matrix.toolchain }} with net-tokio and full code-linking for coverage generation
72 run: RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always
73 - name: Build on Rust ${{ matrix.toolchain }}
74 if: "! matrix.build-net-tokio"
76 cargo build --verbose --color always -p lightning
77 cargo build --verbose --color always -p lightning-invoice
78 cargo build --verbose --color always -p lightning-persister
79 - name: Build on Rust ${{ matrix.toolchain }} with all Log-Limiting features
80 if: matrix.test-log-variants
83 for FEATURE in $(cat Cargo.toml | grep '^max_level_' | awk '{ print $1 }'); do
84 cargo build --verbose --color always --features $FEATURE
86 - name: Build Block Sync Clients on Rust ${{ matrix.toolchain }} with features
87 if: "matrix.build-net-tokio && !matrix.coverage"
89 cd lightning-block-sync
90 cargo build --verbose --color always --features rest-client
91 cargo build --verbose --color always --features rpc-client
92 cargo build --verbose --color always --features rpc-client,rest-client
93 cargo build --verbose --color always --features rpc-client,rest-client,tokio
94 - name: Build Block Sync Clients on Rust ${{ matrix.toolchain }} with features and full code-linking for coverage generation
97 cd lightning-block-sync
98 RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always --features rest-client
99 RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always --features rpc-client
100 RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always --features rpc-client,rest-client
101 RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always --features rpc-client,rest-client,tokio
102 - name: Test backtrace-debug builds on Rust ${{ matrix.toolchain }}
103 if: "matrix.build-no-std"
105 cd lightning && cargo test --verbose --color always --features backtrace
106 - name: Test on Rust ${{ matrix.toolchain }} with net-tokio
107 if: "matrix.build-net-tokio && !matrix.coverage"
108 run: cargo test --verbose --color always
109 - name: Test on Rust ${{ matrix.toolchain }} with net-tokio and full code-linking for coverage generation
111 run: RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always
112 - name: Test on no-std bullds Rust ${{ matrix.toolchain }}
113 if: "matrix.build-no-std && !matrix.coverage"
114 shell: bash # Default on Winblows is powershell
117 cargo test --verbose --color always --no-default-features --features no-std
118 # check if there is a conflict between no-std and the default std feature
119 cargo test --verbose --color always --features no-std
120 # check that things still pass without grind_signatures
121 # note that outbound_commitment_test only runs in this mode, because of hardcoded signature values
122 cargo test --verbose --color always --no-default-features --features std
123 # check if there is a conflict between no-std and the c_bindings cfg
124 RUSTFLAGS="--cfg=c_bindings" cargo test --verbose --color always --no-default-features --features=no-std
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 if there is a conflict between no-std and the c_bindings cfg
131 RUSTFLAGS="--cfg=c_bindings" cargo test --verbose --color always --no-default-features --features=no-std
132 # check no-std compatibility across dependencies
135 cargo check --verbose --color always
137 - name: Test on no-std builds Rust ${{ matrix.toolchain }} and full code-linking for coverage generation
138 if: "matrix.build-no-std && matrix.coverage"
141 RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --no-default-features --features no-std
143 - name: Test on Rust ${{ matrix.toolchain }}
144 if: "! matrix.build-net-tokio"
146 cargo test --verbose --color always -p lightning
147 cargo test --verbose --color always -p lightning-invoice
148 cargo test --verbose --color always -p lightning-rapid-gossip-sync
149 cargo build --verbose --color always -p lightning-persister
150 cargo build --verbose --color always -p lightning-background-processor
151 - name: Test C Bindings Modifications on Rust ${{ matrix.toolchain }}
152 if: "! matrix.build-net-tokio"
154 RUSTFLAGS="--cfg=c_bindings" cargo test --verbose --color always -p lightning
155 RUSTFLAGS="--cfg=c_bindings" cargo test --verbose --color always -p lightning-invoice
156 RUSTFLAGS="--cfg=c_bindings" cargo build --verbose --color always -p lightning-persister
157 RUSTFLAGS="--cfg=c_bindings" cargo build --verbose --color always -p lightning-background-processor
158 - name: Test Block Sync Clients on Rust ${{ matrix.toolchain }} with features
159 if: "matrix.build-net-tokio && !matrix.coverage"
161 cd lightning-block-sync
162 cargo test --verbose --color always --features rest-client
163 cargo test --verbose --color always --features rpc-client
164 cargo test --verbose --color always --features rpc-client,rest-client
165 cargo test --verbose --color always --features rpc-client,rest-client,tokio
166 - name: Test Block Sync Clients on Rust ${{ matrix.toolchain }} with features and full code-linking for coverage generation
169 cd lightning-block-sync
170 RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --features rest-client
171 RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --features rpc-client
172 RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --features rpc-client,rest-client
173 RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --features rpc-client,rest-client,tokio
174 - name: Install deps for kcov
178 sudo apt-get -y install binutils-dev libcurl4-openssl-dev zlib1g-dev libdw-dev libiberty-dev
182 wget https://github.com/SimonKagstrom/kcov/archive/master.tar.gz
183 tar xzf master.tar.gz
184 cd kcov-master && mkdir build && cd build
187 make install DESTDIR=../../kcov-build
188 cd ../.. && rm -rf kcov-master master.tar.gz
189 - name: Generate coverage report
192 for file in target/debug/deps/lightning*; do
193 [ -x "${file}" ] || continue;
194 mkdir -p "target/cov/$(basename $file)";
195 ./kcov-build/usr/local/bin/kcov --exclude-pattern=/.cargo,/usr/lib --verify "target/cov/$(basename $file)" "$file";
197 - name: Upload coverage
199 uses: codecov/codecov-action@v3
201 # Could you use this to fake the coverage report for your PR? Sure.
202 # Will anyone be impressed by your amazing coverage? No
203 # Maybe if codecov wasn't broken we wouldn't need to do this...
204 token: f421b687-4dc2-4387-ac3d-dc3b2528af57
205 fail_ci_if_error: true
208 runs-on: ubuntu-latest
212 - name: Checkout source code
213 uses: actions/checkout@v3
214 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
215 uses: actions-rs/toolchain@v1
217 toolchain: ${{ env.TOOLCHAIN }}
220 - name: Cache routing graph snapshot
222 uses: actions/cache@v3
224 path: lightning/net_graph-2021-05-31.bin
225 key: ldk-net_graph-v0.0.15-2021-05-31.bin
226 - name: Fetch routing graph snapshot
227 if: steps.cache-graph.outputs.cache-hit != 'true'
229 curl --verbose -L -o lightning/net_graph-2021-05-31.bin https://bitcoin.ninja/ldk-net_graph-v0.0.15-2021-05-31.bin
230 echo "Sha sum: $(sha256sum lightning/net_graph-2021-05-31.bin | awk '{ print $1 }')"
231 if [ "$(sha256sum lightning/net_graph-2021-05-31.bin | awk '{ print $1 }')" != "${EXPECTED_ROUTING_GRAPH_SNAPSHOT_SHASUM}" ]; then
236 EXPECTED_ROUTING_GRAPH_SNAPSHOT_SHASUM: 05a5361278f68ee2afd086cc04a1f927a63924be451f3221d380533acfacc303
237 - name: Fetch rapid graph sync reference input
239 curl --verbose -L -o lightning-rapid-gossip-sync/res/full_graph.lngossip https://bitcoin.ninja/ldk-compressed_graph-285cb27df79-2022-07-21.bin
240 echo "Sha sum: $(sha256sum lightning-rapid-gossip-sync/res/full_graph.lngossip | awk '{ print $1 }')"
241 if [ "$(sha256sum lightning-rapid-gossip-sync/res/full_graph.lngossip | awk '{ print $1 }')" != "${EXPECTED_RAPID_GOSSIP_SHASUM}" ]; then
246 EXPECTED_RAPID_GOSSIP_SHASUM: e0f5d11641c11896d7af3a2246d3d6c3f1720b7d2d17aab321ecce82e6b7deb8
247 - name: Test with Network Graph on Rust ${{ matrix.toolchain }}
250 RUSTFLAGS="--cfg=require_route_graph_test" cargo test
251 RUSTFLAGS="--cfg=require_route_graph_test" cargo test --features hashbrown
253 - name: Run benchmarks on Rust ${{ matrix.toolchain }}
255 cargo bench --features _bench_unstable
258 runs-on: ubuntu-latest
262 - name: Checkout source code
263 uses: actions/checkout@v3
266 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
267 uses: actions-rs/toolchain@v1
269 toolchain: ${{ env.TOOLCHAIN }}
272 - name: Fetch full tree and rebase on upstream
274 git remote add upstream https://github.com/lightningdevkit/rust-lightning
276 export GIT_COMMITTER_EMAIL="rl-ci@example.com"
277 export GIT_COMMITTER_NAME="RL CI"
278 git rebase upstream/main
279 - name: For each commit, run cargo check (including in fuzz)
280 run: ci/check-each-commit.sh upstream/main
283 runs-on: ubuntu-latest
287 - name: Checkout source code
288 uses: actions/checkout@v3
291 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
292 uses: actions-rs/toolchain@v1
294 toolchain: ${{ env.TOOLCHAIN }}
297 - name: Run cargo check for release build.
299 cargo check --release
300 cargo check --no-default-features --features=no-std --release
304 runs-on: ubuntu-latest
308 - name: Checkout source code
309 uses: actions/checkout@v3
310 - name: Install Rust 1.58 toolchain
311 uses: actions-rs/toolchain@v1
316 - name: Install dependencies for honggfuzz
319 sudo apt-get -y install build-essential binutils-dev libunwind-dev
320 - name: Sanity check fuzz targets on Rust ${{ env.TOOLCHAIN }}
321 run: cd fuzz && RUSTFLAGS="--cfg=fuzzing" cargo test --verbose --color always
323 run: cd fuzz && ./ci-fuzz.sh && cd ..
324 - name: Run lightning-invoice fuzzers
325 run: cd lightning-invoice/fuzz && RUSTFLAGS="--cfg=fuzzing" cargo test --verbose && ./ci-fuzz.sh
328 runs-on: ubuntu-latest
332 - name: Checkout source code
333 uses: actions/checkout@v3
334 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
335 uses: actions-rs/toolchain@v1
337 toolchain: ${{ env.TOOLCHAIN }}
340 - name: Install clippy
342 rustup component add clippy
343 - name: Run default clippy linting
345 cargo clippy -- -Aclippy::erasing_op -Aclippy::never_loop -Aclippy::if_same_then_else -Dclippy::try_err