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
65 - name: Build on Rust ${{ matrix.toolchain }} with net-tokio
66 if: "matrix.build-net-tokio && !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 }}
72 if: "! matrix.build-net-tokio"
74 cargo build --verbose --color always -p lightning
75 cargo build --verbose --color always -p lightning-invoice
76 cargo build --verbose --color always -p lightning-persister
77 - name: Build on Rust ${{ matrix.toolchain }} with all Log-Limiting features
78 if: matrix.test-log-variants
81 for FEATURE in $(cat Cargo.toml | grep '^max_level_' | awk '{ print $1 }'); do
82 cargo build --verbose --color always --features $FEATURE
84 - name: Build Block Sync Clients on Rust ${{ matrix.toolchain }} with features
85 if: "matrix.build-net-tokio && !matrix.coverage"
87 cd lightning-block-sync
88 cargo build --verbose --color always --features rest-client
89 cargo build --verbose --color always --features rpc-client
90 cargo build --verbose --color always --features rpc-client,rest-client
91 cargo build --verbose --color always --features rpc-client,rest-client,tokio
92 - name: Build Block Sync Clients on Rust ${{ matrix.toolchain }} with features and full code-linking for coverage generation
95 cd lightning-block-sync
96 RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always --features rest-client
97 RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always --features rpc-client
98 RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always --features rpc-client,rest-client
99 RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always --features rpc-client,rest-client,tokio
100 - name: Test backtrace-debug builds on Rust ${{ matrix.toolchain }}
101 if: "matrix.build-no-std"
103 cd lightning && cargo test --verbose --color always --features backtrace
104 - name: Test on Rust ${{ matrix.toolchain }} with net-tokio
105 if: "matrix.build-net-tokio && !matrix.coverage"
106 run: cargo test --verbose --color always
107 - name: Test on Rust ${{ matrix.toolchain }} with net-tokio and full code-linking for coverage generation
109 run: RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always
110 - name: Test on no-std bullds Rust ${{ matrix.toolchain }}
111 if: "matrix.build-no-std && !matrix.coverage"
112 shell: bash # Default on Winblows is powershell
115 cargo test --verbose --color always --no-default-features --features no-std
116 # check if there is a conflict between no-std and the default std feature
117 cargo test --verbose --color always --features no-std
118 # check that things still pass without grind_signatures
119 # note that outbound_commitment_test only runs in this mode, because of hardcoded signature values
120 cargo test --verbose --color always --no-default-features --features std
121 # check if there is a conflict between no-std and the c_bindings cfg
122 RUSTFLAGS="--cfg=c_bindings" cargo test --verbose --color always --no-default-features --features=no-std
125 cargo test --verbose --color always --no-default-features --features no-std
126 # check if there is a conflict between no-std and the default std feature
127 cargo test --verbose --color always --features no-std
128 # check no-std compatibility across dependencies
131 cargo check --verbose --color always
133 - name: Test on no-std builds Rust ${{ matrix.toolchain }} and full code-linking for coverage generation
134 if: "matrix.build-no-std && matrix.coverage"
137 RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --no-default-features --features no-std
139 - name: Test on Rust ${{ matrix.toolchain }}
140 if: "! matrix.build-net-tokio"
142 cargo test --verbose --color always -p lightning
143 cargo test --verbose --color always -p lightning-invoice
144 cargo build --verbose --color always -p lightning-persister
145 cargo build --verbose --color always -p lightning-background-processor
146 - name: Test C Bindings Modifications on Rust ${{ matrix.toolchain }}
147 if: "! matrix.build-net-tokio"
149 RUSTFLAGS="--cfg=c_bindings" cargo test --verbose --color always -p lightning
150 RUSTFLAGS="--cfg=c_bindings" cargo test --verbose --color always -p lightning-invoice
151 RUSTFLAGS="--cfg=c_bindings" cargo build --verbose --color always -p lightning-persister
152 RUSTFLAGS="--cfg=c_bindings" cargo build --verbose --color always -p lightning-background-processor
153 - name: Test Block Sync Clients on Rust ${{ matrix.toolchain }} with features
154 if: "matrix.build-net-tokio && !matrix.coverage"
156 cd lightning-block-sync
157 cargo test --verbose --color always --features rest-client
158 cargo test --verbose --color always --features rpc-client
159 cargo test --verbose --color always --features rpc-client,rest-client
160 cargo test --verbose --color always --features rpc-client,rest-client,tokio
161 - name: Test Block Sync Clients on Rust ${{ matrix.toolchain }} with features and full code-linking for coverage generation
164 cd lightning-block-sync
165 RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --features rest-client
166 RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --features rpc-client
167 RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --features rpc-client,rest-client
168 RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --features rpc-client,rest-client,tokio
169 - name: Install deps for kcov
173 sudo apt-get -y install binutils-dev libcurl4-openssl-dev zlib1g-dev libdw-dev libiberty-dev
177 wget https://github.com/SimonKagstrom/kcov/archive/master.tar.gz
178 tar xzf master.tar.gz
179 cd kcov-master && mkdir build && cd build
182 make install DESTDIR=../../kcov-build
183 cd ../.. && rm -rf kcov-master master.tar.gz
184 - name: Generate coverage report
187 for file in target/debug/deps/lightning*; do
188 [ -x "${file}" ] || continue;
189 mkdir -p "target/cov/$(basename $file)";
190 ./kcov-build/usr/local/bin/kcov --exclude-pattern=/.cargo,/usr/lib --verify "target/cov/$(basename $file)" "$file";
192 - name: Upload coverage
194 uses: codecov/codecov-action@v3
196 # Could you use this to fake the coverage report for your PR? Sure.
197 # Will anyone be impressed by your amazing coverage? No
198 # Maybe if codecov wasn't broken we wouldn't need to do this...
199 token: f421b687-4dc2-4387-ac3d-dc3b2528af57
200 fail_ci_if_error: true
203 runs-on: ubuntu-latest
207 - name: Checkout source code
208 uses: actions/checkout@v3
209 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
210 uses: actions-rs/toolchain@v1
212 toolchain: ${{ env.TOOLCHAIN }}
215 - name: Cache routing graph snapshot
217 uses: actions/cache@v3
219 path: lightning/net_graph-2021-05-31.bin
220 key: ldk-net_graph-v0.0.15-2021-05-31.bin
221 - name: Fetch routing graph snapshot
222 if: steps.cache-graph.outputs.cache-hit != 'true'
224 wget -O lightning/net_graph-2021-05-31.bin https://bitcoin.ninja/ldk-net_graph-v0.0.15-2021-05-31.bin
225 if [ "$(sha256sum lightning/net_graph-2021-05-31.bin | awk '{ print $1 }')" != "05a5361278f68ee2afd086cc04a1f927a63924be451f3221d380533acfacc303" ]; then
229 - name: Test with Network Graph on Rust ${{ matrix.toolchain }}
232 RUSTFLAGS="--cfg=require_route_graph_test" cargo test
233 RUSTFLAGS="--cfg=require_route_graph_test" cargo test --features hashbrown
235 - name: Run benchmarks on Rust ${{ matrix.toolchain }}
237 cargo bench --features _bench_unstable
240 runs-on: ubuntu-latest
244 - name: Checkout source code
245 uses: actions/checkout@v3
248 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
249 uses: actions-rs/toolchain@v1
251 toolchain: ${{ env.TOOLCHAIN }}
254 - name: Fetch full tree and rebase on upstream
256 git remote add upstream https://github.com/lightningdevkit/rust-lightning
258 export GIT_COMMITTER_EMAIL="rl-ci@example.com"
259 export GIT_COMMITTER_NAME="RL CI"
260 git rebase upstream/main
261 - name: For each commit, run cargo check (including in fuzz)
262 run: ci/check-each-commit.sh upstream/main
265 runs-on: ubuntu-latest
269 - name: Checkout source code
270 uses: actions/checkout@v3
271 - name: Install Rust 1.58 toolchain
272 uses: actions-rs/toolchain@v1
277 - name: Install dependencies for honggfuzz
280 sudo apt-get -y install build-essential binutils-dev libunwind-dev
281 - name: Sanity check fuzz targets on Rust ${{ env.TOOLCHAIN }}
282 run: cd fuzz && RUSTFLAGS="--cfg=fuzzing" cargo test --verbose --color always
284 run: cd fuzz && ./ci-fuzz.sh && cd ..
285 - name: Run lightning-invoice fuzzers
286 run: cd lightning-invoice/fuzz && RUSTFLAGS="--cfg=fuzzing" cargo test --verbose && ./ci-fuzz.sh
289 runs-on: ubuntu-latest
293 - name: Checkout source code
294 uses: actions/checkout@v3
295 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
296 uses: actions-rs/toolchain@v1
298 toolchain: ${{ env.TOOLCHAIN }}
301 - name: Install clippy
303 rustup component add clippy
304 - name: Run default clippy linting
306 cargo clippy -- -Aclippy::erasing_op -Aclippy::never_loop -Aclippy::if_same_then_else -Dclippy::try_err