Skip to content

Commit 86a2607

Browse files
authored
Merge pull request #601 from D4nte/ci-in-github-action
Add GitHub Action to build the project
2 parents 5b24d3e + 06419a2 commit 86a2607

File tree

3 files changed

+98
-1
lines changed

3 files changed

+98
-1
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 --color always
39+
- name: Build on Rust ${{ matrix.toolchain }}
40+
if: "! matrix.build-net-tokio"
41+
run: RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always -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 --color always
45+
- name: Test on Rust ${{ matrix.toolchain }}
46+
if: "! matrix.build-net-tokio"
47+
run: RUSTFLAGS="-C link-dead-code" cargo test --verbose --color always -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 --color always
96+
- name: Generate fuzz report
97+
run: cd fuzz && ./ci-fuzz.sh

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ script:
2626
- if [ "$BUILD_NET_TOKIO" == "1" ]; then RUSTFLAGS="-C link-dead-code" cargo test --verbose; fi
2727
- if [ "$BUILD_NET_TOKIO" != "1" ]; then RUSTFLAGS="-C link-dead-code" cargo test --verbose -p lightning; fi
2828
# Run lightning workspace fuzz tests on Rust stable
29-
- if [ "$(rustup show | grep default | grep stable)" != "" ]; then cd fuzz && cargo test --verbose && ./travis-fuzz.sh; fi
29+
- if [ "$(rustup show | grep default | grep stable)" != "" ]; then cd fuzz && cargo test --verbose && ./ci-fuzz.sh; fi
3030
# Generate code cov information on Rust 1.39.0
3131
- if [ "$(rustup show | grep default | grep 1.39.0)" != "" ]; then
3232
wget https://github.com/SimonKagstrom/kcov/archive/master.tar.gz &&
File renamed without changes.

0 commit comments

Comments
 (0)