Skip to content

Commit 355dbbc

Browse files
committed
Add CI using GitHub Action
Same setup than Travis except for removing `rm -f target/debug/lightning-*` as I do not believe such file would exist on a fresh run. I have not setup caching at this stage. The library is small so I don't think it'd be that necessary/helpful. I'd recommend to let both CI run for a bit to compare performance and stability. The CI setup is straightforward so I do not foresee any issue with GitHub actions. Once happy, Travis file can be removed and branch protection checks can be updated to block on the GitHub actions. You can also check the [Coverage report](https://codecov.io/gh/D4nte/rust-lightning/tree/752a58bc0441a49a0513f2cad979ad9e2621312a/lightning/src/chain) to ensure it is as expected.
1 parent e6e69f5 commit 355dbbc

File tree

1 file changed

+97
-0
lines changed

1 file changed

+97
-0
lines changed

.github/workflows/build.yml

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
name: Continuous Integration Checks
2+
3+
on:
4+
push:
5+
6+
jobs:
7+
build:
8+
strategy:
9+
matrix:
10+
toolchain: [ stable,
11+
beta,
12+
# 1.22.0 is MSRV for rust-lightning in general:
13+
1.22.0,
14+
# 1.34.2 is Debian stable
15+
1.34.2,
16+
# 1.39.0 is MSRV for lightning-net-tokio and generates coverage
17+
1.39.0]
18+
include:
19+
- toolchain: stable
20+
build-net-tokio: true
21+
- toolchain: beta
22+
build-net-tokio: true
23+
- toolchain: 1.39.0
24+
build-net-tokio: true
25+
coverage: true
26+
runs-on: ubuntu-latest
27+
steps:
28+
- name: Checkout source code
29+
uses: actions/checkout@v2
30+
- name: Install Rust ${{ matrix.toolchain }} toolchain
31+
uses: actions-rs/toolchain@v1
32+
with:
33+
toolchain: ${{ matrix.toolchain }}
34+
override: true
35+
profile: minimal
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
39+
- name: Build on Rust ${{ matrix.toolchain }}
40+
if: "! matrix.build-net-tokio"
41+
run: RUSTFLAGS="-C link-dead-code" cargo build --verbose -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
45+
- name: Test on Rust ${{ matrix.toolchain }}
46+
if: "! matrix.build-net-tokio"
47+
run: RUSTFLAGS="-C link-dead-code" cargo test --verbose -p lightning
48+
- name: Install deps for kcov
49+
if: matrix.coverage
50+
run: |
51+
sudo apt-get update
52+
sudo apt-get -y install binutils-dev libcurl4-openssl-dev zlib1g-dev libdw-dev libiberty-dev
53+
- name: Install kcov
54+
if: matrix.coverage
55+
run: |
56+
wget https://github.com/SimonKagstrom/kcov/archive/master.tar.gz
57+
tar xzf master.tar.gz
58+
cd kcov-master && mkdir build && cd build
59+
cmake ..
60+
make
61+
make install DESTDIR=../../kcov-build
62+
cd ../.. && rm -rf kcov-master master.tar.gz
63+
- name: Generate coverage report
64+
if: matrix.coverage
65+
run: |
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";
70+
done
71+
- name: Upload coverage
72+
if: matrix.coverage
73+
uses: codecov/codecov-action@v1
74+
with:
75+
fail_ci_if_error: true
76+
77+
fuzz:
78+
runs-on: ubuntu-latest
79+
env:
80+
TOOLCHAIN: stable
81+
steps:
82+
- name: Checkout source code
83+
uses: actions/checkout@v2
84+
- name: Install Rust ${{ env.TOOLCHAIN }} toolchain
85+
uses: actions-rs/toolchain@v1
86+
with:
87+
toolchain: ${{ env.TOOLCHAIN }}
88+
override: true
89+
profile: minimal
90+
- name: Install dependencies for honggfuzz
91+
run: |
92+
sudo apt-get update
93+
sudo apt-get -y install build-essential binutils-dev libunwind-dev
94+
- name: Fuzz test on Rust ${{ matrix.TOOLCHAIN }}
95+
run: cd fuzz && cargo test --verbose
96+
- name: Generate fuzz report
97+
run: cd fuzz && ./ci-fuzz.sh

0 commit comments

Comments
 (0)