1 name: Continuous Integration Checks
3 on: [push, pull_request]
11 # 1.30.0 is MSRV for Rust-Lightning
13 # 1.34.2 is Debian stable
15 # 1.39.0 is MSRV for lightning-net-tokio and generates coverage
30 runs-on: ubuntu-latest
32 - name: Checkout source code
33 uses: actions/checkout@v2
34 - name: Install Rust ${{ matrix.toolchain }} toolchain
35 uses: actions-rs/toolchain@v1
37 toolchain: ${{ matrix.toolchain }}
40 - name: Build on Rust ${{ matrix.toolchain }} with net-tokio
41 if: matrix.build-net-tokio
42 run: RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always
43 - name: Build on Rust ${{ matrix.toolchain }}
44 if: "! matrix.build-net-tokio"
45 run: RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always -p lightning
46 - name: Build bindings on Rust ${{ matrix.toolchain }}
47 if: matrix.build-bindings
48 run: RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always -p lightning-c-bindings
49 - name: Test on Rust ${{ matrix.toolchain }} with net-tokio
50 if: matrix.build-net-tokio
51 run: RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always
52 - name: Test on Rust ${{ matrix.toolchain }}
53 if: "! matrix.build-net-tokio"
54 run: RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always -p lightning
55 - name: Install deps for kcov
59 sudo apt-get -y install binutils-dev libcurl4-openssl-dev zlib1g-dev libdw-dev libiberty-dev
63 wget https://github.com/SimonKagstrom/kcov/archive/master.tar.gz
65 cd kcov-master && mkdir build && cd build
68 make install DESTDIR=../../kcov-build
69 cd ../.. && rm -rf kcov-master master.tar.gz
70 - name: Generate coverage report
73 for file in target/debug/lightning-*; do
74 [ -x "${file}" ] || continue;
75 mkdir -p "target/cov/$(basename $file)";
76 ./kcov-build/usr/local/bin/kcov --exclude-pattern=/.cargo,/usr/lib --verify "target/cov/$(basename $file)" "$file";
78 - name: Upload coverage
80 uses: codecov/codecov-action@v1
82 # Could you use this to fake the coverage report for your PR? Sure.
83 # Will anyone be impressed by your amazing coverage? No
84 # Maybe if codecov wasn't broken we wouldn't need to do this...
85 token: f421b687-4dc2-4387-ac3d-dc3b2528af57
86 fail_ci_if_error: true
89 runs-on: ubuntu-latest
93 - name: Checkout source code
94 uses: actions/checkout@v2
95 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
96 uses: actions-rs/toolchain@v1
98 toolchain: ${{ env.TOOLCHAIN }}
101 - name: Install dependencies for honggfuzz
104 sudo apt-get -y install build-essential binutils-dev libunwind-dev
105 - name: Sanity check fuzz targets on Rust ${{ env.TOOLCHAIN }}
106 run: cd fuzz && cargo test --verbose --color always
108 run: cd fuzz && ./ci-fuzz.sh
111 runs-on: ubuntu-latest
112 # Ubuntu's version of rustc uses its own LLVM instead of being a real native package.
113 # This leaves us with an incompatible LLVM version when linking. Instead, use a real OS.
114 container: debian:testing
118 - name: Install native Rust toolchain, Valgrind, and build utilitis
121 apt-get -y dist-upgrade
122 apt-get -y install cargo valgrind lld git g++ clang
123 - name: Checkout source code
124 uses: actions/checkout@v2
125 - name: Install cbindgen
126 run: cargo install --force cbindgen
127 - name: Rebuild bindings, and check the sample app builds + links
128 run: ./genbindings.sh
129 - name: Check that the latest bindings are in git
131 if [ "$(git diff)" != "" ]; then
132 # cbindgen's bindings output order can be FS-dependant, so check that the lines are all the same:
133 mv lightning-c-bindings/include/lightning.h lightning-c-bindings/include/lightning.h.new
134 git checkout lightning-c-bindings/include/lightning.h
135 cat lightning-c-bindings/include/lightning.h | sort > lightning-c-bindings/include/lightning.h.sorted
136 cat lightning-c-bindings/include/lightning.h.new | sort > lightning-c-bindings/include/lightning.h.new.sorted
137 diff lightning-c-bindings/include/lightning.h.sorted lightning-c-bindings/include/lightning.h.new.sorted
139 mv lightning-c-bindings/include/lightningpp.hpp lightning-c-bindings/include/lightningpp.hpp.new
140 git checkout lightning-c-bindings/include/lightningpp.hpp
141 cat lightning-c-bindings/include/lightningpp.hpp | sort > lightning-c-bindings/include/lightningpp.hpp.sorted
142 cat lightning-c-bindings/include/lightningpp.hpp.new | sort > lightning-c-bindings/include/lightningpp.hpp.new.sorted
143 diff lightning-c-bindings/include/lightningpp.hpp.sorted lightning-c-bindings/include/lightningpp.hpp.new.sorted
145 [ "$(diff lightning-c-bindings/include/lightning.h.sorted lightning-c-bindings/include/lightning.h.new.sorted)" != "" ] && exit 2
146 [ "$(diff lightning-c-bindings/include/lightningpp.hpp.sorted lightning-c-bindings/include/lightningpp.hpp.new.sorted)" != "" ] && exit 3