1 name: Continuous Integration Checks
3 on: [push, pull_request]
9 platform: [ ubuntu-latest ]
12 # 1.30.0 is MSRV for Rust-Lightning
14 # 1.34.2 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
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
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-02-12.bin
147 key: net_graph-2021-02-12
148 - name: Fetch routing graph snapshot
149 if: steps.cache-graph.outputs.cache-hit != 'true'
151 wget -O lightning/net_graph-2021-02-12.bin https://bitcoin.ninja/ldk-net_graph-879e309c128-2020-02-12.bin
152 if [ "$(sha256sum lightning/net_graph-2021-02-12.bin | awk '{ print $1 }')" != "890a1f80dfb6ef674a1e4ff0f23cd73d740731c395f99d85abbede0cfbb701ab" ]; then
156 - name: Run benchmarks on Rust ${{ matrix.toolchain }}
159 cargo bench --features unstable
163 runs-on: ubuntu-latest
167 - name: Checkout source code
168 uses: actions/checkout@v2
171 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
172 uses: actions-rs/toolchain@v1
174 toolchain: ${{ env.TOOLCHAIN }}
177 - name: Fetch full tree and rebase on upstream
179 git remote add upstream https://github.com/rust-bitcoin/rust-lightning
181 export GIT_COMMITTER_EMAIL="rl-ci@example.com"
182 export GIT_COMMITTER_NAME="RL CI"
183 git rebase upstream/main
184 - name: For each commit, run cargo check (including in fuzz)
185 run: ci/check-each-commit.sh upstream/main
188 runs-on: ubuntu-latest
192 - name: Checkout source code
193 uses: actions/checkout@v2
194 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
195 uses: actions-rs/toolchain@v1
197 toolchain: ${{ env.TOOLCHAIN }}
200 - name: Install dependencies for honggfuzz
203 sudo apt-get -y install build-essential binutils-dev libunwind-dev
204 - name: Sanity check fuzz targets on Rust ${{ env.TOOLCHAIN }}
205 run: cd fuzz && RUSTFLAGS="--cfg=fuzzing" cargo test --verbose --color always
207 run: cd fuzz && ./ci-fuzz.sh
210 runs-on: ubuntu-latest
214 - name: Checkout source code
215 uses: actions/checkout@v2
216 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
217 uses: actions-rs/toolchain@v1
219 toolchain: ${{ env.TOOLCHAIN }}
222 - name: Install clippy
224 rustup component add clippy
225 - name: Run default clippy linting
227 cargo clippy -- -Aclippy::erasing_op -Aclippy::never_loop -Aclippy::if_same_then_else