Add subcrate which impls a simple SPV client from Bitcoin Core RPC
[rust-lightning] / .github / workflows / build.yml
1 name: Continuous Integration Checks
2
3 on: [push, pull_request]
4
5 jobs:
6   build:
7     strategy:
8       matrix:
9         toolchain: [ stable,
10                      beta,
11                      # 1.22.0 is MSRV for rust-lightning in general:
12                      1.22.0,
13                      # 1.34.2 is Debian stable
14                      1.34.2,
15                      # 1.39.0 is MSRV for lightning-net-tokio and lightning-block-sync and generates coverage
16                      1.39.0]
17         include:
18           - toolchain: stable
19             build-net-tokio: true
20           - toolchain: beta
21             build-net-tokio: true
22           - toolchain: 1.39.0
23             build-net-tokio: true
24             coverage: true
25     runs-on: ubuntu-latest
26     steps:
27       - name: Checkout source code
28         uses: actions/checkout@v2
29       - name: Install Rust ${{ matrix.toolchain }} toolchain
30         uses: actions-rs/toolchain@v1
31         with:
32           toolchain: ${{ matrix.toolchain }}
33           override: true
34           profile: minimal
35       - name: Build on Rust ${{ matrix.toolchain }} with net-tokio
36         if: matrix.build-net-tokio
37         run: RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always
38       - name: Build on Rust ${{ matrix.toolchain }}
39         if: "! matrix.build-net-tokio"
40         run: RUSTFLAGS="-C link-dead-code" cargo build --verbose  --color always -p lightning
41       - name: Build Block Sync Clients on Rust ${{ matrix.toolchain }} with features
42         if: matrix.build-net-tokio
43         run: |
44           cd lightning-block-sync
45           RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always --features rest-client
46           RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always --features rpc-client
47           RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always --features rpc-client,rest-client
48           RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always --features rpc-client,rest-client,tokio
49           cd ..
50       - name: Test on Rust ${{ matrix.toolchain }} with net-tokio
51         if: matrix.build-net-tokio
52         run: RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always
53       - name: Test on Rust ${{ matrix.toolchain }}
54         if: "! matrix.build-net-tokio"
55         run: RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always  -p lightning
56       - name: Install deps for kcov
57         if: matrix.coverage
58         run: |
59           sudo apt-get update
60           sudo apt-get -y install binutils-dev libcurl4-openssl-dev zlib1g-dev libdw-dev libiberty-dev
61       - name: Install kcov
62         if: matrix.coverage
63         run: |
64           wget https://github.com/SimonKagstrom/kcov/archive/master.tar.gz
65           tar xzf master.tar.gz
66           cd kcov-master && mkdir build && cd build
67           cmake ..
68           make
69           make install DESTDIR=../../kcov-build
70           cd ../.. && rm -rf kcov-master master.tar.gz
71       - name: Generate coverage report
72         if: matrix.coverage
73         run: |
74           for file in target/debug/lightning-*; do
75             [ -x "${file}" ] || continue;
76             mkdir -p "target/cov/$(basename $file)";
77             ./kcov-build/usr/local/bin/kcov --exclude-pattern=/.cargo,/usr/lib --verify "target/cov/$(basename $file)" "$file";
78           done
79       - name: Upload coverage
80         if: matrix.coverage
81         uses: codecov/codecov-action@v1
82         with:
83           fail_ci_if_error: true
84
85   fuzz:
86     runs-on: ubuntu-latest
87     env:
88       TOOLCHAIN: stable
89     steps:
90       - name: Checkout source code
91         uses: actions/checkout@v2
92       - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
93         uses: actions-rs/toolchain@v1
94         with:
95           toolchain: ${{ env.TOOLCHAIN }}
96           override: true
97           profile: minimal
98       - name: Install dependencies for honggfuzz
99         run: |
100           sudo apt-get update
101           sudo apt-get -y install build-essential binutils-dev libunwind-dev
102       - name: Sanity check fuzz targets on Rust ${{ env.TOOLCHAIN }}
103         run: cd fuzz && cargo test --verbose --color always
104       - name: Run fuzzers
105         run: cd fuzz && ./ci-fuzz.sh