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: shellcheck the CI script
48 if: "matrix.platform == 'ubuntu-latest'"
50 sudo apt-get -y install shellcheck
51 shellcheck ci/ci-tests.sh
53 shell: bash # Default on Winblows is powershell
59 runs-on: ubuntu-latest
61 - name: Checkout source code
62 uses: actions/checkout@v3
65 - name: Install Rust stable toolchain
67 curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile=minimal
68 - name: Run tests with coverage generation
70 cargo install cargo-llvm-cov
71 export RUSTFLAGS="-Clink-dead-code -Coverflow-checks=off"
72 cargo llvm-cov --features rest-client,rpc-client,tokio,futures,serde --codecov --hide-instantiations --output-path=target/codecov.json
73 # Could you use this to fake the coverage report for your PR? Sure.
74 # Will anyone be impressed by your amazing coverage? No
75 # Maybe if codecov wasn't broken we wouldn't need to do this...
76 bash <(curl -s https://codecov.io/bash) -f target/codecov.json -t "f421b687-4dc2-4387-ac3d-dc3b2528af57"
79 runs-on: ubuntu-latest
83 - name: Checkout source code
84 uses: actions/checkout@v3
85 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
87 curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile=minimal --default-toolchain ${{ env.TOOLCHAIN }}
88 rustup override set ${{ env.TOOLCHAIN }}
89 - name: Cache routing graph snapshot
91 uses: actions/cache@v3
93 path: lightning/net_graph-2023-01-18.bin
94 key: ldk-net_graph-v0.0.113-2023-01-18.bin
95 - name: Fetch routing graph snapshot
96 if: steps.cache-graph.outputs.cache-hit != 'true'
98 curl --verbose -L -o lightning/net_graph-2023-01-18.bin https://bitcoin.ninja/ldk-net_graph-v0.0.113-2023-01-18.bin
99 echo "Sha sum: $(sha256sum lightning/net_graph-2023-01-18.bin | awk '{ print $1 }')"
100 if [ "$(sha256sum lightning/net_graph-2023-01-18.bin | awk '{ print $1 }')" != "${EXPECTED_ROUTING_GRAPH_SNAPSHOT_SHASUM}" ]; then
105 EXPECTED_ROUTING_GRAPH_SNAPSHOT_SHASUM: da6066f2bddcddbe7d8a6debbd53545697137b310bbb8c4911bc8c81fc5ff48c
106 - name: Fetch rapid graph sync reference input
108 curl --verbose -L -o lightning-rapid-gossip-sync/res/full_graph.lngossip https://bitcoin.ninja/ldk-compressed_graph-285cb27df79-2022-07-21.bin
109 echo "Sha sum: $(sha256sum lightning-rapid-gossip-sync/res/full_graph.lngossip | awk '{ print $1 }')"
110 if [ "$(sha256sum lightning-rapid-gossip-sync/res/full_graph.lngossip | awk '{ print $1 }')" != "${EXPECTED_RAPID_GOSSIP_SHASUM}" ]; then
115 EXPECTED_RAPID_GOSSIP_SHASUM: e0f5d11641c11896d7af3a2246d3d6c3f1720b7d2d17aab321ecce82e6b7deb8
116 - name: Test with Network Graph on Rust ${{ matrix.toolchain }}
119 RUSTFLAGS="--cfg=require_route_graph_test" cargo test
120 RUSTFLAGS="--cfg=require_route_graph_test" cargo test --features hashbrown
122 - name: Run benchmarks on Rust ${{ matrix.toolchain }}
125 RUSTFLAGS="--cfg=ldk_bench --cfg=require_route_graph_test" cargo bench
126 - name: Run benchmarks with hashbrown on Rust ${{ matrix.toolchain }}
129 RUSTFLAGS="--cfg=ldk_bench --cfg=require_route_graph_test" cargo bench --features hashbrown
132 runs-on: ubuntu-latest
136 - name: Checkout source code
137 uses: actions/checkout@v3
140 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
142 curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile=minimal --default-toolchain ${{ env.TOOLCHAIN }}
143 rustup override set ${{ env.TOOLCHAIN }}
144 - name: Fetch full tree and rebase on upstream
146 git remote add upstream https://github.com/lightningdevkit/rust-lightning
148 export GIT_COMMITTER_EMAIL="rl-ci@example.com"
149 export GIT_COMMITTER_NAME="RL CI"
150 git rebase upstream/main
151 - name: For each commit, run cargo check (including in fuzz)
152 run: ci/check-each-commit.sh upstream/main
155 runs-on: ubuntu-latest
159 - name: Checkout source code
160 uses: actions/checkout@v3
163 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
165 curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile=minimal --default-toolchain ${{ env.TOOLCHAIN }}
166 rustup override set ${{ env.TOOLCHAIN }}
167 - name: Run cargo check for release build.
169 cargo check --release
170 cargo check --no-default-features --features=no-std --release
171 cargo check --no-default-features --features=futures --release
173 - name: Run cargo check for Taproot build.
175 cargo check --release
176 cargo check --no-default-features --features=no-std --release
177 cargo check --no-default-features --features=futures --release
180 RUSTFLAGS: '--cfg=taproot'
181 RUSTDOCFLAGS: '--cfg=taproot'
184 runs-on: ubuntu-latest
188 - name: Checkout source code
189 uses: actions/checkout@v3
190 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
192 curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile=minimal --default-toolchain ${{ env.TOOLCHAIN }}
193 rustup override set ${{ env.TOOLCHAIN }}
194 - name: Install dependencies for honggfuzz
197 sudo apt-get -y install build-essential binutils-dev libunwind-dev
198 - name: Sanity check fuzz targets on Rust ${{ env.TOOLCHAIN }}
199 run: cd fuzz && RUSTFLAGS="--cfg=fuzzing" cargo test --verbose --color always
201 run: cd fuzz && ./ci-fuzz.sh && cd ..
202 - name: Run lightning-invoice fuzzers
203 run: cd lightning-invoice/fuzz && RUSTFLAGS="--cfg=fuzzing" cargo test --verbose && ./ci-fuzz.sh
206 runs-on: ubuntu-latest
210 - name: Checkout source code
211 uses: actions/checkout@v3
212 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
214 curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile=minimal --default-toolchain ${{ env.TOOLCHAIN }}
215 rustup override set ${{ env.TOOLCHAIN }}
216 - name: Install clippy
218 rustup component add clippy
219 - name: Run default clippy linting
221 cargo clippy -- -Aclippy::erasing_op -Aclippy::never_loop -Aclippy::if_same_then_else -Dclippy::try_err