Skip to content

Commit fa5fe6d

Browse files
authored
Merge pull request #276 from nervosnetwork/setup-github-action
ci: Setup GitHub action
2 parents 9cf837a + f47f0f0 commit fa5fe6d

File tree

4 files changed

+89
-0
lines changed

4 files changed

+89
-0
lines changed

.github/workflows/ci.yaml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: Github Action
2+
3+
on:
4+
pull_request: # trigger on pull requests
5+
push:
6+
branches:
7+
- master # trigger on push to master
8+
9+
jobs:
10+
test:
11+
name: Test
12+
runs-on: ${{ matrix.os }}
13+
strategy:
14+
matrix:
15+
build: [ linux, macos, windows ]
16+
include:
17+
- build: linux
18+
os: ubuntu-latest
19+
rust: 1.46.0
20+
- build: macos
21+
os: macos-latest
22+
rust: 1.46.0
23+
- build: windows
24+
os: windows-latest
25+
rust: 1.46.0
26+
steps:
27+
- uses: actions/checkout@v2
28+
- name: Build
29+
run: |
30+
make build
31+
make examples
32+
make bench_p2p
33+
- name: Run tests
34+
timeout-minutes: 40
35+
run: make test
36+
37+
rustfmt:
38+
name: Rustfmt
39+
runs-on: ubuntu-latest
40+
steps:
41+
- uses: actions/checkout@v2
42+
- name: Format check
43+
run: |
44+
rustup component add rustfmt
45+
make fmt
46+
47+
clippy_check:
48+
name: Clippy
49+
runs-on: ubuntu-latest
50+
steps:
51+
- uses: actions/checkout@v2
52+
- name: Clippy check
53+
run: |
54+
rustup component add clippy
55+
make clippy
56+
57+
features_check:
58+
name: Features check
59+
runs-on: ubuntu-latest
60+
steps:
61+
- uses: actions/checkout@v2
62+
- name: Features check
63+
run: |
64+
rustup target add wasm32-unknown-unknown
65+
make features-check
66+
67+
fuzz_test:
68+
name: Fuzz
69+
runs-on: ubuntu-latest
70+
steps:
71+
- uses: actions/checkout@v2
72+
- name: Fuzz test
73+
run: |
74+
rustup install nightly
75+
cargo +nightly install cargo-fuzz
76+
make fuzz

.travis.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ rust:
55
before_script:
66
- rustup component add rustfmt
77
- rustup component add clippy
8+
- rustup target add wasm32-unknown-unknown
89
stages:
910
- Build
1011
- Check
@@ -27,6 +28,10 @@ jobs:
2728
name: Unitest
2829
script:
2930
- make test
31+
- stage: Test
32+
name: Features check
33+
script:
34+
- make features-check
3035
- stage: Test
3136
name: Bench
3237
script:

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ features-check:
4848
$(Change_Work_Path) && cargo build --features molc,tokio-runtime,generic-timer --no-default-features
4949
$(Change_Work_Path) && cargo build --features molc,async-runtime,generic-timer --no-default-features
5050
$(Change_Work_Path) && cargo build --features molc,async-runtime,async-timer --no-default-features
51+
# required wasm32-unknown-unknown target
5152
$(Change_Work_Path) && cargo build --features molc,wasm-timer --no-default-features --target=wasm32-unknown-unknown
5253
git checkout .
5354

tentacle/tests/test_dial.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,10 +304,17 @@ fn test_dial_with_no_notify(secio: bool) {
304304
}
305305
std::thread::sleep(Duration::from_millis(300));
306306
}
307+
#[cfg(unix)]
307308
assert_eq!(
308309
check_dial_errors(error_receiver, Duration::from_secs(15), 10),
309310
10
310311
);
312+
// The default timeout mechanism is different
313+
#[cfg(windows)]
314+
assert_eq!(
315+
check_dial_errors(error_receiver, Duration::from_secs(15), 5),
316+
5
317+
);
311318
}
312319

313320
#[test]

0 commit comments

Comments
 (0)