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 - name: Test Block Sync Clients on Rust ${{ matrix.toolchain }} with features
127 if: "matrix.build-net-tokio && !matrix.coverage"
129 cd lightning-block-sync
130 cargo test --verbose --color always --features rest-client
131 cargo test --verbose --color always --features rpc-client
132 cargo test --verbose --color always --features rpc-client,rest-client
133 cargo test --verbose --color always --features rpc-client,rest-client,tokio
134 - name: Test Block Sync Clients on Rust ${{ matrix.toolchain }} with features and full code-linking for coverage generation
137 cd lightning-block-sync
138 RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --features rest-client
139 RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --features rpc-client
140 RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --features rpc-client,rest-client
141 RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --features rpc-client,rest-client,tokio
142 - name: Install deps for kcov
146 sudo apt-get -y install binutils-dev libcurl4-openssl-dev zlib1g-dev libdw-dev libiberty-dev
150 wget https://github.com/SimonKagstrom/kcov/archive/master.tar.gz
151 tar xzf master.tar.gz
152 cd kcov-master && mkdir build && cd build
155 make install DESTDIR=../../kcov-build
156 cd ../.. && rm -rf kcov-master master.tar.gz
157 - name: Generate coverage report
160 for file in target/debug/deps/lightning*; do
161 [ -x "${file}" ] || continue;
162 mkdir -p "target/cov/$(basename $file)";
163 ./kcov-build/usr/local/bin/kcov --exclude-pattern=/.cargo,/usr/lib --verify "target/cov/$(basename $file)" "$file";
165 - name: Upload coverage
167 uses: codecov/codecov-action@v1
169 # Could you use this to fake the coverage report for your PR? Sure.
170 # Will anyone be impressed by your amazing coverage? No
171 # Maybe if codecov wasn't broken we wouldn't need to do this...
172 token: f421b687-4dc2-4387-ac3d-dc3b2528af57
173 fail_ci_if_error: true
176 runs-on: ubuntu-latest
180 - name: Checkout source code
181 uses: actions/checkout@v2
182 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
183 uses: actions-rs/toolchain@v1
185 toolchain: ${{ env.TOOLCHAIN }}
188 - name: Cache routing graph snapshot
190 uses: actions/cache@v2
192 path: lightning/net_graph-2021-05-31.bin
193 key: ldk-net_graph-v0.0.15-2021-05-31.bin
194 - name: Fetch routing graph snapshot
195 if: steps.cache-graph.outputs.cache-hit != 'true'
197 wget -O lightning/net_graph-2021-05-31.bin https://bitcoin.ninja/ldk-net_graph-v0.0.15-2021-05-31.bin
198 if [ "$(sha256sum lightning/net_graph-2021-05-31.bin | awk '{ print $1 }')" != "05a5361278f68ee2afd086cc04a1f927a63924be451f3221d380533acfacc303" ]; then
202 - name: Test with Network Graph on Rust ${{ matrix.toolchain }}
205 RUSTFLAGS="--cfg=require_route_graph_test" cargo test
206 RUSTFLAGS="--cfg=require_route_graph_test" cargo test --features hashbrown
208 - name: Run benchmarks on Rust ${{ matrix.toolchain }}
210 cargo bench --features unstable
213 runs-on: ubuntu-latest
215 # rustc 1.53 regressed and panics when building our (perfectly fine) docs.
216 # See https://github.com/rust-lang/rust/issues/84738
219 - name: Checkout source code
220 uses: actions/checkout@v2
223 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
224 uses: actions-rs/toolchain@v1
226 toolchain: ${{ env.TOOLCHAIN }}
229 - name: Fetch full tree and rebase on upstream
231 git remote add upstream https://github.com/rust-bitcoin/rust-lightning
233 export GIT_COMMITTER_EMAIL="rl-ci@example.com"
234 export GIT_COMMITTER_NAME="RL CI"
235 git rebase upstream/main
236 - name: For each commit, run cargo check (including in fuzz)
237 run: ci/check-each-commit.sh upstream/main
240 runs-on: ubuntu-latest
244 - name: Checkout source code
245 uses: actions/checkout@v2
246 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
247 uses: actions-rs/toolchain@v1
249 toolchain: ${{ env.TOOLCHAIN }}
252 - name: Install dependencies for honggfuzz
255 sudo apt-get -y install build-essential binutils-dev libunwind-dev
256 - name: Sanity check fuzz targets on Rust ${{ env.TOOLCHAIN }}
257 run: cd fuzz && RUSTFLAGS="--cfg=fuzzing" cargo test --verbose --color always
259 run: cd fuzz && ./ci-fuzz.sh && cd ..
260 - name: Run lightning-invoice fuzzers
261 run: cd lightning-invoice/fuzz && RUSTFLAGS="--cfg=fuzzing" cargo test --verbose && ./ci-fuzz.sh
264 runs-on: ubuntu-latest
268 - name: Checkout source code
269 uses: actions/checkout@v2
270 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
271 uses: actions-rs/toolchain@v1
273 toolchain: ${{ env.TOOLCHAIN }}
276 - name: Install clippy
278 rustup component add clippy
279 - name: Run default clippy linting
281 cargo clippy -- -Aclippy::erasing_op -Aclippy::never_loop -Aclippy::if_same_then_else -Dclippy::try_err