Fix step naming in fuzz tests in GitHub Actions
[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 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: Test on Rust ${{ matrix.toolchain }} with net-tokio
42         if: matrix.build-net-tokio
43         run: RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always
44       - name: Test on Rust ${{ matrix.toolchain }}
45         if: "! matrix.build-net-tokio"
46         run: RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always  -p lightning
47       - name: Install deps for kcov
48         if: matrix.coverage
49         run: |
50           sudo apt-get update
51           sudo apt-get -y install binutils-dev libcurl4-openssl-dev zlib1g-dev libdw-dev libiberty-dev
52       - name: Install kcov
53         if: matrix.coverage
54         run: |
55           wget https://github.com/SimonKagstrom/kcov/archive/master.tar.gz
56           tar xzf master.tar.gz
57           cd kcov-master && mkdir build && cd build
58           cmake ..
59           make
60           make install DESTDIR=../../kcov-build
61           cd ../.. && rm -rf kcov-master master.tar.gz
62       - name: Generate coverage report
63         if: matrix.coverage
64         run: |
65           for file in target/debug/lightning-*; do
66             [ -x "${file}" ] || continue;
67             mkdir -p "target/cov/$(basename $file)";
68             ./kcov-build/usr/local/bin/kcov --exclude-pattern=/.cargo,/usr/lib --verify "target/cov/$(basename $file)" "$file";
69           done
70       - name: Upload coverage
71         if: matrix.coverage
72         uses: codecov/codecov-action@v1
73         with:
74           fail_ci_if_error: true
75
76   fuzz:
77     runs-on: ubuntu-latest
78     env:
79       TOOLCHAIN: stable
80     steps:
81       - name: Checkout source code
82         uses: actions/checkout@v2
83       - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
84         uses: actions-rs/toolchain@v1
85         with:
86           toolchain: ${{ env.TOOLCHAIN }}
87           override: true
88           profile: minimal
89       - name: Install dependencies for honggfuzz
90         run: |
91           sudo apt-get update
92           sudo apt-get -y install build-essential binutils-dev libunwind-dev
93       - name: Sanity check fuzz targets on Rust ${{ env.TOOLCHAIN }}
94         run: cd fuzz && cargo test --verbose --color always
95       - name: Run fuzzers
96         run: cd fuzz && ./ci-fuzz.sh