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: windows-latest
46 runs-on: ${{ matrix.platform }}
48 - name: Checkout source code
49 uses: actions/checkout@v2
50 - name: Install Rust ${{ matrix.toolchain }} toolchain
51 uses: actions-rs/toolchain@v1
53 toolchain: ${{ matrix.toolchain }}
56 - name: Build on Rust ${{ matrix.toolchain }} with net-tokio
57 if: "matrix.build-net-tokio && !matrix.coverage"
58 run: cargo build --verbose --color always
59 - name: Build on Rust ${{ matrix.toolchain }} with net-tokio and full code-linking for coverage generation
61 run: RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always
62 - name: Build on Rust ${{ matrix.toolchain }}
63 if: "! matrix.build-net-tokio"
65 cargo build --verbose --color always -p lightning
66 cargo build --verbose --color always -p lightning-invoice
67 cargo build --verbose --color always -p lightning-persister
68 - name: Build Block Sync Clients on Rust ${{ matrix.toolchain }} with features
69 if: "matrix.build-net-tokio && !matrix.coverage"
71 cd lightning-block-sync
72 cargo build --verbose --color always --features rest-client
73 cargo build --verbose --color always --features rpc-client
74 cargo build --verbose --color always --features rpc-client,rest-client
75 cargo build --verbose --color always --features rpc-client,rest-client,tokio
76 - name: Build Block Sync Clients on Rust ${{ matrix.toolchain }} with features and full code-linking for coverage generation
79 cd lightning-block-sync
80 RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always --features rest-client
81 RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always --features rpc-client
82 RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always --features rpc-client,rest-client
83 RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always --features rpc-client,rest-client,tokio
84 - name: Test on Rust ${{ matrix.toolchain }} with net-tokio
85 if: "matrix.build-net-tokio && !matrix.coverage"
86 run: cargo test --verbose --color always
87 - name: Test on Rust ${{ matrix.toolchain }} with net-tokio and full code-linking for coverage generation
89 run: RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always
90 - name: Test on no_std bullds Rust ${{ matrix.toolchain }}
91 if: "matrix.build-no-std && !matrix.coverage"
94 cargo test --verbose --color always --no-default-features --features no_std
95 # check if there is a conflict between no_std and the default std feature
96 cargo test --verbose --color always --features no_std
98 - name: Test on no_std bullds Rust ${{ matrix.toolchain }} and full code-linking for coverage generation
99 if: "matrix.build-no-std && matrix.coverage"
102 RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --no-default-features --features no_std
104 - name: Test on Rust ${{ matrix.toolchain }}
105 if: "! matrix.build-net-tokio"
107 cargo test --verbose --color always -p lightning
108 cargo test --verbose --color always -p lightning-invoice
109 cargo build --verbose --color always -p lightning-persister
110 - name: Test Block Sync Clients on Rust ${{ matrix.toolchain }} with features
111 if: "matrix.build-net-tokio && !matrix.coverage"
113 cd lightning-block-sync
114 cargo test --verbose --color always --features rest-client
115 cargo test --verbose --color always --features rpc-client
116 cargo test --verbose --color always --features rpc-client,rest-client
117 cargo test --verbose --color always --features rpc-client,rest-client,tokio
118 - name: Test Block Sync Clients on Rust ${{ matrix.toolchain }} with features and full code-linking for coverage generation
121 cd lightning-block-sync
122 RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --features rest-client
123 RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --features rpc-client
124 RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --features rpc-client,rest-client
125 RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --features rpc-client,rest-client,tokio
126 - name: Install deps for kcov
130 sudo apt-get -y install binutils-dev libcurl4-openssl-dev zlib1g-dev libdw-dev libiberty-dev
134 wget https://github.com/SimonKagstrom/kcov/archive/master.tar.gz
135 tar xzf master.tar.gz
136 cd kcov-master && mkdir build && cd build
139 make install DESTDIR=../../kcov-build
140 cd ../.. && rm -rf kcov-master master.tar.gz
141 - name: Generate coverage report
144 for file in target/debug/deps/lightning*; do
145 [ -x "${file}" ] || continue;
146 mkdir -p "target/cov/$(basename $file)";
147 ./kcov-build/usr/local/bin/kcov --exclude-pattern=/.cargo,/usr/lib --verify "target/cov/$(basename $file)" "$file";
149 - name: Upload coverage
151 uses: codecov/codecov-action@v1
153 # Could you use this to fake the coverage report for your PR? Sure.
154 # Will anyone be impressed by your amazing coverage? No
155 # Maybe if codecov wasn't broken we wouldn't need to do this...
156 token: f421b687-4dc2-4387-ac3d-dc3b2528af57
157 fail_ci_if_error: true
160 runs-on: ubuntu-latest
164 - name: Checkout source code
165 uses: actions/checkout@v2
166 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
167 uses: actions-rs/toolchain@v1
169 toolchain: ${{ env.TOOLCHAIN }}
172 - name: Cache routing graph snapshot
174 uses: actions/cache@v2
176 path: lightning/net_graph-2021-05-31.bin
177 key: ldk-net_graph-v0.0.15-2021-05-31.bin
178 - name: Fetch routing graph snapshot
179 if: steps.cache-graph.outputs.cache-hit != 'true'
181 wget -O lightning/net_graph-2021-05-31.bin https://bitcoin.ninja/ldk-net_graph-v0.0.15-2021-05-31.bin
182 if [ "$(sha256sum lightning/net_graph-2021-05-31.bin | awk '{ print $1 }')" != "05a5361278f68ee2afd086cc04a1f927a63924be451f3221d380533acfacc303" ]; then
186 - name: Test with Network Graph on Rust ${{ matrix.toolchain }}
189 RUSTFLAGS="--cfg=require_route_graph_test" cargo test
190 RUSTFLAGS="--cfg=require_route_graph_test" cargo test --features hashbrown
192 - name: Run benchmarks on Rust ${{ matrix.toolchain }}
194 cargo bench --features unstable
197 runs-on: ubuntu-latest
199 # rustc 1.53 regressed and panics when building our (perfectly fine) docs.
200 # See https://github.com/rust-lang/rust/issues/84738
203 - name: Checkout source code
204 uses: actions/checkout@v2
207 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
208 uses: actions-rs/toolchain@v1
210 toolchain: ${{ env.TOOLCHAIN }}
213 - name: Fetch full tree and rebase on upstream
215 git remote add upstream https://github.com/rust-bitcoin/rust-lightning
217 export GIT_COMMITTER_EMAIL="rl-ci@example.com"
218 export GIT_COMMITTER_NAME="RL CI"
219 git rebase upstream/main
220 - name: For each commit, run cargo check (including in fuzz)
221 run: ci/check-each-commit.sh upstream/main
224 runs-on: ubuntu-latest
228 - name: Checkout source code
229 uses: actions/checkout@v2
230 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
231 uses: actions-rs/toolchain@v1
233 toolchain: ${{ env.TOOLCHAIN }}
236 - name: Install dependencies for honggfuzz
239 sudo apt-get -y install build-essential binutils-dev libunwind-dev
240 - name: Sanity check fuzz targets on Rust ${{ env.TOOLCHAIN }}
241 run: cd fuzz && RUSTFLAGS="--cfg=fuzzing" cargo test --verbose --color always
243 run: cd fuzz && ./ci-fuzz.sh && cd ..
244 - name: Run lightning-invoice fuzzers
245 run: cd lightning-invoice/fuzz && RUSTFLAGS="--cfg=fuzzing" cargo test --verbose && ./ci-fuzz.sh
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 clippy
262 rustup component add clippy
263 - name: Run default clippy linting
265 cargo clippy -- -Aclippy::erasing_op -Aclippy::never_loop -Aclippy::if_same_then_else -Dclippy::try_err