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