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
26 # 1.48.0 is the MSRV for all crates except lightning-transaction-sync and Win/Mac
28 platform: ubuntu-latest
29 # Windows requires 1.49.0 because that's the MSRV for supported Tokio
31 platform: windows-latest
32 # MacOS-latest requires 1.54.0 because that's what's required for linking to work properly
34 platform: macos-latest
35 runs-on: ${{ matrix.platform }}
37 - name: Checkout source code
38 uses: actions/checkout@v3
39 - name: Install Rust ${{ matrix.toolchain }} toolchain
40 uses: actions-rs/toolchain@v1
42 toolchain: ${{ matrix.toolchain }}
45 - name: Install no-std-check dependencies for ARM Embedded
46 if: "matrix.platform == 'ubuntu-latest'"
48 rustup target add thumbv7m-none-eabi
49 sudo apt-get -y install gcc-arm-none-eabi
50 - name: shellcheck the CI script
51 if: "matrix.platform == 'ubuntu-latest'"
53 sudo apt-get -y install shellcheck
54 shellcheck ci/ci-tests.sh
55 - name: Run CI script with coverage generation
57 shell: bash # Default on Winblows is powershell
58 run: LDK_COVERAGE_BUILD=true ./ci/ci-tests.sh
60 if: "!matrix.coverage"
61 shell: bash # Default on Winblows is powershell
63 - name: Install deps for kcov
67 sudo apt-get -y install binutils-dev libcurl4-openssl-dev zlib1g-dev libdw-dev libiberty-dev
71 wget https://github.com/SimonKagstrom/kcov/archive/master.tar.gz
73 cd kcov-master && mkdir build && cd build
76 make install DESTDIR=../../kcov-build
77 cd ../.. && rm -rf kcov-master master.tar.gz
78 - name: Generate coverage report
81 for file in target/debug/deps/lightning*; do
82 [ -x "${file}" ] || continue;
83 mkdir -p "target/cov/$(basename $file)";
84 ./kcov-build/usr/local/bin/kcov --exclude-pattern=/.cargo,/usr/lib --verify "target/cov/$(basename $file)" "$file";
86 - name: Upload coverage
88 uses: codecov/codecov-action@v3
90 # Could you use this to fake the coverage report for your PR? Sure.
91 # Will anyone be impressed by your amazing coverage? No
92 # Maybe if codecov wasn't broken we wouldn't need to do this...
93 token: f421b687-4dc2-4387-ac3d-dc3b2528af57
94 fail_ci_if_error: true
97 runs-on: ubuntu-latest
101 - name: Checkout source code
102 uses: actions/checkout@v3
103 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
104 uses: actions-rs/toolchain@v1
106 toolchain: ${{ env.TOOLCHAIN }}
109 - name: Cache routing graph snapshot
111 uses: actions/cache@v3
113 path: lightning/net_graph-2023-01-18.bin
114 key: ldk-net_graph-v0.0.113-2023-01-18.bin
115 - name: Fetch routing graph snapshot
116 if: steps.cache-graph.outputs.cache-hit != 'true'
118 curl --verbose -L -o lightning/net_graph-2023-01-18.bin https://bitcoin.ninja/ldk-net_graph-v0.0.113-2023-01-18.bin
119 echo "Sha sum: $(sha256sum lightning/net_graph-2023-01-18.bin | awk '{ print $1 }')"
120 if [ "$(sha256sum lightning/net_graph-2023-01-18.bin | awk '{ print $1 }')" != "${EXPECTED_ROUTING_GRAPH_SNAPSHOT_SHASUM}" ]; then
125 EXPECTED_ROUTING_GRAPH_SNAPSHOT_SHASUM: da6066f2bddcddbe7d8a6debbd53545697137b310bbb8c4911bc8c81fc5ff48c
126 - name: Fetch rapid graph sync reference input
128 curl --verbose -L -o lightning-rapid-gossip-sync/res/full_graph.lngossip https://bitcoin.ninja/ldk-compressed_graph-285cb27df79-2022-07-21.bin
129 echo "Sha sum: $(sha256sum lightning-rapid-gossip-sync/res/full_graph.lngossip | awk '{ print $1 }')"
130 if [ "$(sha256sum lightning-rapid-gossip-sync/res/full_graph.lngossip | awk '{ print $1 }')" != "${EXPECTED_RAPID_GOSSIP_SHASUM}" ]; then
135 EXPECTED_RAPID_GOSSIP_SHASUM: e0f5d11641c11896d7af3a2246d3d6c3f1720b7d2d17aab321ecce82e6b7deb8
136 - name: Test with Network Graph on Rust ${{ matrix.toolchain }}
139 RUSTFLAGS="--cfg=require_route_graph_test" cargo test
140 RUSTFLAGS="--cfg=require_route_graph_test" cargo test --features hashbrown
142 - name: Run benchmarks on Rust ${{ matrix.toolchain }}
145 RUSTFLAGS="--cfg=ldk_bench --cfg=require_route_graph_test" cargo bench
146 - name: Run benchmarks with hashbrown on Rust ${{ matrix.toolchain }}
149 RUSTFLAGS="--cfg=ldk_bench --cfg=require_route_graph_test" cargo bench --features hashbrown
152 runs-on: ubuntu-latest
156 - name: Checkout source code
157 uses: actions/checkout@v3
160 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
161 uses: actions-rs/toolchain@v1
163 toolchain: ${{ env.TOOLCHAIN }}
166 - name: Fetch full tree and rebase on upstream
168 git remote add upstream https://github.com/lightningdevkit/rust-lightning
170 export GIT_COMMITTER_EMAIL="rl-ci@example.com"
171 export GIT_COMMITTER_NAME="RL CI"
172 git rebase upstream/main
173 - name: For each commit, run cargo check (including in fuzz)
174 run: ci/check-each-commit.sh upstream/main
177 runs-on: ubuntu-latest
181 - name: Checkout source code
182 uses: actions/checkout@v3
185 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
186 uses: actions-rs/toolchain@v1
188 toolchain: ${{ env.TOOLCHAIN }}
191 - name: Run cargo check for release build.
193 cargo check --release
194 cargo check --no-default-features --features=no-std --release
195 cargo check --no-default-features --features=futures --release
197 RUSTDOCFLAGS="--cfg=anchors" cargo doc --release
198 - name: Run cargo check for Taproot build.
200 cargo check --release
201 cargo check --no-default-features --features=no-std --release
202 cargo check --no-default-features --features=futures --release
205 RUSTFLAGS: '--cfg=anchors --cfg=taproot'
206 RUSTDOCFLAGS: '--cfg=anchors --cfg=taproot'
209 runs-on: ubuntu-latest
213 - name: Checkout source code
214 uses: actions/checkout@v3
215 - name: Install Rust 1.58 toolchain
216 uses: actions-rs/toolchain@v1
221 - name: Install dependencies for honggfuzz
224 sudo apt-get -y install build-essential binutils-dev libunwind-dev
225 - name: Sanity check fuzz targets on Rust ${{ env.TOOLCHAIN }}
226 run: cd fuzz && RUSTFLAGS="--cfg=fuzzing" cargo test --verbose --color always
228 run: cd fuzz && ./ci-fuzz.sh && cd ..
229 - name: Run lightning-invoice fuzzers
230 run: cd lightning-invoice/fuzz && RUSTFLAGS="--cfg=fuzzing" cargo test --verbose && ./ci-fuzz.sh
233 runs-on: ubuntu-latest
237 - name: Checkout source code
238 uses: actions/checkout@v3
239 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
240 uses: actions-rs/toolchain@v1
242 toolchain: ${{ env.TOOLCHAIN }}
245 - name: Install clippy
247 rustup component add clippy
248 - name: Run default clippy linting
250 cargo clippy -- -Aclippy::erasing_op -Aclippy::never_loop -Aclippy::if_same_then_else -Dclippy::try_err