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
104 # if: matrix.coverage
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.toolchain == 'stable'"
113 shell: bash # Default on Winblows is powershell
115 cd lightning && RUSTC_BACKTRACE=1 cargo test --verbose --color always --features backtrace chain::chainmonitor::tests::test_async_ooo_offchain_updates
116 - name: Test on Rust ${{ matrix.toolchain }} with net-tokio
117 if: "matrix.build-net-tokio && !matrix.coverage"
118 run: cargo test --verbose --color always
119 - name: Test on Rust ${{ matrix.toolchain }} with net-tokio and full code-linking for coverage generation
121 run: RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always
122 - name: Test no-std builds on Rust ${{ matrix.toolchain }}
123 if: "matrix.build-no-std && !matrix.coverage"
124 shell: bash # Default on Winblows is powershell
126 for DIR in lightning lightning-invoice lightning-rapid-gossip-sync; do
128 cargo test --verbose --color always --no-default-features --features no-std
129 # check if there is a conflict between no-std and the default std feature
130 cargo test --verbose --color always --features no-std
131 # check that things still pass without grind_signatures
132 # note that outbound_commitment_test only runs in this mode, because of hardcoded signature values
133 cargo test --verbose --color always --no-default-features --features std
134 # check if there is a conflict between no-std and the c_bindings cfg
135 RUSTFLAGS="--cfg=c_bindings" cargo test --verbose --color always --no-default-features --features=no-std
138 # check no-std compatibility across dependencies
140 cargo check --verbose --color always
141 - name: Build no-std-check on Rust ${{ matrix.toolchain }} for ARM Embedded
142 if: "matrix.build-no-std && matrix.platform == 'ubuntu-latest'"
145 rustup target add thumbv7m-none-eabi
146 sudo apt-get -y install gcc-arm-none-eabi
147 cargo build --target=thumbv7m-none-eabi
148 - name: Test on no-std builds Rust ${{ matrix.toolchain }} and full code-linking for coverage generation
149 if: "matrix.build-no-std && matrix.coverage"
152 RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --no-default-features --features no-std
153 - name: Test futures builds on Rust ${{ matrix.toolchain }}
154 if: "matrix.build-futures && !matrix.coverage"
155 shell: bash # Default on Winblows is powershell
157 cd lightning-background-processor
158 cargo test --verbose --color always --no-default-features --features futures
159 - name: Test futures builds on Rust ${{ matrix.toolchain }} and full code-linking for coverage generation
160 if: "matrix.build-futures && matrix.coverage"
161 shell: bash # Default on Winblows is powershell
163 cd lightning-background-processor
164 RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --no-default-features --features futures
165 - name: Test on Rust ${{ matrix.toolchain }}
166 if: "! matrix.build-net-tokio"
168 cargo test --verbose --color always -p lightning
169 cargo test --verbose --color always -p lightning-invoice
170 cargo test --verbose --color always -p lightning-rapid-gossip-sync
171 cargo test --verbose --color always -p lightning-persister
172 cargo test --verbose --color always -p lightning-background-processor
173 - name: Test C Bindings Modifications on Rust ${{ matrix.toolchain }}
174 if: "! matrix.build-net-tokio"
176 RUSTFLAGS="--cfg=c_bindings" cargo test --verbose --color always -p lightning
177 RUSTFLAGS="--cfg=c_bindings" cargo test --verbose --color always -p lightning-invoice
178 RUSTFLAGS="--cfg=c_bindings" cargo build --verbose --color always -p lightning-persister
179 RUSTFLAGS="--cfg=c_bindings" cargo build --verbose --color always -p lightning-background-processor
180 - name: Test Block Sync Clients on Rust ${{ matrix.toolchain }} with features
181 if: "matrix.build-net-tokio && !matrix.coverage"
183 cd lightning-block-sync
184 cargo test --verbose --color always --features rest-client
185 cargo test --verbose --color always --features rpc-client
186 cargo test --verbose --color always --features rpc-client,rest-client
187 cargo test --verbose --color always --features rpc-client,rest-client,tokio
188 - name: Test Block Sync Clients on Rust ${{ matrix.toolchain }} with features and full code-linking for coverage generation
191 cd lightning-block-sync
192 RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --features rest-client
193 RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --features rpc-client
194 RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --features rpc-client,rest-client
195 RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --features rpc-client,rest-client,tokio
196 - name: Install deps for kcov
200 sudo apt-get -y install binutils-dev libcurl4-openssl-dev zlib1g-dev libdw-dev libiberty-dev
204 wget https://github.com/SimonKagstrom/kcov/archive/master.tar.gz
205 tar xzf master.tar.gz
206 cd kcov-master && mkdir build && cd build
209 make install DESTDIR=../../kcov-build
210 cd ../.. && rm -rf kcov-master master.tar.gz
211 - name: Generate coverage report
214 for file in target/debug/deps/lightning*; do
215 [ -x "${file}" ] || continue;
216 mkdir -p "target/cov/$(basename $file)";
217 ./kcov-build/usr/local/bin/kcov --exclude-pattern=/.cargo,/usr/lib --verify "target/cov/$(basename $file)" "$file";
219 - name: Upload coverage
221 uses: codecov/codecov-action@v3
223 # Could you use this to fake the coverage report for your PR? Sure.
224 # Will anyone be impressed by your amazing coverage? No
225 # Maybe if codecov wasn't broken we wouldn't need to do this...
226 token: f421b687-4dc2-4387-ac3d-dc3b2528af57
227 fail_ci_if_error: true
230 runs-on: ubuntu-latest
234 - name: Checkout source code
235 uses: actions/checkout@v3
236 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
237 uses: actions-rs/toolchain@v1
239 toolchain: ${{ env.TOOLCHAIN }}
242 - name: Cache routing graph snapshot
244 uses: actions/cache@v3
246 path: lightning/net_graph-2021-05-31.bin
247 key: ldk-net_graph-v0.0.15-2021-05-31.bin
248 - name: Fetch routing graph snapshot
249 if: steps.cache-graph.outputs.cache-hit != 'true'
251 curl --verbose -L -o lightning/net_graph-2021-05-31.bin https://bitcoin.ninja/ldk-net_graph-v0.0.15-2021-05-31.bin
252 echo "Sha sum: $(sha256sum lightning/net_graph-2021-05-31.bin | awk '{ print $1 }')"
253 if [ "$(sha256sum lightning/net_graph-2021-05-31.bin | awk '{ print $1 }')" != "${EXPECTED_ROUTING_GRAPH_SNAPSHOT_SHASUM}" ]; then
258 EXPECTED_ROUTING_GRAPH_SNAPSHOT_SHASUM: 05a5361278f68ee2afd086cc04a1f927a63924be451f3221d380533acfacc303
259 - name: Fetch rapid graph sync reference input
261 curl --verbose -L -o lightning-rapid-gossip-sync/res/full_graph.lngossip https://bitcoin.ninja/ldk-compressed_graph-285cb27df79-2022-07-21.bin
262 echo "Sha sum: $(sha256sum lightning-rapid-gossip-sync/res/full_graph.lngossip | awk '{ print $1 }')"
263 if [ "$(sha256sum lightning-rapid-gossip-sync/res/full_graph.lngossip | awk '{ print $1 }')" != "${EXPECTED_RAPID_GOSSIP_SHASUM}" ]; then
268 EXPECTED_RAPID_GOSSIP_SHASUM: e0f5d11641c11896d7af3a2246d3d6c3f1720b7d2d17aab321ecce82e6b7deb8
269 - name: Test with Network Graph on Rust ${{ matrix.toolchain }}
272 RUSTFLAGS="--cfg=require_route_graph_test" cargo test
273 RUSTFLAGS="--cfg=require_route_graph_test" cargo test --features hashbrown
275 - name: Run benchmarks on Rust ${{ matrix.toolchain }}
277 RUSTC_BOOTSTRAP=1 cargo bench --features _bench_unstable
280 runs-on: ubuntu-latest
284 - name: Checkout source code
285 uses: actions/checkout@v3
288 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
289 uses: actions-rs/toolchain@v1
291 toolchain: ${{ env.TOOLCHAIN }}
294 - name: Fetch full tree and rebase on upstream
296 git remote add upstream https://github.com/lightningdevkit/rust-lightning
298 export GIT_COMMITTER_EMAIL="rl-ci@example.com"
299 export GIT_COMMITTER_NAME="RL CI"
300 git rebase upstream/main
301 - name: For each commit, run cargo check (including in fuzz)
302 run: ci/check-each-commit.sh upstream/main
305 runs-on: ubuntu-latest
309 - name: Checkout source code
310 uses: actions/checkout@v3
313 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
314 uses: actions-rs/toolchain@v1
316 toolchain: ${{ env.TOOLCHAIN }}
319 - name: Run cargo check for release build.
321 cargo check --release
322 cargo check --no-default-features --features=no-std --release
323 cargo check --no-default-features --features=futures --release
327 runs-on: ubuntu-latest
331 - name: Checkout source code
332 uses: actions/checkout@v3
333 - name: Install Rust 1.58 toolchain
334 uses: actions-rs/toolchain@v1
339 - name: Install dependencies for honggfuzz
342 sudo apt-get -y install build-essential binutils-dev libunwind-dev
343 - name: Sanity check fuzz targets on Rust ${{ env.TOOLCHAIN }}
344 run: cd fuzz && RUSTFLAGS="--cfg=fuzzing" cargo test --verbose --color always
346 run: cd fuzz && ./ci-fuzz.sh && cd ..
347 - name: Run lightning-invoice fuzzers
348 run: cd lightning-invoice/fuzz && RUSTFLAGS="--cfg=fuzzing" cargo test --verbose && ./ci-fuzz.sh
351 runs-on: ubuntu-latest
355 - name: Checkout source code
356 uses: actions/checkout@v3
357 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
358 uses: actions-rs/toolchain@v1
360 toolchain: ${{ env.TOOLCHAIN }}
363 - name: Install clippy
365 rustup component add clippy
366 - name: Run default clippy linting
368 cargo clippy -- -Aclippy::erasing_op -Aclippy::never_loop -Aclippy::if_same_then_else -Dclippy::try_err