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 ]
24 platform: ubuntu-latest
25 # 1.48.0 is the MSRV for all crates except lightning-transaction-sync and Win/Mac
27 platform: ubuntu-latest
28 # Windows requires 1.49.0 because that's the MSRV for supported Tokio
30 platform: windows-latest
31 # MacOS-latest requires 1.54.0 because that's what's required for linking to work properly
33 platform: macos-latest
34 runs-on: ${{ matrix.platform }}
36 - name: Checkout source code
37 uses: actions/checkout@v3
38 - name: Install Rust ${{ matrix.toolchain }} toolchain
40 curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile=minimal --default-toolchain ${{ matrix.toolchain }}
41 rustup override set ${{ matrix.toolchain }}
42 - name: Install no-std-check dependencies for ARM Embedded
43 if: "matrix.platform == 'ubuntu-latest'"
45 rustup target add thumbv7m-none-eabi
46 sudo apt-get -y install gcc-arm-none-eabi
47 - name: Check for unknown cfg tags
48 run: ci/check-cfg-flags.py
49 - name: shellcheck the CI script
50 if: "matrix.platform == 'ubuntu-latest'"
52 sudo apt-get -y install shellcheck
53 shellcheck ci/ci-tests.sh
55 shell: bash # Default on Winblows is powershell
56 run: CI_MINIMIZE_DISK_USAGE=1 ./ci/ci-tests.sh
61 runs-on: ubuntu-latest
63 - name: Checkout source code
64 uses: actions/checkout@v3
67 - name: Install Rust stable toolchain
69 curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile=minimal
70 - name: Run tests with coverage generation
72 cargo install cargo-llvm-cov
73 export RUSTFLAGS="-Clink-dead-code -Coverflow-checks=off"
74 cargo llvm-cov --features rest-client,rpc-client,tokio,futures,serde --codecov --hide-instantiations --output-path=target/codecov.json
75 # Could you use this to fake the coverage report for your PR? Sure.
76 # Will anyone be impressed by your amazing coverage? No
77 # Maybe if codecov wasn't broken we wouldn't need to do this...
78 bash <(curl -s https://codecov.io/bash) -f target/codecov.json -t "f421b687-4dc2-4387-ac3d-dc3b2528af57"
81 runs-on: ubuntu-latest
85 - name: Checkout source code
86 uses: actions/checkout@v3
87 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
89 curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile=minimal --default-toolchain ${{ env.TOOLCHAIN }}
90 rustup override set ${{ env.TOOLCHAIN }}
91 - name: Cache routing graph snapshot
93 uses: actions/cache@v3
95 path: lightning/net_graph-2023-01-18.bin
96 key: ldk-net_graph-v0.0.113-2023-01-18.bin
97 - name: Fetch routing graph snapshot
98 if: steps.cache-graph.outputs.cache-hit != 'true'
100 curl --verbose -L -o lightning/net_graph-2023-01-18.bin https://bitcoin.ninja/ldk-net_graph-v0.0.113-2023-01-18.bin
101 echo "Sha sum: $(sha256sum lightning/net_graph-2023-01-18.bin | awk '{ print $1 }')"
102 if [ "$(sha256sum lightning/net_graph-2023-01-18.bin | awk '{ print $1 }')" != "${EXPECTED_ROUTING_GRAPH_SNAPSHOT_SHASUM}" ]; then
107 EXPECTED_ROUTING_GRAPH_SNAPSHOT_SHASUM: da6066f2bddcddbe7d8a6debbd53545697137b310bbb8c4911bc8c81fc5ff48c
108 - name: Fetch rapid graph sync reference input
110 curl --verbose -L -o lightning-rapid-gossip-sync/res/full_graph.lngossip https://bitcoin.ninja/ldk-compressed_graph-285cb27df79-2022-07-21.bin
111 echo "Sha sum: $(sha256sum lightning-rapid-gossip-sync/res/full_graph.lngossip | awk '{ print $1 }')"
112 if [ "$(sha256sum lightning-rapid-gossip-sync/res/full_graph.lngossip | awk '{ print $1 }')" != "${EXPECTED_RAPID_GOSSIP_SHASUM}" ]; then
117 EXPECTED_RAPID_GOSSIP_SHASUM: e0f5d11641c11896d7af3a2246d3d6c3f1720b7d2d17aab321ecce82e6b7deb8
118 - name: Test with Network Graph on Rust ${{ matrix.toolchain }}
121 RUSTFLAGS="--cfg=require_route_graph_test" cargo test
122 RUSTFLAGS="--cfg=require_route_graph_test" cargo test --features hashbrown
124 - name: Run benchmarks on Rust ${{ matrix.toolchain }}
127 RUSTFLAGS="--cfg=ldk_bench --cfg=require_route_graph_test" cargo bench
128 - name: Run benchmarks with hashbrown on Rust ${{ matrix.toolchain }}
131 RUSTFLAGS="--cfg=ldk_bench --cfg=require_route_graph_test" cargo bench --features hashbrown
134 runs-on: ubuntu-latest
138 - name: Checkout source code
139 uses: actions/checkout@v3
142 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
144 curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile=minimal --default-toolchain ${{ env.TOOLCHAIN }}
145 rustup override set ${{ env.TOOLCHAIN }}
146 - name: Fetch full tree and rebase on upstream
148 git remote add upstream https://github.com/lightningdevkit/rust-lightning
150 export GIT_COMMITTER_EMAIL="rl-ci@example.com"
151 export GIT_COMMITTER_NAME="RL CI"
152 git rebase upstream/main
153 - name: For each commit, run cargo check (including in fuzz)
154 run: ci/check-each-commit.sh upstream/main
157 runs-on: ubuntu-latest
161 - name: Checkout source code
162 uses: actions/checkout@v3
165 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
167 curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile=minimal --default-toolchain ${{ env.TOOLCHAIN }}
168 rustup override set ${{ env.TOOLCHAIN }}
169 - name: Run cargo check for release build.
171 cargo check --release
172 cargo check --no-default-features --features=no-std --release
173 cargo check --no-default-features --features=futures --release
175 - name: Run cargo check for Taproot build.
177 cargo check --release
178 cargo check --no-default-features --features=no-std --release
179 cargo check --no-default-features --features=futures --release
182 RUSTFLAGS: '--cfg=taproot'
183 RUSTDOCFLAGS: '--cfg=taproot'
186 runs-on: ubuntu-latest
190 - name: Checkout source code
191 uses: actions/checkout@v3
192 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
194 curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile=minimal --default-toolchain ${{ env.TOOLCHAIN }}
195 rustup override set ${{ env.TOOLCHAIN }}
196 - name: Install dependencies for honggfuzz
199 sudo apt-get -y install build-essential binutils-dev libunwind-dev
200 - name: Sanity check fuzz targets on Rust ${{ env.TOOLCHAIN }}
201 run: cd fuzz && RUSTFLAGS="--cfg=fuzzing" cargo test --verbose --color always
203 run: cd fuzz && ./ci-fuzz.sh && cd ..
204 - name: Run lightning-invoice fuzzers
205 run: cd lightning-invoice/fuzz && RUSTFLAGS="--cfg=fuzzing" cargo test --verbose && ./ci-fuzz.sh
208 runs-on: ubuntu-latest
212 - name: Checkout source code
213 uses: actions/checkout@v3
214 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
216 curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile=minimal --default-toolchain ${{ env.TOOLCHAIN }}
217 rustup override set ${{ env.TOOLCHAIN }}
218 - name: Install clippy
220 rustup component add clippy
221 - name: Run default clippy linting
223 cargo clippy -- -Aclippy::erasing_op -Aclippy::never_loop -Aclippy::if_same_then_else -Dclippy::try_err