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 --no-default-features --features no_std
94 # check if there is a conflict between no_std and the default std feature
95 cargo test --verbose --color always --features no_std
97 - name: Test on no_std bullds Rust ${{ matrix.toolchain }} and full code-linking for coverage generation
98 if: "matrix.build-no-std && matrix.coverage"
101 RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --no-default-features --features no_std
103 - name: Test on Rust ${{ matrix.toolchain }}
104 if: "! matrix.build-net-tokio"
106 cargo test --verbose --color always -p lightning
107 cargo test --verbose --color always -p lightning-invoice
108 cargo build --verbose --color always -p lightning-persister
109 - name: Test Block Sync Clients on Rust ${{ matrix.toolchain }} with features
110 if: "matrix.build-net-tokio && !matrix.coverage"
112 cd lightning-block-sync
113 cargo test --verbose --color always --features rest-client
114 cargo test --verbose --color always --features rpc-client
115 cargo test --verbose --color always --features rpc-client,rest-client
116 cargo test --verbose --color always --features rpc-client,rest-client,tokio
117 - name: Test Block Sync Clients on Rust ${{ matrix.toolchain }} with features and full code-linking for coverage generation
120 cd lightning-block-sync
121 RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --features rest-client
122 RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --features rpc-client
123 RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --features rpc-client,rest-client
124 RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --features rpc-client,rest-client,tokio
125 - name: Install deps for kcov
129 sudo apt-get -y install binutils-dev libcurl4-openssl-dev zlib1g-dev libdw-dev libiberty-dev
133 wget https://github.com/SimonKagstrom/kcov/archive/master.tar.gz
134 tar xzf master.tar.gz
135 cd kcov-master && mkdir build && cd build
138 make install DESTDIR=../../kcov-build
139 cd ../.. && rm -rf kcov-master master.tar.gz
140 - name: Generate coverage report
143 for file in target/debug/deps/lightning*; do
144 [ -x "${file}" ] || continue;
145 mkdir -p "target/cov/$(basename $file)";
146 ./kcov-build/usr/local/bin/kcov --exclude-pattern=/.cargo,/usr/lib --verify "target/cov/$(basename $file)" "$file";
148 - name: Upload coverage
150 uses: codecov/codecov-action@v1
152 # Could you use this to fake the coverage report for your PR? Sure.
153 # Will anyone be impressed by your amazing coverage? No
154 # Maybe if codecov wasn't broken we wouldn't need to do this...
155 token: f421b687-4dc2-4387-ac3d-dc3b2528af57
156 fail_ci_if_error: true
159 runs-on: ubuntu-latest
163 - name: Checkout source code
164 uses: actions/checkout@v2
165 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
166 uses: actions-rs/toolchain@v1
168 toolchain: ${{ env.TOOLCHAIN }}
171 - name: Cache routing graph snapshot
173 uses: actions/cache@v2
175 path: lightning/net_graph-2021-05-31.bin
176 key: ldk-net_graph-v0.0.15-2021-05-31.bin
177 - name: Fetch routing graph snapshot
178 if: steps.cache-graph.outputs.cache-hit != 'true'
180 wget -O lightning/net_graph-2021-05-31.bin https://bitcoin.ninja/ldk-net_graph-v0.0.15-2021-05-31.bin
181 if [ "$(sha256sum lightning/net_graph-2021-05-31.bin | awk '{ print $1 }')" != "05a5361278f68ee2afd086cc04a1f927a63924be451f3221d380533acfacc303" ]; then
185 - name: Test with Network Graph on Rust ${{ matrix.toolchain }}
188 RUSTFLAGS="--cfg=require_route_graph_test" cargo test
189 RUSTFLAGS="--cfg=require_route_graph_test" cargo test --features hashbrown
191 - name: Run benchmarks on Rust ${{ matrix.toolchain }}
193 cargo bench --features unstable
196 runs-on: ubuntu-latest
198 # rustc 1.53 regressed and panics when building our (perfectly fine) docs.
199 # See https://github.com/rust-lang/rust/issues/84738
202 - name: Checkout source code
203 uses: actions/checkout@v2
206 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
207 uses: actions-rs/toolchain@v1
209 toolchain: ${{ env.TOOLCHAIN }}
212 - name: Fetch full tree and rebase on upstream
214 git remote add upstream https://github.com/rust-bitcoin/rust-lightning
216 export GIT_COMMITTER_EMAIL="rl-ci@example.com"
217 export GIT_COMMITTER_NAME="RL CI"
218 git rebase upstream/main
219 - name: For each commit, run cargo check (including in fuzz)
220 run: ci/check-each-commit.sh upstream/main
223 runs-on: ubuntu-latest
227 - name: Checkout source code
228 uses: actions/checkout@v2
229 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
230 uses: actions-rs/toolchain@v1
232 toolchain: ${{ env.TOOLCHAIN }}
235 - name: Install dependencies for honggfuzz
238 sudo apt-get -y install build-essential binutils-dev libunwind-dev
239 - name: Sanity check fuzz targets on Rust ${{ env.TOOLCHAIN }}
240 run: cd fuzz && RUSTFLAGS="--cfg=fuzzing" cargo test --verbose --color always
242 run: cd fuzz && ./ci-fuzz.sh && cd ..
243 - name: Run lightning-invoice fuzzers
244 run: cd lightning-invoice/fuzz && RUSTFLAGS="--cfg=fuzzing" cargo test --verbose && ./ci-fuzz.sh
247 runs-on: ubuntu-latest
251 - name: Checkout source code
252 uses: actions/checkout@v2
253 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
254 uses: actions-rs/toolchain@v1
256 toolchain: ${{ env.TOOLCHAIN }}
259 - name: Install clippy
261 rustup component add clippy
262 - name: Run default clippy linting
264 cargo clippy -- -Aclippy::erasing_op -Aclippy::never_loop -Aclippy::if_same_then_else