1 name: Continuous Integration Checks
3 on: [push, pull_request]
10 platform: [ ubuntu-latest ]
13 # 1.48.0 is the MSRV for all LDK crates except lightning-transaction-sync and Windows
21 platform: macos-latest
25 test-custom-message: true
27 platform: macos-latest
31 platform: windows-latest
35 platform: windows-latest
42 test-custom-message: true
46 runs-on: ${{ matrix.platform }}
48 - name: Checkout source code
49 uses: actions/checkout@v3
50 - name: Install Rust ${{ matrix.toolchain }} toolchain
51 uses: actions-rs/toolchain@v1
53 toolchain: ${{ matrix.toolchain }}
56 - name: Pin tokio to 1.14 for Rust 1.45
57 run: cargo update -p tokio --precise "1.14.0" --verbose
59 CARGO_NET_GIT_FETCH_WITH_CLI: "true"
60 - name: Pin tokio to 1.26 for Windows
61 if: "matrix.platform == 'windows-latest'"
62 run: cargo update -p tokio --precise "1.26.0" --verbose
64 CARGO_NET_GIT_FETCH_WITH_CLI: "true"
65 - name: Build on Rust ${{ matrix.toolchain }} with net-tokio
66 if: "!matrix.coverage"
67 run: cargo build --verbose --color always
68 - name: Build on Rust ${{ matrix.toolchain }} with net-tokio, and full code-linking for coverage generation
70 run: RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always
71 - name: Build on Rust ${{ matrix.toolchain }} with all Log-Limiting features
72 if: matrix.test-log-variants
75 for FEATURE in $(cat Cargo.toml | grep '^max_level_' | awk '{ print $1 }'); do
76 cargo build --verbose --color always --features $FEATURE
78 - name: Build Block Sync Clients on Rust ${{ matrix.toolchain }} with features
79 if: "!matrix.coverage"
81 cd lightning-block-sync
82 cargo build --verbose --color always --features rest-client
83 cargo build --verbose --color always --features rpc-client
84 cargo build --verbose --color always --features rpc-client,rest-client
85 cargo build --verbose --color always --features rpc-client,rest-client,tokio
86 - name: Build Block Sync Clients on Rust ${{ matrix.toolchain }} with features and full code-linking for coverage generation
89 cd lightning-block-sync
90 RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always --features rest-client
91 RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always --features rpc-client
92 RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always --features rpc-client,rest-client
93 RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always --features rpc-client,rest-client,tokio
94 - name: Build Transaction Sync Clients on Rust ${{ matrix.toolchain }} with features
95 if: "matrix.build-tx-sync && !matrix.coverage"
97 cd lightning-transaction-sync
98 cargo build --verbose --color always --features esplora-blocking
99 cargo build --verbose --color always --features esplora-async
100 cargo build --verbose --color always --features esplora-async-https
101 - name: Build transaction sync clients on Rust ${{ matrix.toolchain }} with features and full code-linking for coverage generation
102 if: "matrix.build-tx-sync && matrix.coverage"
104 cd lightning-transaction-sync
105 RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always --features esplora-blocking
106 RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always --features esplora-async
107 RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always --features esplora-async-https
108 - name: Test transaction sync clients on Rust ${{ matrix.toolchain }} with features
109 if: "matrix.build-tx-sync"
111 cd lightning-transaction-sync
112 cargo test --verbose --color always --features esplora-blocking
113 cargo test --verbose --color always --features esplora-async
114 cargo test --verbose --color always --features esplora-async-https
115 - name: Test backtrace-debug builds on Rust ${{ matrix.toolchain }}
116 if: "matrix.toolchain == 'stable'"
117 shell: bash # Default on Winblows is powershell
119 cd lightning && RUST_BACKTRACE=1 cargo test --verbose --color always --features backtrace
120 - name: Test on Rust ${{ matrix.toolchain }} with net-tokio
121 if: "!matrix.coverage"
122 run: cargo test --verbose --color always
123 - name: Test on Rust ${{ matrix.toolchain }} with net-tokio, and full code-linking for coverage generation
125 run: RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always
126 - name: Test no-std builds on Rust ${{ matrix.toolchain }}
127 if: "!matrix.coverage"
128 shell: bash # Default on Winblows is powershell
130 for DIR in lightning lightning-invoice lightning-rapid-gossip-sync; do
132 cargo test --verbose --color always --no-default-features --features no-std
133 # check if there is a conflict between no-std and the default std feature
134 cargo test --verbose --color always --features no-std
135 # check that things still pass without grind_signatures
136 # note that outbound_commitment_test only runs in this mode, because of hardcoded signature values
137 cargo test --verbose --color always --no-default-features --features std
138 # check if there is a conflict between no-std and the c_bindings cfg
139 RUSTFLAGS="--cfg=c_bindings" cargo test --verbose --color always --no-default-features --features=no-std
142 # check no-std compatibility across dependencies
144 cargo check --verbose --color always --features lightning-transaction-sync
145 - name: Build no-std-check on Rust ${{ matrix.toolchain }} for ARM Embedded
146 if: "matrix.platform == 'ubuntu-latest'"
149 rustup target add thumbv7m-none-eabi
150 sudo apt-get -y install gcc-arm-none-eabi
151 cargo build --target=thumbv7m-none-eabi
152 - name: Test on no-std builds Rust ${{ matrix.toolchain }} and full code-linking for coverage generation
153 if: "matrix.coverage"
156 RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --no-default-features --features no-std
157 - name: Test futures builds on Rust ${{ matrix.toolchain }}
158 if: "matrix.build-futures && !matrix.coverage"
159 shell: bash # Default on Winblows is powershell
161 cd lightning-background-processor
162 cargo test --verbose --color always --no-default-features --features futures
163 - name: Test futures builds on Rust ${{ matrix.toolchain }} and full code-linking for coverage generation
164 if: "matrix.build-futures && matrix.coverage"
165 shell: bash # Default on Winblows is powershell
167 cd lightning-background-processor
168 RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --no-default-features --features futures
169 - name: Test Block Sync Clients on Rust ${{ matrix.toolchain }} with features
170 if: "!matrix.coverage"
172 cd lightning-block-sync
173 cargo test --verbose --color always --features rest-client
174 cargo test --verbose --color always --features rpc-client
175 cargo test --verbose --color always --features rpc-client,rest-client
176 cargo test --verbose --color always --features rpc-client,rest-client,tokio
177 - name: Test Block Sync Clients on Rust ${{ matrix.toolchain }} with features and full code-linking for coverage generation
180 cd lightning-block-sync
181 RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --features rest-client
182 RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --features rpc-client
183 RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --features rpc-client,rest-client
184 RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --features rpc-client,rest-client,tokio
185 - name: Test Custom Message Macros on Rust ${{ matrix.toolchain }}
186 if: "matrix.test-custom-message"
188 cd lightning-custom-message
189 cargo test --verbose --color always
190 - name: Install deps for kcov
194 sudo apt-get -y install binutils-dev libcurl4-openssl-dev zlib1g-dev libdw-dev libiberty-dev
198 wget https://github.com/SimonKagstrom/kcov/archive/master.tar.gz
199 tar xzf master.tar.gz
200 cd kcov-master && mkdir build && cd build
203 make install DESTDIR=../../kcov-build
204 cd ../.. && rm -rf kcov-master master.tar.gz
205 - name: Generate coverage report
208 for file in target/debug/deps/lightning*; do
209 [ -x "${file}" ] || continue;
210 mkdir -p "target/cov/$(basename $file)";
211 ./kcov-build/usr/local/bin/kcov --exclude-pattern=/.cargo,/usr/lib --verify "target/cov/$(basename $file)" "$file";
213 - name: Upload coverage
215 uses: codecov/codecov-action@v3
217 # Could you use this to fake the coverage report for your PR? Sure.
218 # Will anyone be impressed by your amazing coverage? No
219 # Maybe if codecov wasn't broken we wouldn't need to do this...
220 token: f421b687-4dc2-4387-ac3d-dc3b2528af57
221 fail_ci_if_error: true
224 runs-on: ubuntu-latest
228 - name: Checkout source code
229 uses: actions/checkout@v3
230 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
231 uses: actions-rs/toolchain@v1
233 toolchain: ${{ env.TOOLCHAIN }}
236 - name: Cache routing graph snapshot
238 uses: actions/cache@v3
240 path: lightning/net_graph-2023-01-18.bin
241 key: ldk-net_graph-v0.0.113-2023-01-18.bin
242 - name: Fetch routing graph snapshot
243 if: steps.cache-graph.outputs.cache-hit != 'true'
245 curl --verbose -L -o lightning/net_graph-2023-01-18.bin https://bitcoin.ninja/ldk-net_graph-v0.0.113-2023-01-18.bin
246 echo "Sha sum: $(sha256sum lightning/net_graph-2023-01-18.bin | awk '{ print $1 }')"
247 if [ "$(sha256sum lightning/net_graph-2023-01-18.bin | awk '{ print $1 }')" != "${EXPECTED_ROUTING_GRAPH_SNAPSHOT_SHASUM}" ]; then
252 EXPECTED_ROUTING_GRAPH_SNAPSHOT_SHASUM: da6066f2bddcddbe7d8a6debbd53545697137b310bbb8c4911bc8c81fc5ff48c
253 - name: Fetch rapid graph sync reference input
255 curl --verbose -L -o lightning-rapid-gossip-sync/res/full_graph.lngossip https://bitcoin.ninja/ldk-compressed_graph-285cb27df79-2022-07-21.bin
256 echo "Sha sum: $(sha256sum lightning-rapid-gossip-sync/res/full_graph.lngossip | awk '{ print $1 }')"
257 if [ "$(sha256sum lightning-rapid-gossip-sync/res/full_graph.lngossip | awk '{ print $1 }')" != "${EXPECTED_RAPID_GOSSIP_SHASUM}" ]; then
262 EXPECTED_RAPID_GOSSIP_SHASUM: e0f5d11641c11896d7af3a2246d3d6c3f1720b7d2d17aab321ecce82e6b7deb8
263 - name: Test with Network Graph on Rust ${{ matrix.toolchain }}
266 RUSTFLAGS="--cfg=require_route_graph_test" cargo test
267 RUSTFLAGS="--cfg=require_route_graph_test" cargo test --features hashbrown
269 - name: Run benchmarks on Rust ${{ matrix.toolchain }}
271 RUSTC_BOOTSTRAP=1 cargo bench --features _bench_unstable
274 runs-on: ubuntu-latest
278 - name: Checkout source code
279 uses: actions/checkout@v3
282 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
283 uses: actions-rs/toolchain@v1
285 toolchain: ${{ env.TOOLCHAIN }}
288 - name: Fetch full tree and rebase on upstream
290 git remote add upstream https://github.com/lightningdevkit/rust-lightning
292 export GIT_COMMITTER_EMAIL="rl-ci@example.com"
293 export GIT_COMMITTER_NAME="RL CI"
294 git rebase upstream/main
295 - name: For each commit, run cargo check (including in fuzz)
296 run: ci/check-each-commit.sh upstream/main
299 runs-on: ubuntu-latest
303 - name: Checkout source code
304 uses: actions/checkout@v3
307 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
308 uses: actions-rs/toolchain@v1
310 toolchain: ${{ env.TOOLCHAIN }}
313 - name: Run cargo check for release build.
315 cargo check --release
316 cargo check --no-default-features --features=no-std --release
317 cargo check --no-default-features --features=futures --release
321 runs-on: ubuntu-latest
325 - name: Checkout source code
326 uses: actions/checkout@v3
327 - name: Install Rust 1.58 toolchain
328 uses: actions-rs/toolchain@v1
333 - name: Install dependencies for honggfuzz
336 sudo apt-get -y install build-essential binutils-dev libunwind-dev
337 - name: Sanity check fuzz targets on Rust ${{ env.TOOLCHAIN }}
338 run: cd fuzz && RUSTFLAGS="--cfg=fuzzing" cargo test --verbose --color always
340 run: cd fuzz && ./ci-fuzz.sh && cd ..
341 - name: Run lightning-invoice fuzzers
342 run: cd lightning-invoice/fuzz && RUSTFLAGS="--cfg=fuzzing" cargo test --verbose && ./ci-fuzz.sh
345 runs-on: ubuntu-latest
349 - name: Checkout source code
350 uses: actions/checkout@v3
351 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
352 uses: actions-rs/toolchain@v1
354 toolchain: ${{ env.TOOLCHAIN }}
357 - name: Install clippy
359 rustup component add clippy
360 - name: Run default clippy linting
362 cargo clippy -- -Aclippy::erasing_op -Aclippy::never_loop -Aclippy::if_same_then_else -Dclippy::try_err