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.45.2 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/deps/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 export GIT_COMMITTER_EMAIL="rl-ci@example.com"
113 export GIT_COMMITTER_NAME="RL CI"
114 git rebase upstream/main
115 - name: For each commit, run cargo check (including in fuzz)
116 run: ci/check-each-commit.sh upstream/main
119 runs-on: ubuntu-latest
123 - name: Checkout source code
124 uses: actions/checkout@v2
125 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
126 uses: actions-rs/toolchain@v1
128 toolchain: ${{ env.TOOLCHAIN }}
131 - name: Install dependencies for honggfuzz
134 sudo apt-get -y install build-essential binutils-dev libunwind-dev
135 - name: Sanity check fuzz targets on Rust ${{ env.TOOLCHAIN }}
136 run: cd fuzz && cargo test --verbose --color always
138 run: cd fuzz && ./ci-fuzz.sh
141 runs-on: ubuntu-latest
142 # Ubuntu's version of rustc uses its own LLVM instead of being a real native package.
143 # This leaves us with an incompatible LLVM version when linking. Instead, use a real OS.
144 # We further (temporarily) use Debian experimental since testing links rustc against the
145 # brand-new llvm-10, but clang/llvm still default to LLVM 9.
146 container: debian:experimental
150 - name: Install native Rust toolchain, Valgrind, and build utilitis
152 echo 'Package: llvm llvm-runtime clang lld' > /etc/apt/preferences.d/99-llvm10
153 echo 'Pin: release n=experimental' >> /etc/apt/preferences.d/99-llvm10
154 echo 'Pin-Priority: 995' >> /etc/apt/preferences.d/99-llvm10
156 apt-get -y dist-upgrade
157 apt-get -y install cargo valgrind lld git g++ clang
158 - name: Checkout source code
159 uses: actions/checkout@v2
160 - name: Sanity test bindings
161 working-directory: lightning-c-bindings
163 - name: Install cbindgen
164 run: cargo install --force cbindgen
165 - name: Rebuild bindings, and check the sample app builds + links
166 run: ./genbindings.sh
167 - name: Check that the latest bindings are in git
169 if [ "$(git diff)" != "" ]; then
170 # cbindgen's bindings output order can be FS-dependant, so check that the lines are all the same:
171 mv lightning-c-bindings/include/lightning.h lightning-c-bindings/include/lightning.h.new
172 git checkout lightning-c-bindings/include/lightning.h
173 cat lightning-c-bindings/include/lightning.h | grep -v "Generated with cbindgen:[0-9\.]*" | sort > lightning-c-bindings/include/lightning.h.sorted
174 cat lightning-c-bindings/include/lightning.h.new | grep -v "Generated with cbindgen:[0-9\.]*" | sort > lightning-c-bindings/include/lightning.h.new.sorted
175 diff lightning-c-bindings/include/lightning.h.sorted lightning-c-bindings/include/lightning.h.new.sorted
176 [ "$(diff lightning-c-bindings/include/lightning.h.sorted lightning-c-bindings/include/lightning.h.new.sorted)" != "" ] && exit 2
181 runs-on: ubuntu-latest
185 - name: Checkout source code
186 uses: actions/checkout@v2
187 - name: Install Rust ${{ env.TOOLCHAIN }} toolchain
188 uses: actions-rs/toolchain@v1
190 toolchain: ${{ env.TOOLCHAIN }}
193 - name: Install clippy
195 rustup component add clippy
196 - name: Run default clippy linting
198 cargo clippy -- -Aclippy::erasing_op -Aclippy::never_loop -Aclippy::if_same_then_else