Add a Headers-over-DNS client to lightning-block-sync.
[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                      nightly,
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: nightly
21             build-net-tokio: true
22             run-mutagen: true
23           - toolchain: 1.39.0
24             build-net-tokio: true
25             coverage: true
26     runs-on: ubuntu-latest
27     steps:
28       - name: Checkout source code
29         uses: actions/checkout@v2
30       - name: Install Rust ${{ matrix.toolchain }} toolchain
31         uses: actions-rs/toolchain@v1
32         with:
33           toolchain: ${{ matrix.toolchain }}
34           override: true
35           profile: minimal
36       - name: Build on Rust ${{ matrix.toolchain }} with net-tokio
37         if: matrix.build-net-tokio
38         run: RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always
39       - name: Build on Rust ${{ matrix.toolchain }}
40         if: "! matrix.build-net-tokio"
41         run: RUSTFLAGS="-C link-dead-code" cargo build --verbose  --color always -p lightning
42       - name: Build Block Sync Clients on Rust ${{ matrix.toolchain }} with features
43         if: matrix.build-net-tokio
44         run: |
45           cd lightning-block-sync
46           RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always --features tokio
47           RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always --features rest-client
48           RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always --features rpc-client
49           RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always --features rpc-client,rest-client
50           RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always --features rpc-client,rest-client,tokio
51           cd ..
52       - name: Test on Rust ${{ matrix.toolchain }} with net-tokio
53         if: matrix.build-net-tokio
54         run: RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always
55       - name: Test on Rust ${{ matrix.toolchain }}
56         if: "! matrix.build-net-tokio"
57         run: RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always  -p lightning
58       - name: Run mutagen tests on ${{ matrix.toolchain }}
59         if: matrix.run-mutagen
60      # Run mutagen on nightly with TheBlueMatt's fork which exits with non-0 status
61      # if any mutations resulted in anything except test failures to prevent regressions.
62         run: |
63           rm -rf mutagen && git clone https://github.com/TheBlueMatt/mutagen
64           cargo install --force --path mutagen/mutagen-runner
65           cd lightning
66           ~/.cargo/bin/cargo-mutagen --features mutation_testing
67      # Generate code cov information on Rust 1.39.0
68       - name: Install deps for kcov
69         if: matrix.coverage
70         run: |
71           sudo apt-get update
72           sudo apt-get -y install binutils-dev libcurl4-openssl-dev zlib1g-dev libdw-dev libiberty-dev
73       - name: Install kcov
74         if: matrix.coverage
75         run: |
76           wget https://github.com/SimonKagstrom/kcov/archive/master.tar.gz
77           tar xzf master.tar.gz
78           cd kcov-master && mkdir build && cd build
79           cmake ..
80           make
81           make install DESTDIR=../../kcov-build
82           cd ../.. && rm -rf kcov-master master.tar.gz
83       - name: Generate coverage report
84         if: matrix.coverage
85         run: |
86           for file in target/debug/lightning-*; do
87             [ -x "${file}" ] || continue;
88             mkdir -p "target/cov/$(basename $file)";
89             ./kcov-build/usr/local/bin/kcov --exclude-pattern=/.cargo,/usr/lib --verify "target/cov/$(basename $file)" "$file";
90           done
91       - name: Upload coverage
92         if: matrix.coverage
93         uses: codecov/codecov-action@v1
94         with:
95           fail_ci_if_error: true
96
97   fuzz:
98     runs-on: ubuntu-latest
99     env:
100       TOOLCHAIN: stable
101     steps:
102       - name: Checkout source code
103         uses: actions/checkout@v2
104       - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
105         uses: actions-rs/toolchain@v1
106         with:
107           toolchain: ${{ env.TOOLCHAIN }}
108           override: true
109           profile: minimal
110       - name: Install dependencies for honggfuzz
111         run: |
112           sudo apt-get update
113           sudo apt-get -y install build-essential binutils-dev libunwind-dev
114       - name: Sanity check fuzz targets on Rust ${{ env.TOOLCHAIN }}
115         run: cd fuzz && cargo test --verbose --color always
116       - name: Run fuzzers
117         run: cd fuzz && ./ci-fuzz.sh