Skip to content

Commit 788d6e2

Browse files
ben1009pingyu
andauthored
ci: upgrade action & use nextest instead of test for ut (#422)
* ci: upgrade action & use nextest instead of test Signed-off-by: ben1009 <liuhe1009@gmail.com> * fix DCO check Signed-off-by: ben1009 <liuhe1009@gmail.com> * back to use test in IT Signed-off-by: ben1009 <liuhe1009@gmail.com> * transaction: Support unsafe_destroy_range interface (#420) * add unsafe_destroy_range Signed-off-by: Ping Yu <yuping@pingcap.com> * polish Signed-off-by: Ping Yu <yuping@pingcap.com> * polish Signed-off-by: Ping Yu <yuping@pingcap.com> * fix compile error on lower version of rust Signed-off-by: Ping Yu <yuping@pingcap.com> --------- Signed-off-by: Ping Yu <yuping@pingcap.com> Signed-off-by: ben1009 <liuhe1009@gmail.com> * add install guid for nextest in readme Signed-off-by: ben1009 <liuhe1009@gmail.com> --------- Signed-off-by: ben1009 <liuhe1009@gmail.com> Signed-off-by: Ping Yu <yuping@pingcap.com> Co-authored-by: Ping Yu <yuping@pingcap.com>
1 parent d656079 commit 788d6e2

File tree

3 files changed

+23
-9
lines changed

3 files changed

+23
-9
lines changed

.github/workflows/ci.yml

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ on:
33
push:
44
branches:
55
- master
6+
concurrency:
7+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
8+
cancel-in-progress: true
9+
10+
env:
11+
CARGO_TERM_COLOR: always
612

713
name: CI
814

@@ -11,14 +17,14 @@ jobs:
1117
name: check
1218
runs-on: ubuntu-latest
1319
steps:
14-
- uses: actions/checkout@v2
20+
- uses: actions/checkout@v4
1521
- name: Install Protoc
1622
uses: arduino/setup-protoc@v1
1723
with:
1824
version: '3.x'
1925
repo-token: ${{ secrets.GITHUB_TOKEN }}
2026
- name: Rust Cache
21-
uses: Swatinem/rust-cache@v1.4.0
27+
uses: Swatinem/rust-cache@v2
2228
- name: make check
2329
run: make check
2430
- name: Catch unexpected changes in the generated code
@@ -31,14 +37,16 @@ jobs:
3137
CARGO_INCREMENTAL: 0
3238
runs-on: ubuntu-latest
3339
steps:
34-
- uses: actions/checkout@v2
40+
- uses: actions/checkout@v4
3541
- name: Install Protoc
3642
uses: arduino/setup-protoc@v1
3743
with:
3844
version: '3.x'
3945
repo-token: ${{ secrets.GITHUB_TOKEN }}
4046
- name: Rust Cache
41-
uses: Swatinem/rust-cache@v1.4.0
47+
uses: Swatinem/rust-cache@v2
48+
- name: Install latest nextest release
49+
uses: taiki-e/install-action@nextest
4250
- name: unit test
4351
run: make unit-test
4452

@@ -48,14 +56,14 @@ jobs:
4856
CARGO_INCREMENTAL: 0
4957
runs-on: ubuntu-latest
5058
steps:
51-
- uses: actions/checkout@v2
59+
- uses: actions/checkout@v4
5260
- name: Install Protoc
5361
uses: arduino/setup-protoc@v1
5462
with:
5563
version: '3.x'
5664
repo-token: ${{ secrets.GITHUB_TOKEN }}
5765
- name: Rust Cache
58-
uses: Swatinem/rust-cache@v1.4.0
66+
uses: Swatinem/rust-cache@v2
5967
- name: install tiup
6068
run: curl --proto '=https' --tlsv1.2 -sSf https://tiup-mirrors.pingcap.com/install.sh | sh
6169
- name: start tiup playground
@@ -68,5 +76,7 @@ jobs:
6876
[[ "$(curl -I http://127.0.0.1:2379/pd/api/v1/regions 2>/dev/null | head -n 1 | cut -d$' ' -f2)" -ne "405" ]] || break
6977
sleep 1
7078
done
79+
- name: Install latest nextest release
80+
uses: taiki-e/install-action@nextest
7181
- name: integration test
7282
run: MULTI_REGION=1 make integration-test

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ check: generate
2020
cargo clippy --all-targets --features "${ALL_FEATURES}" -- -D clippy::all
2121

2222
unit-test: generate
23-
cargo test --all --no-default-features
23+
cargo nextest run --all --no-default-features
2424

2525
integration-test: generate
2626
cargo test txn_ --all ${INTEGRATION_TEST_ARGS} -- --nocapture

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,11 @@ We welcome your contributions! Contributing code is great, we also appreciate fi
113113

114114
## Building and testing
115115

116-
We use the standard Cargo workflows, e.g., `cargo build` to build and `cargo test` to run unit tests. You will need to use a nightly Rust toolchain to build and run tests.
116+
We use the standard Cargo workflows, e.g., `cargo build` to build and `cargo test/nextest` to run unit tests. You will need to use a nightly Rust toolchain to build and run tests. Could use [nextest](https://nexte.st/index.html) to speed up ut, install nextest first.
117+
118+
```
119+
cargo install cargo-nextest --locked
120+
```
117121

118122
Running integration tests or manually testing the client with a TiKV cluster is a little bit more involved. The easiest way is to use [TiUp](https://github.com/pingcap/tiup) (>= 1.5) to initialise a cluster on your local machine:
119123

@@ -131,7 +135,7 @@ PD_ADDRS="127.0.0.1:2379" cargo test --package tikv-client --test integration_te
131135

132136
We use a standard GitHub PR workflow. We run CI on every PR and require all PRs to build without warnings (including clippy and Rustfmt warnings), pass tests, have a DCO sign-off (use `-s` when you commit, the DCO bot will guide you through completing the DCO agreement for your first PR), and have at least one review. If any of this is difficult for you, don't worry about it and ask on the PR.
133137

134-
To run CI-like tests locally, we recommend you run `cargo clippy`, `cargo test`, and `cargo fmt` before submitting your PR. See above for running integration tests, but you probably won't need to worry about this for your first few PRs.
138+
To run CI-like tests locally, we recommend you run `cargo clippy`, `cargo test/nextest run`, and `cargo fmt` before submitting your PR. See above for running integration tests, but you probably won't need to worry about this for your first few PRs.
135139

136140
Please follow PingCAP's [Rust style guide](https://pingcap.github.io/style-guide/rust/). All code PRs should include new tests or test cases.
137141

0 commit comments

Comments
 (0)