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
26 runs-on: ubuntu-latest
28 - name: Checkout source code
29 uses: actions/checkout@v2
30 - name: Install Rust ${{ matrix.toolchain }} toolchain
31 uses: actions-rs/toolchain@v1
33 toolchain: ${{ matrix.toolchain }}
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: Test on Rust ${{ matrix.toolchain }} with net-tokio
43 if: matrix.build-net-tokio
44 run: RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always
45 - name: Test on Rust ${{ matrix.toolchain }}
46 if: "! matrix.build-net-tokio"
47 run: RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always -p lightning
48 - name: Install deps for kcov
52 sudo apt-get -y install binutils-dev libcurl4-openssl-dev zlib1g-dev libdw-dev libiberty-dev
56 wget https://github.com/SimonKagstrom/kcov/archive/master.tar.gz
58 cd kcov-master && mkdir build && cd build
61 make install DESTDIR=../../kcov-build
62 cd ../.. && rm -rf kcov-master master.tar.gz
63 - name: Generate coverage report
66 for file in target/debug/lightning-*; do
67 [ -x "${file}" ] || continue;
68 mkdir -p "target/cov/$(basename $file)";
69 ./kcov-build/usr/local/bin/kcov --exclude-pattern=/.cargo,/usr/lib --verify "target/cov/$(basename $file)" "$file";
71 - name: Upload coverage
73 uses: codecov/codecov-action@v1
75 # Could you use this to fake the coverage report for your PR? Sure.
76 # Will anyone be impressed by your amazing coverage? No
77 # Maybe if codecov wasn't broken we wouldn't need to do this...
78 token: f421b687-4dc2-4387-ac3d-dc3b2528af57
79 fail_ci_if_error: true
82 runs-on: ubuntu-latest
86 - name: Checkout source code
87 uses: actions/checkout@v2
88 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
89 uses: actions-rs/toolchain@v1
91 toolchain: ${{ env.TOOLCHAIN }}
94 - name: Install dependencies for honggfuzz
97 sudo apt-get -y install build-essential binutils-dev libunwind-dev
98 - name: Sanity check fuzz targets on Rust ${{ env.TOOLCHAIN }}
99 run: cd fuzz && cargo test --verbose --color always
101 run: cd fuzz && ./ci-fuzz.sh
104 runs-on: ubuntu-latest
105 # Ubuntu's version of rustc uses its own LLVM instead of being a real native package.
106 # This leaves us with an incompatible LLVM version when linking. Instead, use a real OS.
107 # We further (temporarily) use Debian experimental since testing links rustc against the
108 # brand-new llvm-10, but clang/llvm still default to LLVM 9.
109 container: debian:experimental
113 - name: Install native Rust toolchain, Valgrind, and build utilitis
115 echo 'Package: llvm llvm-runtime clang lld' > /etc/apt/preferences.d/99-llvm10
116 echo 'Pin: release n=experimental' >> /etc/apt/preferences.d/99-llvm10
117 echo 'Pin-Priority: 995' >> /etc/apt/preferences.d/99-llvm10
119 apt-get -y dist-upgrade
120 apt-get -y install cargo valgrind lld git g++ clang
121 - name: Checkout source code
122 uses: actions/checkout@v2
123 - name: Sanity test bindings
124 working-directory: lightning-c-bindings
126 - name: Install cbindgen
127 run: cargo install --force cbindgen
128 - name: Rebuild bindings, and check the sample app builds + links
129 run: ./genbindings.sh
130 - name: Check that the latest bindings are in git
132 if [ "$(git diff)" != "" ]; then
133 # cbindgen's bindings output order can be FS-dependant, so check that the lines are all the same:
134 mv lightning-c-bindings/include/lightning.h lightning-c-bindings/include/lightning.h.new
135 git checkout lightning-c-bindings/include/lightning.h
136 cat lightning-c-bindings/include/lightning.h | sort > lightning-c-bindings/include/lightning.h.sorted
137 cat lightning-c-bindings/include/lightning.h.new | sort > lightning-c-bindings/include/lightning.h.new.sorted
138 diff lightning-c-bindings/include/lightning.h.sorted lightning-c-bindings/include/lightning.h.new.sorted
140 mv lightning-c-bindings/include/lightningpp.hpp lightning-c-bindings/include/lightningpp.hpp.new
141 git checkout lightning-c-bindings/include/lightningpp.hpp
142 cat lightning-c-bindings/include/lightningpp.hpp | sort > lightning-c-bindings/include/lightningpp.hpp.sorted
143 cat lightning-c-bindings/include/lightningpp.hpp.new | sort > lightning-c-bindings/include/lightningpp.hpp.new.sorted
144 diff lightning-c-bindings/include/lightningpp.hpp.sorted lightning-c-bindings/include/lightningpp.hpp.new.sorted
146 [ "$(diff lightning-c-bindings/include/lightning.h.sorted lightning-c-bindings/include/lightning.h.new.sorted)" != "" ] && exit 2
147 [ "$(diff lightning-c-bindings/include/lightningpp.hpp.sorted lightning-c-bindings/include/lightningpp.hpp.new.sorted)" != "" ] && exit 3