Skip to content

Commit f71f740

Browse files
committed
Use github actions for lint and unit test tasks
And simplify travis.yml
1 parent 67921a5 commit f71f740

File tree

4 files changed

+78
-39
lines changed

4 files changed

+78
-39
lines changed

.github/workflows/cargo-test.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
on: [push, pull_request]
2+
3+
name: Actions - cargo
4+
5+
jobs:
6+
clippy:
7+
name: clippy
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v1
11+
- uses: actions-rs/toolchain@v1
12+
with:
13+
toolchain: nightly-2019-05-17
14+
override: true
15+
- run: rustup component add clippy
16+
- run: cargo fetch --verbose
17+
- run: cargo clippy --all --all-targets -- -D warnings
18+
19+
rustfmt:
20+
name: rustfmt
21+
runs-on: ubuntu-latest
22+
steps:
23+
- uses: actions/checkout@v1
24+
- uses: actions-rs/toolchain@v1
25+
with:
26+
toolchain: nightly-2019-05-17
27+
override: true
28+
- run: rustup component add rustfmt
29+
- run: cargo fmt -- --check
30+
31+
build:
32+
name: unit test
33+
runs-on: ${{ matrix.os }}
34+
strategy:
35+
matrix:
36+
os: [macOS-latest, ubuntu-latest]
37+
steps:
38+
- uses: actions/checkout@v1
39+
- uses: actions-rs/toolchain@v1
40+
with:
41+
toolchain: 1.37.0
42+
override: true
43+
- run: cargo fetch --verbose
44+
- run: cargo build
45+
- run: cargo test --verbose --all
46+
env:
47+
RUST_BACKTRACE: 1

.github/workflows/yarn-lint.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
on: [push, pull_request]
2+
3+
name: Actions - yarn
4+
5+
jobs:
6+
lint:
7+
name: lint
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v1
11+
- uses: actions/setup-node@v1
12+
with:
13+
node-version: '10.x'
14+
- run: npm install yarn
15+
- working-directory: ./test
16+
run: yarn
17+
- working-directory: ./test
18+
run: yarn lint

.mergify.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ pull_request_rules:
44
- "#approved-reviews-by>=1"
55
- "#review-requested=0"
66
- "#changes-requested-reviews-by=0"
7+
- "status-success~=^Actions - "
78
- status-success=continuous-integration/travis-ci/pr
89
- base=master
910
- label!=do-not-merge

.travis.yml

Lines changed: 12 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -15,96 +15,69 @@ jobs:
1515
before_install:
1616
- SKIP=`.travis/check-mergify-merge` && if [[ "$SKIP" = "skip" ]]; then exit 0; fi
1717
- SKIP=`.travis/check-change '(^spec/|\.md$)'` && if [[ "$SKIP" = "skip" ]]; then exit 0; fi
18-
- SKIP=`.travis/check-change '^test/'` && if [[ "$SKIP" = "noskip" ]]; then RUN_UNIT_TEST=1; fi
1918
install:
2019
- nvm install 10
2120
- nvm use 10
2221
- npm install -g yarn
2322
before_script:
2423
- cargo fetch --verbose
24+
- cargo build
25+
- cd test && yarn
2526
script:
26-
- if [[ $RUN_UNIT_TEST ]]; then RUST_BACKTRACE=1 cargo test --verbose --all; fi
27-
- cargo build || exit 1
28-
- cd test && yarn || exit 1
29-
- INT_TEST_FLAG=true && yarn start-short
27+
- yarn start-short
3028
- yarn start-long
3129
after_failure:
32-
- test $INT_TEST_FLAG && ./upload_logs.sh
30+
- ./upload_logs.sh
3331
- os: linux
3432
name: linux
3533
before_install:
3634
- SKIP=`.travis/check-mergify-merge` && if [[ "$SKIP" = "skip" ]]; then exit 0; fi
3735
- SKIP=`.travis/check-change '^spec/|\.md$'` && if [[ "$SKIP" = "skip" ]]; then exit 0; fi
38-
- SKIP=`.travis/check-change '^test/'` && if [[ "$SKIP" = "noskip" ]]; then RUN_UNIT_TEST=1; fi
3936
install:
4037
- nvm install 10
4138
- nvm use 10
4239
- npm install -g yarn
4340
before_script:
4441
- cargo fetch --verbose
42+
- cargo build
43+
- cd test && yarn
4544
script:
46-
- if [[ $RUN_UNIT_TEST ]]; then RUST_BACKTRACE=1 cargo test --verbose --all; fi
47-
- cargo build || exit 1
48-
- cd test && yarn || exit 1
49-
- INT_TEST_FLAG=true && yarn start-short
45+
- yarn start-short
5046
- yarn start-long
5147
after_failure:
52-
- test $INT_TEST_FLAG && ./upload_logs.sh
48+
- ./upload_logs.sh
5349
- os: linux
5450
name: dynamic-validator-1
5551
before_install:
5652
- SKIP=`.travis/check-mergify-merge` && if [[ "$SKIP" = "skip" ]]; then exit 0; fi
5753
- SKIP=`.travis/check-change '^spec/|\.md$'` && if [[ "$SKIP" = "skip" ]]; then exit 0; fi
58-
- SKIP=`.travis/check-change '^test/'` && if [[ "$SKIP" = "noskip" ]]; then RUN_UNIT_TEST=1; fi
5954
install:
6055
- nvm install 10
6156
- nvm use 10
6257
- npm install -g yarn
6358
before_script:
6459
- cargo build --verbose
60+
- cd test && yarn
6561
script:
66-
- cd test && yarn || exit 1
6762
- yarn start-dyn-val-1
6863
after_failure:
69-
- test $INT_TEST_FLAG && ./upload_logs.sh
64+
- ./upload_logs.sh
7065
- os: linux
7166
name: dynamic-validator-2
7267
before_install:
7368
- SKIP=`.travis/check-mergify-merge` && if [[ "$SKIP" = "skip" ]]; then exit 0; fi
7469
- SKIP=`.travis/check-change '^spec/|\.md$'` && if [[ "$SKIP" = "skip" ]]; then exit 0; fi
75-
- SKIP=`.travis/check-change '^test/'` && if [[ "$SKIP" = "noskip" ]]; then RUN_UNIT_TEST=1; fi
7670
install:
7771
- nvm install 10
7872
- nvm use 10
7973
- npm install -g yarn
8074
before_script:
8175
- cargo build --verbose
76+
- cd test && yarn
8277
script:
83-
- cd test && yarn || exit 1
8478
- yarn start-dyn-val-2
8579
after_failure:
86-
- test $INT_TEST_FLAG && ./upload_logs.sh
87-
- os: linux
88-
name: static
89-
before_install:
90-
- SKIP=`.travis/check-mergify-merge` && if [[ "$SKIP" = "skip" ]]; then exit 0; fi
91-
- SKIP=`.travis/check-change '^spec/|\.md$'` && if [[ "$SKIP" = "skip" ]]; then exit 0; fi
92-
- SKIP=`.travis/check-change '^test/'` && if [[ "$SKIP" = "noskip" ]]; then CHECK_RUST=1; fi
93-
install:
94-
- if [[ $CHECK_RUST ]]; then
95-
rustup toolchain install nightly-2019-05-17 || exit 1;
96-
rustup component add rustfmt --toolchain nightly-2019-05-17 || exit 1;
97-
rustup component add clippy --toolchain nightly-2019-05-17 || exit 1;
98-
fi
99-
- nvm install 10
100-
- nvm use 10
101-
- npm install -g yarn
102-
script:
103-
- if [[ $CHECK_RUST ]]; then
104-
cargo +nightly-2019-05-17 fmt -- --check || FAILED=1;
105-
cargo +nightly-2019-05-17 clippy --all --all-targets -- -D warnings || FAILED=1;
106-
fi; test ! $FAILED
107-
- cd test && yarn && yarn lint
80+
- ./upload_logs.sh
10881
- stage: deploy
10982
name: deploy
11083
script: skip

0 commit comments

Comments
 (0)