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 && !matrix.coverage"
38 run: cargo build --verbose --color always
39 - name: Build on Rust ${{ matrix.toolchain }} with net-tokio and full code-linking for coverage generation
41 run: RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always
42 - name: Build on Rust ${{ matrix.toolchain }}
43 if: "! matrix.build-net-tokio"
44 run: cargo build --verbose --color always -p lightning
45 - name: Test on Rust ${{ matrix.toolchain }} with net-tokio
46 if: "matrix.build-net-tokio && !matrix.coverage"
47 run: cargo test --verbose --color always
48 - name: Test on Rust ${{ matrix.toolchain }} with net-tokio and full code-linking for coverage generation
50 run: RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always
51 - name: Test on Rust ${{ matrix.toolchain }}
52 if: "! matrix.build-net-tokio"
53 run: cargo test --verbose --color always -p lightning
54 - name: Install deps for kcov
58 sudo apt-get -y install binutils-dev libcurl4-openssl-dev zlib1g-dev libdw-dev libiberty-dev
62 wget https://github.com/SimonKagstrom/kcov/archive/master.tar.gz
64 cd kcov-master && mkdir build && cd build
67 make install DESTDIR=../../kcov-build
68 cd ../.. && rm -rf kcov-master master.tar.gz
69 - name: Generate coverage report
72 for file in target/debug/lightning-*; do
73 [ -x "${file}" ] || continue;
74 mkdir -p "target/cov/$(basename $file)";
75 ./kcov-build/usr/local/bin/kcov --exclude-pattern=/.cargo,/usr/lib --verify "target/cov/$(basename $file)" "$file";
77 - name: Upload coverage
79 uses: codecov/codecov-action@v1
81 # Could you use this to fake the coverage report for your PR? Sure.
82 # Will anyone be impressed by your amazing coverage? No
83 # Maybe if codecov wasn't broken we wouldn't need to do this...
84 token: f421b687-4dc2-4387-ac3d-dc3b2528af57
85 fail_ci_if_error: true
88 runs-on: ubuntu-latest
92 - name: Checkout source code
93 uses: actions/checkout@v2
96 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
97 uses: actions-rs/toolchain@v1
99 toolchain: ${{ env.TOOLCHAIN }}
102 - name: Fetch full tree and rebase on upstream
104 git remote add upstream https://github.com/rust-bitcoin/rust-lightning
106 git rebase upstream/main
107 - name: For each commit, run cargo check (including in fuzz)
108 run: ci/check-each-commit.sh upstream/main
111 runs-on: ubuntu-latest
115 - name: Checkout source code
116 uses: actions/checkout@v2
117 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
118 uses: actions-rs/toolchain@v1
120 toolchain: ${{ env.TOOLCHAIN }}
123 - name: Install dependencies for honggfuzz
126 sudo apt-get -y install build-essential binutils-dev libunwind-dev
127 - name: Sanity check fuzz targets on Rust ${{ env.TOOLCHAIN }}
128 run: cd fuzz && cargo test --verbose --color always
130 run: cd fuzz && ./ci-fuzz.sh
133 runs-on: ubuntu-latest
134 # Ubuntu's version of rustc uses its own LLVM instead of being a real native package.
135 # This leaves us with an incompatible LLVM version when linking. Instead, use a real OS.
136 # We further (temporarily) use Debian experimental since testing links rustc against the
137 # brand-new llvm-10, but clang/llvm still default to LLVM 9.
138 container: debian:experimental
142 - name: Install native Rust toolchain, Valgrind, and build utilitis
144 echo 'Package: llvm llvm-runtime clang lld' > /etc/apt/preferences.d/99-llvm10
145 echo 'Pin: release n=experimental' >> /etc/apt/preferences.d/99-llvm10
146 echo 'Pin-Priority: 995' >> /etc/apt/preferences.d/99-llvm10
148 apt-get -y dist-upgrade
149 apt-get -y install cargo valgrind lld git g++ clang
150 - name: Checkout source code
151 uses: actions/checkout@v2
152 - name: Sanity test bindings
153 working-directory: lightning-c-bindings
155 - name: Install cbindgen
156 run: cargo install --force cbindgen
157 - name: Rebuild bindings, and check the sample app builds + links
158 run: ./genbindings.sh
159 - name: Check that the latest bindings are in git
161 if [ "$(git diff)" != "" ]; then
162 # cbindgen's bindings output order can be FS-dependant, so check that the lines are all the same:
163 mv lightning-c-bindings/include/lightning.h lightning-c-bindings/include/lightning.h.new
164 git checkout lightning-c-bindings/include/lightning.h
165 cat lightning-c-bindings/include/lightning.h | sort > lightning-c-bindings/include/lightning.h.sorted
166 cat lightning-c-bindings/include/lightning.h.new | sort > lightning-c-bindings/include/lightning.h.new.sorted
167 diff lightning-c-bindings/include/lightning.h.sorted lightning-c-bindings/include/lightning.h.new.sorted
169 mv lightning-c-bindings/include/lightningpp.hpp lightning-c-bindings/include/lightningpp.hpp.new
170 git checkout lightning-c-bindings/include/lightningpp.hpp
171 cat lightning-c-bindings/include/lightningpp.hpp | sort > lightning-c-bindings/include/lightningpp.hpp.sorted
172 cat lightning-c-bindings/include/lightningpp.hpp.new | sort > lightning-c-bindings/include/lightningpp.hpp.new.sorted
173 diff lightning-c-bindings/include/lightningpp.hpp.sorted lightning-c-bindings/include/lightningpp.hpp.new.sorted
175 [ "$(diff lightning-c-bindings/include/lightning.h.sorted lightning-c-bindings/include/lightning.h.new.sorted)" != "" ] && exit 2
176 [ "$(diff lightning-c-bindings/include/lightningpp.hpp.sorted lightning-c-bindings/include/lightningpp.hpp.new.sorted)" != "" ] && exit 3