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 }}
144 RUSTC_BOOTSTRAP=1 cargo bench --features _bench_unstable
147 runs-on: ubuntu-latest
151 - name: Checkout source code
152 uses: actions/checkout@v3
155 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
156 uses: actions-rs/toolchain@v1
158 toolchain: ${{ env.TOOLCHAIN }}
161 - name: Fetch full tree and rebase on upstream
163 git remote add upstream https://github.com/lightningdevkit/rust-lightning
165 export GIT_COMMITTER_EMAIL="rl-ci@example.com"
166 export GIT_COMMITTER_NAME="RL CI"
167 git rebase upstream/main
168 - name: For each commit, run cargo check (including in fuzz)
169 run: ci/check-each-commit.sh upstream/main
172 runs-on: ubuntu-latest
176 - name: Checkout source code
177 uses: actions/checkout@v3
180 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
181 uses: actions-rs/toolchain@v1
183 toolchain: ${{ env.TOOLCHAIN }}
186 - name: Run cargo check for release build.
188 cargo check --release
189 cargo check --no-default-features --features=no-std --release
190 cargo check --no-default-features --features=futures --release
192 RUSTDOCFLAGS="--cfg=anchors" cargo doc --release
193 - name: Run cargo check for Taproot build.
195 cargo check --release
196 cargo check --no-default-features --features=no-std --release
197 cargo check --no-default-features --features=futures --release
200 RUSTFLAGS: '--cfg=anchors --cfg=taproot'
201 RUSTDOCFLAGS: '--cfg=anchors --cfg=taproot'
204 runs-on: ubuntu-latest
208 - name: Checkout source code
209 uses: actions/checkout@v3
210 - name: Install Rust 1.58 toolchain
211 uses: actions-rs/toolchain@v1
216 - name: Install dependencies for honggfuzz
219 sudo apt-get -y install build-essential binutils-dev libunwind-dev
220 - name: Sanity check fuzz targets on Rust ${{ env.TOOLCHAIN }}
221 run: cd fuzz && RUSTFLAGS="--cfg=fuzzing" cargo test --verbose --color always
223 run: cd fuzz && ./ci-fuzz.sh && cd ..
224 - name: Run lightning-invoice fuzzers
225 run: cd lightning-invoice/fuzz && RUSTFLAGS="--cfg=fuzzing" cargo test --verbose && ./ci-fuzz.sh
228 runs-on: ubuntu-latest
232 - name: Checkout source code
233 uses: actions/checkout@v3
234 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
235 uses: actions-rs/toolchain@v1
237 toolchain: ${{ env.TOOLCHAIN }}
240 - name: Install clippy
242 rustup component add clippy
243 - name: Run default clippy linting
245 cargo clippy -- -Aclippy::erasing_op -Aclippy::never_loop -Aclippy::if_same_then_else -Dclippy::try_err