1 name: Continuous Integration Checks
3 on: [push, pull_request]
10 platform: [ ubuntu-latest ]
13 # 1.36.0 is MSRV for Rust-Lightning, lightning-invoice, and lightning-persister
15 # 1.41.0 is Debian stable
17 # 1.45.2 is MSRV for lightning-net-tokio, lightning-block-sync, and coverage generation
19 # 1.47.0 will be the MSRV for no-std builds using hashbrown once core2 is updated
26 platform: macos-latest
30 platform: macos-latest
34 platform: windows-latest
38 platform: windows-latest
46 test-log-variants: true
55 runs-on: ${{ matrix.platform }}
57 - name: Checkout source code
58 uses: actions/checkout@v2
59 - name: Install Rust ${{ matrix.toolchain }} toolchain
60 uses: actions-rs/toolchain@v1
62 toolchain: ${{ matrix.toolchain }}
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 on Rust ${{ matrix.toolchain }} with net-tokio
101 if: "matrix.build-net-tokio && !matrix.coverage"
102 run: cargo test --verbose --color always
103 - name: Test on Rust ${{ matrix.toolchain }} with net-tokio and full code-linking for coverage generation
105 run: RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always
106 - name: Test on no-std bullds Rust ${{ matrix.toolchain }}
107 if: "matrix.build-no-std && !matrix.coverage"
110 cargo test --verbose --color always --no-default-features --features no-std
111 # check if there is a conflict between no-std and the default std feature
112 cargo test --verbose --color always --features no-std
114 - name: Test on no-std builds Rust ${{ matrix.toolchain }} and full code-linking for coverage generation
115 if: "matrix.build-no-std && matrix.coverage"
118 RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --no-default-features --features no-std
120 - name: Test on Rust ${{ matrix.toolchain }}
121 if: "! matrix.build-net-tokio"
123 cargo test --verbose --color always -p lightning
124 cargo test --verbose --color always -p lightning-invoice
125 cargo build --verbose --color always -p lightning-persister
126 cargo build --verbose --color always -p lightning-background-processor
127 - name: Test C Bindings Modifications on Rust ${{ matrix.toolchain }}
128 if: "! matrix.build-net-tokio"
130 RUSTFLAGS="--cfg=c_bindings" cargo test --verbose --color always -p lightning
131 RUSTFLAGS="--cfg=c_bindings" cargo test --verbose --color always -p lightning-invoice
132 RUSTFLAGS="--cfg=c_bindings" cargo build --verbose --color always -p lightning-persister
133 RUSTFLAGS="--cfg=c_bindings" cargo build --verbose --color always -p lightning-background-processor
134 - name: Test Block Sync Clients on Rust ${{ matrix.toolchain }} with features
135 if: "matrix.build-net-tokio && !matrix.coverage"
137 cd lightning-block-sync
138 cargo test --verbose --color always --features rest-client
139 cargo test --verbose --color always --features rpc-client
140 cargo test --verbose --color always --features rpc-client,rest-client
141 cargo test --verbose --color always --features rpc-client,rest-client,tokio
142 - name: Test Block Sync Clients on Rust ${{ matrix.toolchain }} with features and full code-linking for coverage generation
145 cd lightning-block-sync
146 RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --features rest-client
147 RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --features rpc-client
148 RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --features rpc-client,rest-client
149 RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --features rpc-client,rest-client,tokio
150 - name: Install deps for kcov
154 sudo apt-get -y install binutils-dev libcurl4-openssl-dev zlib1g-dev libdw-dev libiberty-dev
158 wget https://github.com/SimonKagstrom/kcov/archive/master.tar.gz
159 tar xzf master.tar.gz
160 cd kcov-master && mkdir build && cd build
163 make install DESTDIR=../../kcov-build
164 cd ../.. && rm -rf kcov-master master.tar.gz
165 - name: Generate coverage report
168 for file in target/debug/deps/lightning*; do
169 [ -x "${file}" ] || continue;
170 mkdir -p "target/cov/$(basename $file)";
171 ./kcov-build/usr/local/bin/kcov --exclude-pattern=/.cargo,/usr/lib --verify "target/cov/$(basename $file)" "$file";
173 - name: Upload coverage
175 uses: codecov/codecov-action@v2
177 # Could you use this to fake the coverage report for your PR? Sure.
178 # Will anyone be impressed by your amazing coverage? No
179 # Maybe if codecov wasn't broken we wouldn't need to do this...
180 token: f421b687-4dc2-4387-ac3d-dc3b2528af57
181 fail_ci_if_error: true
184 runs-on: ubuntu-latest
188 - name: Checkout source code
189 uses: actions/checkout@v2
190 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
191 uses: actions-rs/toolchain@v1
193 toolchain: ${{ env.TOOLCHAIN }}
196 - name: Cache routing graph snapshot
198 uses: actions/cache@v2
200 path: lightning/net_graph-2021-05-31.bin
201 key: ldk-net_graph-v0.0.15-2021-05-31.bin
202 - name: Fetch routing graph snapshot
203 if: steps.cache-graph.outputs.cache-hit != 'true'
205 wget -O lightning/net_graph-2021-05-31.bin https://bitcoin.ninja/ldk-net_graph-v0.0.15-2021-05-31.bin
206 if [ "$(sha256sum lightning/net_graph-2021-05-31.bin | awk '{ print $1 }')" != "05a5361278f68ee2afd086cc04a1f927a63924be451f3221d380533acfacc303" ]; then
210 - name: Test with Network Graph on Rust ${{ matrix.toolchain }}
213 RUSTFLAGS="--cfg=require_route_graph_test" cargo test
214 RUSTFLAGS="--cfg=require_route_graph_test" cargo test --features hashbrown
216 - name: Run benchmarks on Rust ${{ matrix.toolchain }}
218 cargo bench --features unstable
221 runs-on: ubuntu-latest
223 # rustc 1.53 regressed and panics when building our (perfectly fine) docs.
224 # See https://github.com/rust-lang/rust/issues/84738
227 - name: Checkout source code
228 uses: actions/checkout@v2
231 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
232 uses: actions-rs/toolchain@v1
234 toolchain: ${{ env.TOOLCHAIN }}
237 - name: Fetch full tree and rebase on upstream
239 git remote add upstream https://github.com/rust-bitcoin/rust-lightning
241 export GIT_COMMITTER_EMAIL="rl-ci@example.com"
242 export GIT_COMMITTER_NAME="RL CI"
243 git rebase upstream/main
244 - name: For each commit, run cargo check (including in fuzz)
245 run: ci/check-each-commit.sh upstream/main
248 runs-on: ubuntu-latest
252 - name: Checkout source code
253 uses: actions/checkout@v2
254 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
255 uses: actions-rs/toolchain@v1
257 toolchain: ${{ env.TOOLCHAIN }}
260 - name: Install dependencies for honggfuzz
263 sudo apt-get -y install build-essential binutils-dev libunwind-dev
264 - name: Sanity check fuzz targets on Rust ${{ env.TOOLCHAIN }}
265 run: cd fuzz && RUSTFLAGS="--cfg=fuzzing" cargo test --verbose --color always
267 run: cd fuzz && ./ci-fuzz.sh && cd ..
268 - name: Run lightning-invoice fuzzers
269 run: cd lightning-invoice/fuzz && RUSTFLAGS="--cfg=fuzzing" cargo test --verbose && ./ci-fuzz.sh
272 runs-on: ubuntu-latest
276 - name: Checkout source code
277 uses: actions/checkout@v2
278 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
279 uses: actions-rs/toolchain@v1
281 toolchain: ${{ env.TOOLCHAIN }}
284 - name: Install clippy
286 rustup component add clippy
287 - name: Run default clippy linting
289 cargo clippy -- -Aclippy::erasing_op -Aclippy::never_loop -Aclippy::if_same_then_else -Dclippy::try_err