Skip to content

Commit 1585e8d

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 1585e8d

File tree

1 file changed

+93
-0
lines changed

1 file changed

+93
-0
lines changed

.github/workflows/build.yml

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
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-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 }} != true
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 }} != true
47+
run: RUSTFLAGS="-C link-dead-code" cargo test --verbose -p lightning
48+
- name: Install deps for kcov
49+
if: ${{ matrix.coverage }}
50+
run: sudo apt install binutils-dev libcurl4-openssl-dev zlib1g-dev libdw-dev libiberty-dev
51+
- name: Install kcov
52+
if: ${{ matrix.coverage }}
53+
run: |
54+
wget https://github.com/SimonKagstrom/kcov/archive/master.tar.gz
55+
tar xzf master.tar.gz
56+
cd kcov-master && mkdir build && cd build
57+
cmake ..
58+
make
59+
make install DESTDIR=../../kcov-build
60+
cd ../.. && rm -rf kcov-master master.tar.gz
61+
- name: Generate coverage report
62+
if: ${{ matrix.coverage }}
63+
run: |
64+
for file in target/debug/lightning-*; do
65+
[ -x "${file}" ] || continue;
66+
mkdir -p "target/cov/$(basename $file)";
67+
./kcov-build/usr/local/bin/kcov --exclude-pattern=/.cargo,/usr/lib --verify "target/cov/$(basename $file)" "$file";
68+
done
69+
- name: Upload coverage
70+
if: ${{ matrix.coverage }}
71+
uses: codecov/codecov-action@v1
72+
with:
73+
fail_ci_if_error: true
74+
75+
fuzz:
76+
runs-on: ubuntu-latest
77+
env:
78+
TOOLCHAIN: stable
79+
steps:
80+
- name: Checkout source code
81+
uses: actions/checkout@v2
82+
- name: Install Rust ${{ env.TOOLCHAIN }} toolchain
83+
uses: actions-rs/toolchain@v1
84+
with:
85+
toolchain: ${{ env.TOOLCHAIN }}
86+
override: true
87+
profile: minimal
88+
- name: Install dependencies for honggfuzz
89+
run: sudo apt install build-essential binutils-dev libunwind-dev
90+
- name: Fuzz test on Rust ${{ matrix.TOOLCHAIN }}
91+
run: cd fuzz && cargo test --verbose
92+
- name: Generate fuzz report
93+
run: cd fuzz && ./ci-fuzz.sh

0 commit comments

Comments
 (0)