2020-04-21 20:24:39 +10:00
|
|
|
name: Continuous Integration Checks
|
|
|
|
|
2023-04-17 10:25:30 -07:00
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches-ignore:
|
|
|
|
- master
|
|
|
|
pull_request:
|
|
|
|
branches-ignore:
|
|
|
|
- master
|
2020-04-21 20:24:39 +10:00
|
|
|
|
2023-04-17 11:32:53 -07:00
|
|
|
concurrency:
|
|
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
|
|
cancel-in-progress: true
|
|
|
|
|
2020-04-21 20:24:39 +10:00
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
strategy:
|
2021-07-29 17:40:14 +00:00
|
|
|
fail-fast: false
|
2020-04-21 20:24:39 +10:00
|
|
|
matrix:
|
2023-03-15 19:20:08 +00:00
|
|
|
platform: [ ubuntu-latest, windows-latest, macos-latest ]
|
|
|
|
toolchain: [ stable, beta ]
|
2020-04-21 20:24:39 +10:00
|
|
|
include:
|
|
|
|
- toolchain: stable
|
2023-03-15 19:20:08 +00:00
|
|
|
platform: ubuntu-latest
|
2023-01-19 11:45:46 -06:00
|
|
|
coverage: true
|
2023-03-15 19:20:08 +00:00
|
|
|
# 1.48.0 is the MSRV for all crates except lightning-transaction-sync and Win/Mac
|
2023-03-15 18:08:35 +00:00
|
|
|
- toolchain: 1.48.0
|
2023-03-15 19:20:08 +00:00
|
|
|
platform: ubuntu-latest
|
|
|
|
# Windows requires 1.49.0 because that's the MSRV for supported Tokio
|
|
|
|
- toolchain: 1.49.0
|
|
|
|
platform: windows-latest
|
|
|
|
# MacOS-latest requires 1.54.0 because that's what's required for linking to work properly
|
|
|
|
- toolchain: 1.54.0
|
|
|
|
platform: macos-latest
|
2020-09-17 14:22:55 -04:00
|
|
|
runs-on: ${{ matrix.platform }}
|
2020-04-21 20:24:39 +10:00
|
|
|
steps:
|
|
|
|
- name: Checkout source code
|
2022-03-02 17:35:18 +00:00
|
|
|
uses: actions/checkout@v3
|
2020-04-21 20:24:39 +10:00
|
|
|
- name: Install Rust ${{ matrix.toolchain }} toolchain
|
2023-07-06 14:30:31 +02:00
|
|
|
run: |
|
|
|
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile=minimal --default-toolchain ${{ matrix.toolchain }}
|
|
|
|
rustup override set ${{ matrix.toolchain }}
|
2023-03-15 19:20:08 +00:00
|
|
|
- name: Install no-std-check dependencies for ARM Embedded
|
2023-03-15 18:17:02 +00:00
|
|
|
if: "matrix.platform == 'ubuntu-latest'"
|
2022-10-06 15:44:03 +00:00
|
|
|
run: |
|
|
|
|
rustup target add thumbv7m-none-eabi
|
|
|
|
sudo apt-get -y install gcc-arm-none-eabi
|
2023-03-15 19:20:08 +00:00
|
|
|
- name: shellcheck the CI script
|
|
|
|
if: "matrix.platform == 'ubuntu-latest'"
|
2022-10-10 14:47:18 -04:00
|
|
|
run: |
|
2023-03-15 19:20:08 +00:00
|
|
|
sudo apt-get -y install shellcheck
|
|
|
|
shellcheck ci/ci-tests.sh
|
|
|
|
- name: Run CI script with coverage generation
|
|
|
|
if: matrix.coverage
|
2022-10-10 14:47:18 -04:00
|
|
|
shell: bash # Default on Winblows is powershell
|
2023-03-15 19:20:08 +00:00
|
|
|
run: LDK_COVERAGE_BUILD=true ./ci/ci-tests.sh
|
|
|
|
- name: Run CI script
|
2023-03-15 18:16:01 +00:00
|
|
|
if: "!matrix.coverage"
|
2023-03-15 19:20:08 +00:00
|
|
|
shell: bash # Default on Winblows is powershell
|
|
|
|
run: ./ci/ci-tests.sh
|
2020-04-21 20:24:39 +10:00
|
|
|
- name: Install deps for kcov
|
|
|
|
if: matrix.coverage
|
|
|
|
run: |
|
|
|
|
sudo apt-get update
|
|
|
|
sudo apt-get -y install binutils-dev libcurl4-openssl-dev zlib1g-dev libdw-dev libiberty-dev
|
|
|
|
- name: Install kcov
|
|
|
|
if: matrix.coverage
|
|
|
|
run: |
|
|
|
|
wget https://github.com/SimonKagstrom/kcov/archive/master.tar.gz
|
|
|
|
tar xzf master.tar.gz
|
|
|
|
cd kcov-master && mkdir build && cd build
|
|
|
|
cmake ..
|
|
|
|
make
|
|
|
|
make install DESTDIR=../../kcov-build
|
|
|
|
cd ../.. && rm -rf kcov-master master.tar.gz
|
|
|
|
- name: Generate coverage report
|
|
|
|
if: matrix.coverage
|
|
|
|
run: |
|
2021-01-26 17:17:01 -05:00
|
|
|
for file in target/debug/deps/lightning*; do
|
2020-04-21 20:24:39 +10:00
|
|
|
[ -x "${file}" ] || continue;
|
|
|
|
mkdir -p "target/cov/$(basename $file)";
|
|
|
|
./kcov-build/usr/local/bin/kcov --exclude-pattern=/.cargo,/usr/lib --verify "target/cov/$(basename $file)" "$file";
|
|
|
|
done
|
|
|
|
- name: Upload coverage
|
|
|
|
if: matrix.coverage
|
2022-04-05 17:32:54 +00:00
|
|
|
uses: codecov/codecov-action@v3
|
2020-04-21 20:24:39 +10:00
|
|
|
with:
|
2020-08-03 16:48:58 -04:00
|
|
|
# Could you use this to fake the coverage report for your PR? Sure.
|
|
|
|
# Will anyone be impressed by your amazing coverage? No
|
|
|
|
# Maybe if codecov wasn't broken we wouldn't need to do this...
|
|
|
|
token: f421b687-4dc2-4387-ac3d-dc3b2528af57
|
2020-04-21 20:24:39 +10:00
|
|
|
fail_ci_if_error: true
|
|
|
|
|
2021-02-15 16:49:44 -05:00
|
|
|
benchmark:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
env:
|
2022-10-31 18:46:31 +00:00
|
|
|
TOOLCHAIN: stable
|
2021-02-15 16:49:44 -05:00
|
|
|
steps:
|
|
|
|
- name: Checkout source code
|
2022-03-02 17:35:18 +00:00
|
|
|
uses: actions/checkout@v3
|
2021-02-15 16:49:44 -05:00
|
|
|
- name: Install Rust ${{ env.TOOLCHAIN }} toolchain
|
2023-07-06 14:30:31 +02:00
|
|
|
run: |
|
|
|
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile=minimal --default-toolchain ${{ env.TOOLCHAIN }}
|
|
|
|
rustup override set ${{ env.TOOLCHAIN }}
|
2021-02-15 16:49:44 -05:00
|
|
|
- name: Cache routing graph snapshot
|
|
|
|
id: cache-graph
|
2022-03-21 17:38:00 +00:00
|
|
|
uses: actions/cache@v3
|
2021-02-15 16:49:44 -05:00
|
|
|
with:
|
Update the lightning graph snapshot used in benchmarks
The previous copy was more than one and a half years old, the
lightning network has changed a lot since!
As of this commit, performance on my Xeon W-10885M with a
SK hynix Gold P31 storing a BTRFS volume is as follows:
```
test ln::channelmanager::bench::bench_sends ... bench: 5,896,492 ns/iter (+/- 512,421)
test routing::gossip::benches::read_network_graph ... bench: 1,645,740,604 ns/iter (+/- 47,611,514)
test routing::gossip::benches::write_network_graph ... bench: 234,870,775 ns/iter (+/- 8,301,775)
test routing::router::benches::generate_mpp_routes_with_probabilistic_scorer ... bench: 166,155,032 ns/iter (+/- 30,206,162)
test routing::router::benches::generate_mpp_routes_with_zero_penalty_scorer ... bench: 136,843,661 ns/iter (+/- 67,111,218)
test routing::router::benches::generate_routes_with_probabilistic_scorer ... bench: 52,954,598 ns/iter (+/- 11,360,547)
test routing::router::benches::generate_routes_with_zero_penalty_scorer ... bench: 37,598,126 ns/iter (+/- 17,262,519)
test bench::bench_sends ... bench: 37,760,922 ns/iter (+/- 5,179,123)
test bench::bench_reading_full_graph_from_file ... bench: 25,615 ns/iter (+/- 1,149)
```
2023-01-19 04:41:02 +00:00
|
|
|
path: lightning/net_graph-2023-01-18.bin
|
|
|
|
key: ldk-net_graph-v0.0.113-2023-01-18.bin
|
2021-02-15 16:49:44 -05:00
|
|
|
- name: Fetch routing graph snapshot
|
|
|
|
if: steps.cache-graph.outputs.cache-hit != 'true'
|
|
|
|
run: |
|
Update the lightning graph snapshot used in benchmarks
The previous copy was more than one and a half years old, the
lightning network has changed a lot since!
As of this commit, performance on my Xeon W-10885M with a
SK hynix Gold P31 storing a BTRFS volume is as follows:
```
test ln::channelmanager::bench::bench_sends ... bench: 5,896,492 ns/iter (+/- 512,421)
test routing::gossip::benches::read_network_graph ... bench: 1,645,740,604 ns/iter (+/- 47,611,514)
test routing::gossip::benches::write_network_graph ... bench: 234,870,775 ns/iter (+/- 8,301,775)
test routing::router::benches::generate_mpp_routes_with_probabilistic_scorer ... bench: 166,155,032 ns/iter (+/- 30,206,162)
test routing::router::benches::generate_mpp_routes_with_zero_penalty_scorer ... bench: 136,843,661 ns/iter (+/- 67,111,218)
test routing::router::benches::generate_routes_with_probabilistic_scorer ... bench: 52,954,598 ns/iter (+/- 11,360,547)
test routing::router::benches::generate_routes_with_zero_penalty_scorer ... bench: 37,598,126 ns/iter (+/- 17,262,519)
test bench::bench_sends ... bench: 37,760,922 ns/iter (+/- 5,179,123)
test bench::bench_reading_full_graph_from_file ... bench: 25,615 ns/iter (+/- 1,149)
```
2023-01-19 04:41:02 +00:00
|
|
|
curl --verbose -L -o lightning/net_graph-2023-01-18.bin https://bitcoin.ninja/ldk-net_graph-v0.0.113-2023-01-18.bin
|
|
|
|
echo "Sha sum: $(sha256sum lightning/net_graph-2023-01-18.bin | awk '{ print $1 }')"
|
|
|
|
if [ "$(sha256sum lightning/net_graph-2023-01-18.bin | awk '{ print $1 }')" != "${EXPECTED_ROUTING_GRAPH_SNAPSHOT_SHASUM}" ]; then
|
2021-02-15 16:49:44 -05:00
|
|
|
echo "Bad hash"
|
|
|
|
exit 1
|
|
|
|
fi
|
2021-11-03 10:50:08 -07:00
|
|
|
env:
|
Update the lightning graph snapshot used in benchmarks
The previous copy was more than one and a half years old, the
lightning network has changed a lot since!
As of this commit, performance on my Xeon W-10885M with a
SK hynix Gold P31 storing a BTRFS volume is as follows:
```
test ln::channelmanager::bench::bench_sends ... bench: 5,896,492 ns/iter (+/- 512,421)
test routing::gossip::benches::read_network_graph ... bench: 1,645,740,604 ns/iter (+/- 47,611,514)
test routing::gossip::benches::write_network_graph ... bench: 234,870,775 ns/iter (+/- 8,301,775)
test routing::router::benches::generate_mpp_routes_with_probabilistic_scorer ... bench: 166,155,032 ns/iter (+/- 30,206,162)
test routing::router::benches::generate_mpp_routes_with_zero_penalty_scorer ... bench: 136,843,661 ns/iter (+/- 67,111,218)
test routing::router::benches::generate_routes_with_probabilistic_scorer ... bench: 52,954,598 ns/iter (+/- 11,360,547)
test routing::router::benches::generate_routes_with_zero_penalty_scorer ... bench: 37,598,126 ns/iter (+/- 17,262,519)
test bench::bench_sends ... bench: 37,760,922 ns/iter (+/- 5,179,123)
test bench::bench_reading_full_graph_from_file ... bench: 25,615 ns/iter (+/- 1,149)
```
2023-01-19 04:41:02 +00:00
|
|
|
EXPECTED_ROUTING_GRAPH_SNAPSHOT_SHASUM: da6066f2bddcddbe7d8a6debbd53545697137b310bbb8c4911bc8c81fc5ff48c
|
2021-11-03 10:50:08 -07:00
|
|
|
- name: Fetch rapid graph sync reference input
|
|
|
|
run: |
|
2022-07-25 20:35:51 +02:00
|
|
|
curl --verbose -L -o lightning-rapid-gossip-sync/res/full_graph.lngossip https://bitcoin.ninja/ldk-compressed_graph-285cb27df79-2022-07-21.bin
|
2021-11-03 10:50:08 -07:00
|
|
|
echo "Sha sum: $(sha256sum lightning-rapid-gossip-sync/res/full_graph.lngossip | awk '{ print $1 }')"
|
|
|
|
if [ "$(sha256sum lightning-rapid-gossip-sync/res/full_graph.lngossip | awk '{ print $1 }')" != "${EXPECTED_RAPID_GOSSIP_SHASUM}" ]; then
|
|
|
|
echo "Bad hash"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
env:
|
2022-07-25 20:35:51 +02:00
|
|
|
EXPECTED_RAPID_GOSSIP_SHASUM: e0f5d11641c11896d7af3a2246d3d6c3f1720b7d2d17aab321ecce82e6b7deb8
|
2021-03-26 21:50:54 -04:00
|
|
|
- name: Test with Network Graph on Rust ${{ matrix.toolchain }}
|
|
|
|
run: |
|
|
|
|
cd lightning
|
|
|
|
RUSTFLAGS="--cfg=require_route_graph_test" cargo test
|
2021-05-27 04:04:20 +00:00
|
|
|
RUSTFLAGS="--cfg=require_route_graph_test" cargo test --features hashbrown
|
2021-03-26 21:50:54 -04:00
|
|
|
cd ..
|
2021-02-15 16:49:44 -05:00
|
|
|
- name: Run benchmarks on Rust ${{ matrix.toolchain }}
|
|
|
|
run: |
|
2023-05-11 06:03:57 +00:00
|
|
|
cd bench
|
|
|
|
RUSTFLAGS="--cfg=ldk_bench --cfg=require_route_graph_test" cargo bench
|
|
|
|
- name: Run benchmarks with hashbrown on Rust ${{ matrix.toolchain }}
|
|
|
|
run: |
|
|
|
|
cd bench
|
|
|
|
RUSTFLAGS="--cfg=ldk_bench --cfg=require_route_graph_test" cargo bench --features hashbrown
|
2021-02-15 16:49:44 -05:00
|
|
|
|
2020-09-15 14:39:44 -04:00
|
|
|
check_commits:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
env:
|
2022-03-27 17:11:22 +00:00
|
|
|
TOOLCHAIN: 1.57.0
|
2020-09-15 14:39:44 -04:00
|
|
|
steps:
|
|
|
|
- name: Checkout source code
|
2022-03-02 17:35:18 +00:00
|
|
|
uses: actions/checkout@v3
|
2020-09-15 14:39:44 -04:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
- name: Install Rust ${{ env.TOOLCHAIN }} toolchain
|
2023-07-06 14:30:31 +02:00
|
|
|
run: |
|
|
|
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile=minimal --default-toolchain ${{ env.TOOLCHAIN }}
|
|
|
|
rustup override set ${{ env.TOOLCHAIN }}
|
2020-09-15 14:39:44 -04:00
|
|
|
- name: Fetch full tree and rebase on upstream
|
|
|
|
run: |
|
2021-12-26 22:53:16 -05:00
|
|
|
git remote add upstream https://github.com/lightningdevkit/rust-lightning
|
2020-09-15 14:39:44 -04:00
|
|
|
git fetch upstream
|
2020-10-02 16:32:32 -04:00
|
|
|
export GIT_COMMITTER_EMAIL="rl-ci@example.com"
|
|
|
|
export GIT_COMMITTER_NAME="RL CI"
|
2020-09-15 14:39:44 -04:00
|
|
|
git rebase upstream/main
|
|
|
|
- name: For each commit, run cargo check (including in fuzz)
|
|
|
|
run: ci/check-each-commit.sh upstream/main
|
|
|
|
|
2022-06-10 10:45:57 +02:00
|
|
|
check_release:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
env:
|
|
|
|
TOOLCHAIN: stable
|
|
|
|
steps:
|
|
|
|
- name: Checkout source code
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
- name: Install Rust ${{ env.TOOLCHAIN }} toolchain
|
2023-07-06 14:30:31 +02:00
|
|
|
run: |
|
|
|
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile=minimal --default-toolchain ${{ env.TOOLCHAIN }}
|
|
|
|
rustup override set ${{ env.TOOLCHAIN }}
|
2022-06-10 10:45:57 +02:00
|
|
|
- name: Run cargo check for release build.
|
|
|
|
run: |
|
|
|
|
cargo check --release
|
|
|
|
cargo check --no-default-features --features=no-std --release
|
2022-10-10 14:47:18 -04:00
|
|
|
cargo check --no-default-features --features=futures --release
|
2022-06-10 10:45:57 +02:00
|
|
|
cargo doc --release
|
2023-03-30 22:59:21 -07:00
|
|
|
- name: Run cargo check for Taproot build.
|
|
|
|
run: |
|
|
|
|
cargo check --release
|
|
|
|
cargo check --no-default-features --features=no-std --release
|
|
|
|
cargo check --no-default-features --features=futures --release
|
|
|
|
cargo doc --release
|
|
|
|
env:
|
2023-06-20 11:29:00 -07:00
|
|
|
RUSTFLAGS: '--cfg=taproot'
|
|
|
|
RUSTDOCFLAGS: '--cfg=taproot'
|
2022-06-10 10:45:57 +02:00
|
|
|
|
2020-04-21 20:24:39 +10:00
|
|
|
fuzz:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
env:
|
2023-07-06 14:30:31 +02:00
|
|
|
TOOLCHAIN: 1.58
|
2020-04-21 20:24:39 +10:00
|
|
|
steps:
|
|
|
|
- name: Checkout source code
|
2022-03-02 17:35:18 +00:00
|
|
|
uses: actions/checkout@v3
|
2023-07-06 14:30:31 +02:00
|
|
|
- name: Install Rust ${{ env.TOOLCHAIN }} toolchain
|
|
|
|
run: |
|
|
|
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile=minimal --default-toolchain ${{ env.TOOLCHAIN }}
|
|
|
|
rustup override set ${{ env.TOOLCHAIN }}
|
2020-04-21 20:24:39 +10:00
|
|
|
- name: Install dependencies for honggfuzz
|
|
|
|
run: |
|
|
|
|
sudo apt-get update
|
|
|
|
sudo apt-get -y install build-essential binutils-dev libunwind-dev
|
2020-04-24 14:22:31 -04:00
|
|
|
- name: Sanity check fuzz targets on Rust ${{ env.TOOLCHAIN }}
|
2021-02-19 15:07:28 -05:00
|
|
|
run: cd fuzz && RUSTFLAGS="--cfg=fuzzing" cargo test --verbose --color always
|
2020-04-24 14:22:31 -04:00
|
|
|
- name: Run fuzzers
|
2021-04-07 13:04:29 -04:00
|
|
|
run: cd fuzz && ./ci-fuzz.sh && cd ..
|
|
|
|
- name: Run lightning-invoice fuzzers
|
|
|
|
run: cd lightning-invoice/fuzz && RUSTFLAGS="--cfg=fuzzing" cargo test --verbose && ./ci-fuzz.sh
|
2020-05-10 20:09:42 -04:00
|
|
|
|
2020-10-08 10:47:49 -07:00
|
|
|
linting:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
env:
|
2023-01-19 11:45:46 -06:00
|
|
|
TOOLCHAIN: stable
|
2020-10-08 10:47:49 -07:00
|
|
|
steps:
|
|
|
|
- name: Checkout source code
|
2022-03-02 17:35:18 +00:00
|
|
|
uses: actions/checkout@v3
|
2020-10-08 10:47:49 -07:00
|
|
|
- name: Install Rust ${{ env.TOOLCHAIN }} toolchain
|
2023-07-06 14:30:31 +02:00
|
|
|
run: |
|
|
|
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile=minimal --default-toolchain ${{ env.TOOLCHAIN }}
|
|
|
|
rustup override set ${{ env.TOOLCHAIN }}
|
2020-10-08 10:47:49 -07:00
|
|
|
- name: Install clippy
|
|
|
|
run: |
|
|
|
|
rustup component add clippy
|
|
|
|
- name: Run default clippy linting
|
|
|
|
run: |
|
2021-08-02 10:30:01 -05:00
|
|
|
cargo clippy -- -Aclippy::erasing_op -Aclippy::never_loop -Aclippy::if_same_then_else -Dclippy::try_err
|