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
54 runs-on: ${{ matrix.platform }}
56 - name: Checkout source code
57 uses: actions/checkout@v2
58 - name: Install Rust ${{ matrix.toolchain }} toolchain
59 uses: actions-rs/toolchain@v1
61 toolchain: ${{ matrix.toolchain }}
64 - name: Build on Rust ${{ matrix.toolchain }} with net-tokio
65 if: "matrix.build-net-tokio && !matrix.coverage"
66 run: cargo build --verbose --color always
67 - name: Build on Rust ${{ matrix.toolchain }} with net-tokio and full code-linking for coverage generation
69 run: RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always
70 - name: Build on Rust ${{ matrix.toolchain }}
71 if: "! matrix.build-net-tokio"
73 cargo build --verbose --color always -p lightning
74 cargo build --verbose --color always -p lightning-invoice
75 cargo build --verbose --color always -p lightning-persister
76 - name: Build Block Sync Clients on Rust ${{ matrix.toolchain }} with features
77 if: "matrix.build-net-tokio && !matrix.coverage"
79 cd lightning-block-sync
80 cargo build --verbose --color always --features rest-client
81 cargo build --verbose --color always --features rpc-client
82 cargo build --verbose --color always --features rpc-client,rest-client
83 cargo build --verbose --color always --features rpc-client,rest-client,tokio
84 - name: Build Block Sync Clients on Rust ${{ matrix.toolchain }} with features and full code-linking for coverage generation
87 cd lightning-block-sync
88 RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always --features rest-client
89 RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always --features rpc-client
90 RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always --features rpc-client,rest-client
91 RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always --features rpc-client,rest-client,tokio
92 - name: Test on Rust ${{ matrix.toolchain }} with net-tokio
93 if: "matrix.build-net-tokio && !matrix.coverage"
94 run: cargo test --verbose --color always
95 - name: Test on Rust ${{ matrix.toolchain }} with net-tokio and full code-linking for coverage generation
97 run: RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always
98 - name: Test on no-std bullds Rust ${{ matrix.toolchain }}
99 if: "matrix.build-no-std && !matrix.coverage"
102 cargo test --verbose --color always --no-default-features --features no-std
103 # check if there is a conflict between no-std and the default std feature
104 cargo test --verbose --color always --features no-std
106 - name: Test on no-std builds Rust ${{ matrix.toolchain }} and full code-linking for coverage generation
107 if: "matrix.build-no-std && matrix.coverage"
110 RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --no-default-features --features no-std
112 - name: Test on Rust ${{ matrix.toolchain }}
113 if: "! matrix.build-net-tokio"
115 cargo test --verbose --color always -p lightning
116 cargo test --verbose --color always -p lightning-invoice
117 cargo build --verbose --color always -p lightning-persister
118 - name: Test Block Sync Clients on Rust ${{ matrix.toolchain }} with features
119 if: "matrix.build-net-tokio && !matrix.coverage"
121 cd lightning-block-sync
122 cargo test --verbose --color always --features rest-client
123 cargo test --verbose --color always --features rpc-client
124 cargo test --verbose --color always --features rpc-client,rest-client
125 cargo test --verbose --color always --features rpc-client,rest-client,tokio
126 - name: Test Block Sync Clients on Rust ${{ matrix.toolchain }} with features and full code-linking for coverage generation
129 cd lightning-block-sync
130 RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --features rest-client
131 RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --features rpc-client
132 RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --features rpc-client,rest-client
133 RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --features rpc-client,rest-client,tokio
134 - name: Install deps for kcov
138 sudo apt-get -y install binutils-dev libcurl4-openssl-dev zlib1g-dev libdw-dev libiberty-dev
142 wget https://github.com/SimonKagstrom/kcov/archive/master.tar.gz
143 tar xzf master.tar.gz
144 cd kcov-master && mkdir build && cd build
147 make install DESTDIR=../../kcov-build
148 cd ../.. && rm -rf kcov-master master.tar.gz
149 - name: Generate coverage report
152 for file in target/debug/deps/lightning*; do
153 [ -x "${file}" ] || continue;
154 mkdir -p "target/cov/$(basename $file)";
155 ./kcov-build/usr/local/bin/kcov --exclude-pattern=/.cargo,/usr/lib --verify "target/cov/$(basename $file)" "$file";
157 - name: Upload coverage
159 uses: codecov/codecov-action@v1
161 # Could you use this to fake the coverage report for your PR? Sure.
162 # Will anyone be impressed by your amazing coverage? No
163 # Maybe if codecov wasn't broken we wouldn't need to do this...
164 token: f421b687-4dc2-4387-ac3d-dc3b2528af57
165 fail_ci_if_error: true
168 runs-on: ubuntu-latest
172 - name: Checkout source code
173 uses: actions/checkout@v2
174 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
175 uses: actions-rs/toolchain@v1
177 toolchain: ${{ env.TOOLCHAIN }}
180 - name: Cache routing graph snapshot
182 uses: actions/cache@v2
184 path: lightning/net_graph-2021-05-31.bin
185 key: ldk-net_graph-v0.0.15-2021-05-31.bin
186 - name: Fetch routing graph snapshot
187 if: steps.cache-graph.outputs.cache-hit != 'true'
189 wget -O lightning/net_graph-2021-05-31.bin https://bitcoin.ninja/ldk-net_graph-v0.0.15-2021-05-31.bin
190 if [ "$(sha256sum lightning/net_graph-2021-05-31.bin | awk '{ print $1 }')" != "05a5361278f68ee2afd086cc04a1f927a63924be451f3221d380533acfacc303" ]; then
194 - name: Test with Network Graph on Rust ${{ matrix.toolchain }}
197 RUSTFLAGS="--cfg=require_route_graph_test" cargo test
198 RUSTFLAGS="--cfg=require_route_graph_test" cargo test --features hashbrown
200 - name: Run benchmarks on Rust ${{ matrix.toolchain }}
202 cargo bench --features unstable
205 runs-on: ubuntu-latest
207 # rustc 1.53 regressed and panics when building our (perfectly fine) docs.
208 # See https://github.com/rust-lang/rust/issues/84738
211 - name: Checkout source code
212 uses: actions/checkout@v2
215 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
216 uses: actions-rs/toolchain@v1
218 toolchain: ${{ env.TOOLCHAIN }}
221 - name: Fetch full tree and rebase on upstream
223 git remote add upstream https://github.com/rust-bitcoin/rust-lightning
225 export GIT_COMMITTER_EMAIL="rl-ci@example.com"
226 export GIT_COMMITTER_NAME="RL CI"
227 git rebase upstream/main
228 - name: For each commit, run cargo check (including in fuzz)
229 run: ci/check-each-commit.sh upstream/main
232 runs-on: ubuntu-latest
236 - name: Checkout source code
237 uses: actions/checkout@v2
238 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
239 uses: actions-rs/toolchain@v1
241 toolchain: ${{ env.TOOLCHAIN }}
244 - name: Install dependencies for honggfuzz
247 sudo apt-get -y install build-essential binutils-dev libunwind-dev
248 - name: Sanity check fuzz targets on Rust ${{ env.TOOLCHAIN }}
249 run: cd fuzz && RUSTFLAGS="--cfg=fuzzing" cargo test --verbose --color always
251 run: cd fuzz && ./ci-fuzz.sh && cd ..
252 - name: Run lightning-invoice fuzzers
253 run: cd lightning-invoice/fuzz && RUSTFLAGS="--cfg=fuzzing" cargo test --verbose && ./ci-fuzz.sh
256 runs-on: ubuntu-latest
260 - name: Checkout source code
261 uses: actions/checkout@v2
262 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
263 uses: actions-rs/toolchain@v1
265 toolchain: ${{ env.TOOLCHAIN }}
268 - name: Install clippy
270 rustup component add clippy
271 - name: Run default clippy linting
273 cargo clippy -- -Aclippy::erasing_op -Aclippy::never_loop -Aclippy::if_same_then_else -Dclippy::try_err