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
22 platform: macos-latest
25 platform: windows-latest
32 runs-on: ${{ matrix.platform }}
34 - name: Checkout source code
35 uses: actions/checkout@v2
36 - name: Install Rust ${{ matrix.toolchain }} toolchain
37 uses: actions-rs/toolchain@v1
39 toolchain: ${{ matrix.toolchain }}
42 - name: Build on Rust ${{ matrix.toolchain }} with net-tokio
43 if: "matrix.build-net-tokio && !matrix.coverage"
44 run: cargo build --verbose --color always
45 - name: Build on Rust ${{ matrix.toolchain }} with net-tokio and full code-linking for coverage generation
47 run: RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always
48 - name: Build on Rust ${{ matrix.toolchain }}
49 if: "! matrix.build-net-tokio"
50 run: cargo build --verbose --color always -p lightning && cargo build --verbose --color always -p lightning-invoice && cargo build --verbose --color always -p lightning-persister
51 - name: Build Block Sync Clients on Rust ${{ matrix.toolchain }} with features
52 if: "matrix.build-net-tokio && !matrix.coverage"
54 cd lightning-block-sync
55 cargo build --verbose --color always --features rest-client
56 cargo build --verbose --color always --features rpc-client
57 cargo build --verbose --color always --features rpc-client,rest-client
58 cargo build --verbose --color always --features rpc-client,rest-client,tokio
60 - name: Build Block Sync Clients on Rust ${{ matrix.toolchain }} with features and full code-linking for coverage generation
63 cd lightning-block-sync
64 RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always --features rest-client
65 RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always --features rpc-client
66 RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always --features rpc-client,rest-client
67 RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always --features rpc-client,rest-client,tokio
69 - name: Test on Rust ${{ matrix.toolchain }} with net-tokio
70 if: "matrix.build-net-tokio && !matrix.coverage"
71 run: cargo test --verbose --color always
72 - name: Test on Rust ${{ matrix.toolchain }} with net-tokio and full code-linking for coverage generation
74 run: RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always
75 - name: Test on Rust ${{ matrix.toolchain }}
76 if: "! matrix.build-net-tokio"
77 run: cargo test --verbose --color always -p lightning && cargo test --verbose --color always -p lightning-invoice && cargo build --verbose --color always -p lightning-persister
78 - name: Test Block Sync Clients on Rust ${{ matrix.toolchain }} with features
79 if: "matrix.build-net-tokio && !matrix.coverage"
81 cd lightning-block-sync
82 cargo test --verbose --color always --features rest-client
83 cargo test --verbose --color always --features rpc-client
84 cargo test --verbose --color always --features rpc-client,rest-client
85 cargo test --verbose --color always --features rpc-client,rest-client,tokio
87 - name: Test Block Sync Clients on Rust ${{ matrix.toolchain }} with features and full code-linking for coverage generation
90 cd lightning-block-sync
91 RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --features rest-client
92 RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --features rpc-client
93 RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --features rpc-client,rest-client
94 RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always --features rpc-client,rest-client,tokio
96 - name: Install deps for kcov
100 sudo apt-get -y install binutils-dev libcurl4-openssl-dev zlib1g-dev libdw-dev libiberty-dev
104 wget https://github.com/SimonKagstrom/kcov/archive/master.tar.gz
105 tar xzf master.tar.gz
106 cd kcov-master && mkdir build && cd build
109 make install DESTDIR=../../kcov-build
110 cd ../.. && rm -rf kcov-master master.tar.gz
111 - name: Generate coverage report
114 for file in target/debug/deps/lightning*; do
115 [ -x "${file}" ] || continue;
116 mkdir -p "target/cov/$(basename $file)";
117 ./kcov-build/usr/local/bin/kcov --exclude-pattern=/.cargo,/usr/lib --verify "target/cov/$(basename $file)" "$file";
119 - name: Upload coverage
121 uses: codecov/codecov-action@v1
123 # Could you use this to fake the coverage report for your PR? Sure.
124 # Will anyone be impressed by your amazing coverage? No
125 # Maybe if codecov wasn't broken we wouldn't need to do this...
126 token: f421b687-4dc2-4387-ac3d-dc3b2528af57
127 fail_ci_if_error: true
130 runs-on: ubuntu-latest
134 - name: Checkout source code
135 uses: actions/checkout@v2
136 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
137 uses: actions-rs/toolchain@v1
139 toolchain: ${{ env.TOOLCHAIN }}
142 - name: Cache routing graph snapshot
144 uses: actions/cache@v2
146 path: lightning/net_graph-2021-05-27.bin
147 key: ldk-net_graph-45d86ead641d-2021-05-27.bin
148 - name: Fetch routing graph snapshot
149 if: steps.cache-graph.outputs.cache-hit != 'true'
151 wget -O lightning/net_graph-2021-05-27.bin https://bitcoin.ninja/ldk-net_graph-45d86ead641d-2021-05-27.bin
152 if [ "$(sha256sum lightning/net_graph-2021-05-27.bin | awk '{ print $1 }')" != "3d6261187cfa583255d978efb908b51c2f4dc4ad9a7160cd2c5263c9a4830121" ]; then
156 - name: Test with Network Graph on Rust ${{ matrix.toolchain }}
159 RUSTFLAGS="--cfg=require_route_graph_test" cargo test
161 - name: Run benchmarks on Rust ${{ matrix.toolchain }}
163 cargo bench --features unstable
166 runs-on: ubuntu-latest
170 - name: Checkout source code
171 uses: actions/checkout@v2
174 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
175 uses: actions-rs/toolchain@v1
177 toolchain: ${{ env.TOOLCHAIN }}
180 - name: Fetch full tree and rebase on upstream
182 git remote add upstream https://github.com/rust-bitcoin/rust-lightning
184 export GIT_COMMITTER_EMAIL="rl-ci@example.com"
185 export GIT_COMMITTER_NAME="RL CI"
186 git rebase upstream/main
187 - name: For each commit, run cargo check (including in fuzz)
188 run: ci/check-each-commit.sh upstream/main
191 runs-on: ubuntu-latest
195 - name: Checkout source code
196 uses: actions/checkout@v2
197 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
198 uses: actions-rs/toolchain@v1
200 toolchain: ${{ env.TOOLCHAIN }}
203 - name: Install dependencies for honggfuzz
206 sudo apt-get -y install build-essential binutils-dev libunwind-dev
207 - name: Sanity check fuzz targets on Rust ${{ env.TOOLCHAIN }}
208 run: cd fuzz && RUSTFLAGS="--cfg=fuzzing" cargo test --verbose --color always
210 run: cd fuzz && ./ci-fuzz.sh && cd ..
211 - name: Run lightning-invoice fuzzers
212 run: cd lightning-invoice/fuzz && RUSTFLAGS="--cfg=fuzzing" cargo test --verbose && ./ci-fuzz.sh
215 runs-on: ubuntu-latest
219 - name: Checkout source code
220 uses: actions/checkout@v2
221 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
222 uses: actions-rs/toolchain@v1
224 toolchain: ${{ env.TOOLCHAIN }}
227 - name: Install clippy
229 rustup component add clippy
230 - name: Run default clippy linting
232 cargo clippy -- -Aclippy::erasing_op -Aclippy::never_loop -Aclippy::if_same_then_else