1 name: Continuous Integration Checks
3 on: [push, pull_request]
9 platform: [ ubuntu-latest ]
12 # 1.36.0 is MSRV for Rust-Lightning, lightning-invoice, and lightning-persister
14 # 1.41.0 is Debian stable
16 # 1.45.2 is MSRV for lightning-net-tokio, lightning-block-sync, and coverage generation
18 # 1.49.0 is MSRV for no_std builds using hashbrown
25 platform: macos-latest
29 platform: windows-latest
45 runs-on: ${{ matrix.platform }}
47 - name: Checkout source code
48 uses: actions/checkout@v2
49 - name: Install Rust ${{ matrix.toolchain }} toolchain
50 uses: actions-rs/toolchain@v1
52 toolchain: ${{ matrix.toolchain }}
55 - name: Build on Rust ${{ matrix.toolchain }} with net-tokio
56 if: "matrix.build-net-tokio && !matrix.coverage"
57 run: cargo build --verbose --color always
58 - name: Build on Rust ${{ matrix.toolchain }} with net-tokio and full code-linking for coverage generation
60 run: RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always
61 - name: Build on Rust ${{ matrix.toolchain }}
62 if: "! matrix.build-net-tokio"
64 cargo build --verbose --color always -p lightning
65 cargo build --verbose --color always -p lightning-invoice
66 cargo build --verbose --color always -p lightning-persister
67 - name: Build Block Sync Clients on Rust ${{ matrix.toolchain }} with features
68 if: "matrix.build-net-tokio && !matrix.coverage"
70 cd lightning-block-sync
71 cargo build --verbose --color always --features rest-client
72 cargo build --verbose --color always --features rpc-client
73 cargo build --verbose --color always --features rpc-client,rest-client
74 cargo build --verbose --color always --features rpc-client,rest-client,tokio
75 - name: Build Block Sync Clients on Rust ${{ matrix.toolchain }} with features and full code-linking for coverage generation
78 cd lightning-block-sync
79 RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always --features rest-client
80 RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always --features rpc-client
81 RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always --features rpc-client,rest-client
82 RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always --features rpc-client,rest-client,tokio
83 - name: Test on Rust ${{ matrix.toolchain }} with net-tokio
84 if: "matrix.build-net-tokio && !matrix.coverage"
85 run: cargo test --verbose --color always
86 - name: Test on Rust ${{ matrix.toolchain }} with net-tokio and full code-linking for coverage generation
88 run: RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always
89 - name: Test on no_std bullds Rust ${{ matrix.toolchain }}
90 if: "matrix.build-no-std && !matrix.coverage"
93 cargo test --verbose --color always --features hashbrown
95 - name: Test on no_std bullds Rust ${{ matrix.toolchain }} and full code-linking for coverage generation
96 if: "matrix.build-no-std && matrix.coverage"
99 RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --features hashbrown
101 - name: Test on Rust ${{ matrix.toolchain }}
102 if: "! matrix.build-net-tokio"
104 cargo test --verbose --color always -p lightning
105 cargo test --verbose --color always -p lightning-invoice
106 cargo build --verbose --color always -p lightning-persister
107 - name: Test Block Sync Clients on Rust ${{ matrix.toolchain }} with features
108 if: "matrix.build-net-tokio && !matrix.coverage"
110 cd lightning-block-sync
111 cargo test --verbose --color always --features rest-client
112 cargo test --verbose --color always --features rpc-client
113 cargo test --verbose --color always --features rpc-client,rest-client
114 cargo test --verbose --color always --features rpc-client,rest-client,tokio
115 - name: Test Block Sync Clients on Rust ${{ matrix.toolchain }} with features and full code-linking for coverage generation
118 cd lightning-block-sync
119 RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --features rest-client
120 RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --features rpc-client
121 RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --features rpc-client,rest-client
122 RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --features rpc-client,rest-client,tokio
123 - name: Install deps for kcov
127 sudo apt-get -y install binutils-dev libcurl4-openssl-dev zlib1g-dev libdw-dev libiberty-dev
131 wget https://github.com/SimonKagstrom/kcov/archive/master.tar.gz
132 tar xzf master.tar.gz
133 cd kcov-master && mkdir build && cd build
136 make install DESTDIR=../../kcov-build
137 cd ../.. && rm -rf kcov-master master.tar.gz
138 - name: Generate coverage report
141 for file in target/debug/deps/lightning*; do
142 [ -x "${file}" ] || continue;
143 mkdir -p "target/cov/$(basename $file)";
144 ./kcov-build/usr/local/bin/kcov --exclude-pattern=/.cargo,/usr/lib --verify "target/cov/$(basename $file)" "$file";
146 - name: Upload coverage
148 uses: codecov/codecov-action@v1
150 # Could you use this to fake the coverage report for your PR? Sure.
151 # Will anyone be impressed by your amazing coverage? No
152 # Maybe if codecov wasn't broken we wouldn't need to do this...
153 token: f421b687-4dc2-4387-ac3d-dc3b2528af57
154 fail_ci_if_error: true
157 runs-on: ubuntu-latest
161 - name: Checkout source code
162 uses: actions/checkout@v2
163 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
164 uses: actions-rs/toolchain@v1
166 toolchain: ${{ env.TOOLCHAIN }}
169 - name: Cache routing graph snapshot
171 uses: actions/cache@v2
173 path: lightning/net_graph-2021-05-31.bin
174 key: ldk-net_graph-v0.0.15-2021-05-31.bin
175 - name: Fetch routing graph snapshot
176 if: steps.cache-graph.outputs.cache-hit != 'true'
178 wget -O lightning/net_graph-2021-05-31.bin https://bitcoin.ninja/ldk-net_graph-v0.0.15-2021-05-31.bin
179 if [ "$(sha256sum lightning/net_graph-2021-05-31.bin | awk '{ print $1 }')" != "05a5361278f68ee2afd086cc04a1f927a63924be451f3221d380533acfacc303" ]; then
183 - name: Test with Network Graph on Rust ${{ matrix.toolchain }}
186 RUSTFLAGS="--cfg=require_route_graph_test" cargo test
187 RUSTFLAGS="--cfg=require_route_graph_test" cargo test --features hashbrown
189 - name: Run benchmarks on Rust ${{ matrix.toolchain }}
191 cargo bench --features unstable
194 runs-on: ubuntu-latest
196 # rustc 1.53 regressed and panics when building our (perfectly fine) docs.
197 # See https://github.com/rust-lang/rust/issues/84738
200 - name: Checkout source code
201 uses: actions/checkout@v2
204 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
205 uses: actions-rs/toolchain@v1
207 toolchain: ${{ env.TOOLCHAIN }}
210 - name: Fetch full tree and rebase on upstream
212 git remote add upstream https://github.com/rust-bitcoin/rust-lightning
214 export GIT_COMMITTER_EMAIL="rl-ci@example.com"
215 export GIT_COMMITTER_NAME="RL CI"
216 git rebase upstream/main
217 - name: For each commit, run cargo check (including in fuzz)
218 run: ci/check-each-commit.sh upstream/main
221 runs-on: ubuntu-latest
225 - name: Checkout source code
226 uses: actions/checkout@v2
227 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
228 uses: actions-rs/toolchain@v1
230 toolchain: ${{ env.TOOLCHAIN }}
233 - name: Install dependencies for honggfuzz
236 sudo apt-get -y install build-essential binutils-dev libunwind-dev
237 - name: Sanity check fuzz targets on Rust ${{ env.TOOLCHAIN }}
238 run: cd fuzz && RUSTFLAGS="--cfg=fuzzing" cargo test --verbose --color always
240 run: cd fuzz && ./ci-fuzz.sh && cd ..
241 - name: Run lightning-invoice fuzzers
242 run: cd lightning-invoice/fuzz && RUSTFLAGS="--cfg=fuzzing" cargo test --verbose && ./ci-fuzz.sh
245 runs-on: ubuntu-latest
249 - name: Checkout source code
250 uses: actions/checkout@v2
251 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
252 uses: actions-rs/toolchain@v1
254 toolchain: ${{ env.TOOLCHAIN }}
257 - name: Install clippy
259 rustup component add clippy
260 - name: Run default clippy linting
262 cargo clippy -- -Aclippy::erasing_op -Aclippy::never_loop -Aclippy::if_same_then_else