1 name: Continuous Integration Checks
3 on: [push, pull_request]
9 platform: [ ubuntu-latest ]
12 # 1.30.0 is MSRV for Rust-Lightning
14 # 1.34.2 is Debian stable
16 # 1.39.0 is MSRV for lightning-net-tokio and generates coverage
22 platform: macos-latest
25 platform: windows-latest
32 runs-on: ${{ matrix.platform }}
34 - name: Checkout source code
35 uses: actions/checkout@v2
36 - name: Install Rust ${{ matrix.toolchain }} toolchain
37 uses: actions-rs/toolchain@v1
39 toolchain: ${{ matrix.toolchain }}
42 - name: Build on Rust ${{ matrix.toolchain }} with net-tokio
43 if: "matrix.build-net-tokio && !matrix.coverage"
44 run: cargo build --verbose --color always
45 - name: Build on Rust ${{ matrix.toolchain }} with net-tokio and full code-linking for coverage generation
47 run: RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always
48 - name: Build on Rust ${{ matrix.toolchain }}
49 if: "! matrix.build-net-tokio"
50 run: cargo build --verbose --color always -p lightning
51 - name: Test on Rust ${{ matrix.toolchain }} with net-tokio
52 if: "matrix.build-net-tokio && !matrix.coverage"
53 run: cargo test --verbose --color always
54 - name: Test on Rust ${{ matrix.toolchain }} with net-tokio and full code-linking for coverage generation
56 run: RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always
57 - name: Test on Rust ${{ matrix.toolchain }}
58 if: "! matrix.build-net-tokio"
59 run: cargo test --verbose --color always -p lightning
60 - name: Install deps for kcov
64 sudo apt-get -y install binutils-dev libcurl4-openssl-dev zlib1g-dev libdw-dev libiberty-dev
68 wget https://github.com/SimonKagstrom/kcov/archive/master.tar.gz
70 cd kcov-master && mkdir build && cd build
73 make install DESTDIR=../../kcov-build
74 cd ../.. && rm -rf kcov-master master.tar.gz
75 - name: Generate coverage report
78 for file in target/debug/lightning-*; do
79 [ -x "${file}" ] || continue;
80 mkdir -p "target/cov/$(basename $file)";
81 ./kcov-build/usr/local/bin/kcov --exclude-pattern=/.cargo,/usr/lib --verify "target/cov/$(basename $file)" "$file";
83 - name: Upload coverage
85 uses: codecov/codecov-action@v1
87 # Could you use this to fake the coverage report for your PR? Sure.
88 # Will anyone be impressed by your amazing coverage? No
89 # Maybe if codecov wasn't broken we wouldn't need to do this...
90 token: f421b687-4dc2-4387-ac3d-dc3b2528af57
91 fail_ci_if_error: true
94 runs-on: ubuntu-latest
98 - name: Checkout source code
99 uses: actions/checkout@v2
102 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
103 uses: actions-rs/toolchain@v1
105 toolchain: ${{ env.TOOLCHAIN }}
108 - name: Fetch full tree and rebase on upstream
110 git remote add upstream https://github.com/rust-bitcoin/rust-lightning
112 git rebase upstream/main
113 - name: For each commit, run cargo check (including in fuzz)
114 run: ci/check-each-commit.sh upstream/main
117 runs-on: ubuntu-latest
121 - name: Checkout source code
122 uses: actions/checkout@v2
123 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
124 uses: actions-rs/toolchain@v1
126 toolchain: ${{ env.TOOLCHAIN }}
129 - name: Install dependencies for honggfuzz
132 sudo apt-get -y install build-essential binutils-dev libunwind-dev
133 - name: Sanity check fuzz targets on Rust ${{ env.TOOLCHAIN }}
134 run: cd fuzz && cargo test --verbose --color always
136 run: cd fuzz && ./ci-fuzz.sh
139 runs-on: ubuntu-latest
140 # Ubuntu's version of rustc uses its own LLVM instead of being a real native package.
141 # This leaves us with an incompatible LLVM version when linking. Instead, use a real OS.
142 # We further (temporarily) use Debian experimental since testing links rustc against the
143 # brand-new llvm-10, but clang/llvm still default to LLVM 9.
144 container: debian:experimental
148 - name: Install native Rust toolchain, Valgrind, and build utilitis
150 echo 'Package: llvm llvm-runtime clang lld' > /etc/apt/preferences.d/99-llvm10
151 echo 'Pin: release n=experimental' >> /etc/apt/preferences.d/99-llvm10
152 echo 'Pin-Priority: 995' >> /etc/apt/preferences.d/99-llvm10
154 apt-get -y dist-upgrade
155 apt-get -y install cargo valgrind lld git g++ clang
156 - name: Checkout source code
157 uses: actions/checkout@v2
158 - name: Sanity test bindings
159 working-directory: lightning-c-bindings
161 - name: Install cbindgen
162 run: cargo install --force cbindgen
163 - name: Rebuild bindings, and check the sample app builds + links
164 run: ./genbindings.sh
165 - name: Check that the latest bindings are in git
167 if [ "$(git diff)" != "" ]; then
168 # cbindgen's bindings output order can be FS-dependant, so check that the lines are all the same:
169 mv lightning-c-bindings/include/lightning.h lightning-c-bindings/include/lightning.h.new
170 git checkout lightning-c-bindings/include/lightning.h
171 cat lightning-c-bindings/include/lightning.h | sort > lightning-c-bindings/include/lightning.h.sorted
172 cat lightning-c-bindings/include/lightning.h.new | sort > lightning-c-bindings/include/lightning.h.new.sorted
173 diff lightning-c-bindings/include/lightning.h.sorted lightning-c-bindings/include/lightning.h.new.sorted
175 mv lightning-c-bindings/include/lightningpp.hpp lightning-c-bindings/include/lightningpp.hpp.new
176 git checkout lightning-c-bindings/include/lightningpp.hpp
177 cat lightning-c-bindings/include/lightningpp.hpp | sort > lightning-c-bindings/include/lightningpp.hpp.sorted
178 cat lightning-c-bindings/include/lightningpp.hpp.new | sort > lightning-c-bindings/include/lightningpp.hpp.new.sorted
179 diff lightning-c-bindings/include/lightningpp.hpp.sorted lightning-c-bindings/include/lightningpp.hpp.new.sorted
181 [ "$(diff lightning-c-bindings/include/lightning.h.sorted lightning-c-bindings/include/lightning.h.new.sorted)" != "" ] && exit 2
182 [ "$(diff lightning-c-bindings/include/lightningpp.hpp.sorted lightning-c-bindings/include/lightningpp.hpp.new.sorted)" != "" ] && exit 3