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
50 build-net-old-tokio: true
56 runs-on: ${{ matrix.platform }}
58 - name: Checkout source code
59 uses: actions/checkout@v2
60 - name: Install Rust ${{ matrix.toolchain }} toolchain
61 uses: actions-rs/toolchain@v1
63 toolchain: ${{ matrix.toolchain }}
66 - name: Pin tokio to 1.14 for Rust 1.45
67 if: "matrix.build-net-old-tokio"
68 run: cargo update -p tokio --precise "1.14.0" --verbose
69 - name: Build on Rust ${{ matrix.toolchain }} with net-tokio
70 if: "matrix.build-net-tokio && !matrix.coverage"
71 run: cargo build --verbose --color always
72 - name: Build on Rust ${{ matrix.toolchain }} with net-tokio and full code-linking for coverage generation
74 run: RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always
75 - name: Build on Rust ${{ matrix.toolchain }}
76 if: "! matrix.build-net-tokio"
78 cargo build --verbose --color always -p lightning
79 cargo build --verbose --color always -p lightning-invoice
80 cargo build --verbose --color always -p lightning-persister
81 - name: Build on Rust ${{ matrix.toolchain }} with all Log-Limiting features
82 if: matrix.test-log-variants
85 for FEATURE in $(cat Cargo.toml | grep '^max_level_' | awk '{ print $1 }'); do
86 cargo build --verbose --color always --features $FEATURE
88 - name: Build Block Sync Clients on Rust ${{ matrix.toolchain }} with features
89 if: "matrix.build-net-tokio && !matrix.coverage"
91 cd lightning-block-sync
92 cargo build --verbose --color always --features rest-client
93 cargo build --verbose --color always --features rpc-client
94 cargo build --verbose --color always --features rpc-client,rest-client
95 cargo build --verbose --color always --features rpc-client,rest-client,tokio
96 - name: Build Block Sync Clients on Rust ${{ matrix.toolchain }} with features and full code-linking for coverage generation
99 cd lightning-block-sync
100 RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always --features rest-client
101 RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always --features rpc-client
102 RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always --features rpc-client,rest-client
103 RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always --features rpc-client,rest-client,tokio
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 if there is a conflict between no-std and the c_bindings cfg
119 RUSTFLAGS="--cfg=c_bindings" cargo test --verbose --color always --no-default-features --features=no-std
121 - name: Test on no-std builds Rust ${{ matrix.toolchain }} and full code-linking for coverage generation
122 if: "matrix.build-no-std && matrix.coverage"
125 RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --no-default-features --features no-std
127 - name: Test on Rust ${{ matrix.toolchain }}
128 if: "! matrix.build-net-tokio"
130 cargo test --verbose --color always -p lightning
131 cargo test --verbose --color always -p lightning-invoice
132 cargo build --verbose --color always -p lightning-persister
133 cargo build --verbose --color always -p lightning-background-processor
134 - name: Test C Bindings Modifications on Rust ${{ matrix.toolchain }}
135 if: "! matrix.build-net-tokio"
137 RUSTFLAGS="--cfg=c_bindings" cargo test --verbose --color always -p lightning
138 RUSTFLAGS="--cfg=c_bindings" cargo test --verbose --color always -p lightning-invoice
139 RUSTFLAGS="--cfg=c_bindings" cargo build --verbose --color always -p lightning-persister
140 RUSTFLAGS="--cfg=c_bindings" cargo build --verbose --color always -p lightning-background-processor
141 - name: Test Block Sync Clients on Rust ${{ matrix.toolchain }} with features
142 if: "matrix.build-net-tokio && !matrix.coverage"
144 cd lightning-block-sync
145 cargo test --verbose --color always --features rest-client
146 cargo test --verbose --color always --features rpc-client
147 cargo test --verbose --color always --features rpc-client,rest-client
148 cargo test --verbose --color always --features rpc-client,rest-client,tokio
149 - name: Test Block Sync Clients on Rust ${{ matrix.toolchain }} with features and full code-linking for coverage generation
152 cd lightning-block-sync
153 RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --features rest-client
154 RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --features rpc-client
155 RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --features rpc-client,rest-client
156 RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --features rpc-client,rest-client,tokio
157 - name: Install deps for kcov
161 sudo apt-get -y install binutils-dev libcurl4-openssl-dev zlib1g-dev libdw-dev libiberty-dev
165 wget https://github.com/SimonKagstrom/kcov/archive/master.tar.gz
166 tar xzf master.tar.gz
167 cd kcov-master && mkdir build && cd build
170 make install DESTDIR=../../kcov-build
171 cd ../.. && rm -rf kcov-master master.tar.gz
172 - name: Generate coverage report
175 for file in target/debug/deps/lightning*; do
176 [ -x "${file}" ] || continue;
177 mkdir -p "target/cov/$(basename $file)";
178 ./kcov-build/usr/local/bin/kcov --exclude-pattern=/.cargo,/usr/lib --verify "target/cov/$(basename $file)" "$file";
180 - name: Upload coverage
182 uses: codecov/codecov-action@v2
184 # Could you use this to fake the coverage report for your PR? Sure.
185 # Will anyone be impressed by your amazing coverage? No
186 # Maybe if codecov wasn't broken we wouldn't need to do this...
187 token: f421b687-4dc2-4387-ac3d-dc3b2528af57
188 fail_ci_if_error: true
191 runs-on: ubuntu-latest
195 - name: Checkout source code
196 uses: actions/checkout@v2
197 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
198 uses: actions-rs/toolchain@v1
200 toolchain: ${{ env.TOOLCHAIN }}
203 - name: Cache routing graph snapshot
205 uses: actions/cache@v2
207 path: lightning/net_graph-2021-05-31.bin
208 key: ldk-net_graph-v0.0.15-2021-05-31.bin
209 - name: Fetch routing graph snapshot
210 if: steps.cache-graph.outputs.cache-hit != 'true'
212 wget -O lightning/net_graph-2021-05-31.bin https://bitcoin.ninja/ldk-net_graph-v0.0.15-2021-05-31.bin
213 if [ "$(sha256sum lightning/net_graph-2021-05-31.bin | awk '{ print $1 }')" != "05a5361278f68ee2afd086cc04a1f927a63924be451f3221d380533acfacc303" ]; then
217 - name: Test with Network Graph on Rust ${{ matrix.toolchain }}
220 RUSTFLAGS="--cfg=require_route_graph_test" cargo test
221 RUSTFLAGS="--cfg=require_route_graph_test" cargo test --features hashbrown
223 - name: Run benchmarks on Rust ${{ matrix.toolchain }}
225 cargo bench --features unstable
228 runs-on: ubuntu-latest
230 # rustc 1.53 regressed and panics when building our (perfectly fine) docs.
231 # See https://github.com/rust-lang/rust/issues/84738
234 - name: Checkout source code
235 uses: actions/checkout@v2
238 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
239 uses: actions-rs/toolchain@v1
241 toolchain: ${{ env.TOOLCHAIN }}
244 - name: Fetch full tree and rebase on upstream
246 git remote add upstream https://github.com/rust-bitcoin/rust-lightning
248 export GIT_COMMITTER_EMAIL="rl-ci@example.com"
249 export GIT_COMMITTER_NAME="RL CI"
250 git rebase upstream/main
251 - name: For each commit, run cargo check (including in fuzz)
252 run: ci/check-each-commit.sh upstream/main
255 runs-on: ubuntu-latest
259 - name: Checkout source code
260 uses: actions/checkout@v2
261 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
262 uses: actions-rs/toolchain@v1
264 toolchain: ${{ env.TOOLCHAIN }}
267 - name: Install dependencies for honggfuzz
270 sudo apt-get -y install build-essential binutils-dev libunwind-dev
271 - name: Sanity check fuzz targets on Rust ${{ env.TOOLCHAIN }}
272 run: cd fuzz && RUSTFLAGS="--cfg=fuzzing" cargo test --verbose --color always
274 run: cd fuzz && ./ci-fuzz.sh && cd ..
275 - name: Run lightning-invoice fuzzers
276 run: cd lightning-invoice/fuzz && RUSTFLAGS="--cfg=fuzzing" cargo test --verbose && ./ci-fuzz.sh
279 runs-on: ubuntu-latest
283 - name: Checkout source code
284 uses: actions/checkout@v2
285 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
286 uses: actions-rs/toolchain@v1
288 toolchain: ${{ env.TOOLCHAIN }}
291 - name: Install clippy
293 rustup component add clippy
294 - name: Run default clippy linting
296 cargo clippy -- -Aclippy::erasing_op -Aclippy::never_loop -Aclippy::if_same_then_else -Dclippy::try_err