1 name: Continuous Integration Checks
12 group: ${{ github.workflow }}-${{ github.ref }}
13 cancel-in-progress: true
20 platform: [ ubuntu-latest, windows-latest, macos-latest ]
21 toolchain: [ stable, beta, 1.63.0 ] # 1.63.0 is the MSRV for all crates.
22 runs-on: ${{ matrix.platform }}
24 - name: Checkout source code
25 uses: actions/checkout@v3
26 - name: Install Rust ${{ matrix.toolchain }} toolchain
28 curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile=minimal --default-toolchain ${{ matrix.toolchain }}
29 rustup override set ${{ matrix.toolchain }}
30 - name: Install no-std-check dependencies for ARM Embedded
31 if: "matrix.platform == 'ubuntu-latest'"
33 rustup target add thumbv7m-none-eabi
34 sudo apt-get -y install gcc-arm-none-eabi
35 - name: Check for unknown cfg tags
36 run: ci/check-cfg-flags.py
37 - name: shellcheck the CI script
38 if: "matrix.platform == 'ubuntu-latest'"
40 sudo apt-get -y install shellcheck
41 shellcheck ci/ci-tests.sh
42 - name: Set RUSTFLAGS to deny warnings
43 if: "matrix.toolchain == '1.63.0'"
44 run: echo "RUSTFLAGS=-D warnings" >> "$GITHUB_ENV"
46 shell: bash # Default on Winblows is powershell
47 run: CI_MINIMIZE_DISK_USAGE=1 ./ci/ci-tests.sh
52 runs-on: ubuntu-latest
54 - name: Checkout source code
55 uses: actions/checkout@v3
58 - name: Install Rust stable toolchain
60 curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile=minimal
61 - name: Run tests with coverage generation
63 cargo install cargo-llvm-cov
64 export RUSTFLAGS="-Clink-dead-code -Coverflow-checks=off"
65 cargo llvm-cov --features rest-client,rpc-client,tokio,futures,serde --codecov --hide-instantiations --output-path=target/codecov.json
66 # Could you use this to fake the coverage report for your PR? Sure.
67 # Will anyone be impressed by your amazing coverage? No
68 # Maybe if codecov wasn't broken we wouldn't need to do this...
69 bash <(curl -s https://codecov.io/bash) -f target/codecov.json -t "f421b687-4dc2-4387-ac3d-dc3b2528af57"
72 runs-on: ubuntu-latest
76 - name: Checkout source code
77 uses: actions/checkout@v3
78 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
80 curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile=minimal --default-toolchain ${{ env.TOOLCHAIN }}
81 rustup override set ${{ env.TOOLCHAIN }}
82 - name: Cache routing graph snapshot
84 uses: actions/cache@v3
86 path: lightning/net_graph-2023-01-18.bin
87 key: ldk-net_graph-v0.0.113-2023-01-18.bin
88 - name: Fetch routing graph snapshot
89 if: steps.cache-graph.outputs.cache-hit != 'true'
91 curl --verbose -L -o lightning/net_graph-2023-01-18.bin https://bitcoin.ninja/ldk-net_graph-v0.0.113-2023-01-18.bin
92 echo "Sha sum: $(sha256sum lightning/net_graph-2023-01-18.bin | awk '{ print $1 }')"
93 if [ "$(sha256sum lightning/net_graph-2023-01-18.bin | awk '{ print $1 }')" != "${EXPECTED_ROUTING_GRAPH_SNAPSHOT_SHASUM}" ]; then
98 EXPECTED_ROUTING_GRAPH_SNAPSHOT_SHASUM: da6066f2bddcddbe7d8a6debbd53545697137b310bbb8c4911bc8c81fc5ff48c
99 - name: Fetch rapid graph sync reference input
101 curl --verbose -L -o lightning-rapid-gossip-sync/res/full_graph.lngossip https://bitcoin.ninja/ldk-compressed_graph-285cb27df79-2022-07-21.bin
102 echo "Sha sum: $(sha256sum lightning-rapid-gossip-sync/res/full_graph.lngossip | awk '{ print $1 }')"
103 if [ "$(sha256sum lightning-rapid-gossip-sync/res/full_graph.lngossip | awk '{ print $1 }')" != "${EXPECTED_RAPID_GOSSIP_SHASUM}" ]; then
108 EXPECTED_RAPID_GOSSIP_SHASUM: e0f5d11641c11896d7af3a2246d3d6c3f1720b7d2d17aab321ecce82e6b7deb8
109 - name: Test with Network Graph on Rust ${{ matrix.toolchain }}
112 RUSTFLAGS="--cfg=require_route_graph_test" cargo test
113 RUSTFLAGS="--cfg=require_route_graph_test" cargo test --features hashbrown
115 - name: Run benchmarks on Rust ${{ matrix.toolchain }}
118 RUSTFLAGS="--cfg=ldk_bench --cfg=require_route_graph_test" cargo bench
119 - name: Run benchmarks with hashbrown on Rust ${{ matrix.toolchain }}
122 RUSTFLAGS="--cfg=ldk_bench --cfg=require_route_graph_test" cargo bench --features hashbrown
125 runs-on: ubuntu-latest
129 - name: Checkout source code
130 uses: actions/checkout@v3
133 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
135 curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile=minimal --default-toolchain ${{ env.TOOLCHAIN }}
136 rustup override set ${{ env.TOOLCHAIN }}
137 - name: Fetch full tree and rebase on upstream
139 git remote add upstream https://github.com/lightningdevkit/rust-lightning
141 export GIT_COMMITTER_EMAIL="rl-ci@example.com"
142 export GIT_COMMITTER_NAME="RL CI"
143 git rebase upstream/main
144 - name: For each commit, run cargo check (including in fuzz)
145 run: ci/check-each-commit.sh upstream/main
148 runs-on: ubuntu-latest
152 - name: Checkout source code
153 uses: actions/checkout@v3
156 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
158 curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile=minimal --default-toolchain ${{ env.TOOLCHAIN }}
159 rustup override set ${{ env.TOOLCHAIN }}
160 - name: Run cargo check for release build.
162 cargo check --release
163 cargo check --no-default-features --features=no-std --release
164 cargo check --no-default-features --features=futures,std --release
166 - name: Run cargo check for Taproot build.
168 cargo check --release
169 cargo check --no-default-features --features=no-std --release
170 cargo check --no-default-features --features=futures,std --release
173 RUSTFLAGS: '--cfg=taproot'
174 RUSTDOCFLAGS: '--cfg=taproot'
177 runs-on: ubuntu-latest
181 - name: Checkout source code
182 uses: actions/checkout@v3
183 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
185 curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile=minimal --default-toolchain ${{ env.TOOLCHAIN }}
186 rustup override set ${{ env.TOOLCHAIN }}
187 - name: Install dependencies for honggfuzz
190 sudo apt-get -y install build-essential binutils-dev libunwind-dev
191 - name: Pin the regex dependency
193 cd fuzz && cargo update -p regex --precise "1.9.6" --verbose && cd ..
194 - name: Sanity check fuzz targets on Rust ${{ env.TOOLCHAIN }}
195 run: cd fuzz && RUSTFLAGS="--cfg=fuzzing" cargo test --verbose --color always
197 run: cd fuzz && ./ci-fuzz.sh && cd ..
200 runs-on: ubuntu-latest
204 - name: Checkout source code
205 uses: actions/checkout@v3
206 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
208 curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile=minimal --default-toolchain ${{ env.TOOLCHAIN }}
209 rustup override set ${{ env.TOOLCHAIN }}
210 - name: Install clippy
212 rustup component add clippy
213 - name: Run default clippy linting
215 cargo clippy -- -Aclippy::erasing_op -Aclippy::never_loop -Aclippy::if_same_then_else -Dclippy::try_err
218 runs-on: ubuntu-latest
222 - name: Checkout source code
223 uses: actions/checkout@v3
224 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
226 curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile=minimal --default-toolchain ${{ env.TOOLCHAIN }}
227 rustup override set ${{ env.TOOLCHAIN }}
228 - name: Install rustfmt
230 rustup component add rustfmt
231 - name: Run rustfmt checks