Skip to content

Commit

Permalink
action: replace cargo test with cargo nextest in CI
Browse files Browse the repository at this point in the history
1. improve test speed and presents test results concisely.

Signed-off-by: Qinqi Qu <[email protected]>
  • Loading branch information
adamqqqplay committed Apr 25, 2023
1 parent 7edea8a commit ff6cd48
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/smoke.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v3
- name: Rust Cache
uses: Swatinem/rust-cache@v2.2.0
uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- name: Build Nydus
Expand Down Expand Up @@ -600,12 +600,14 @@ jobs:
- name: Checkout
uses: actions/checkout@v3
- name: Rust Cache
uses: Swatinem/rust-cache@v2.2.0
uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- name: Install cargo nextest
uses: taiki-e/install-action@nextest
- name: Unit Test
run: |
make ut
make ut-nextest
nydus-unit-test-coverage:
runs-on: ubuntu-latest
Expand All @@ -614,7 +616,7 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Rust Cache
uses: Swatinem/rust-cache@v2.2.0
uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- name: Install cargo-llvm-cov
Expand Down
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,13 @@ install: release
@sudo install -m 755 target/release/nydus-image $(INSTALL_DIR_PREFIX)/nydus-image
@sudo install -m 755 target/release/nydusctl $(INSTALL_DIR_PREFIX)/nydusctl

# unit test
ut: .release_version
TEST_WORKDIR_PREFIX=$(TEST_WORKDIR_PREFIX) RUST_BACKTRACE=1 ${CARGO} test --workspace $(EXCLUDE_PACKAGES) $(CARGO_COMMON) $(CARGO_BUILD_FLAGS) -- --skip integration --nocapture --test-threads=8
TEST_WORKDIR_PREFIX=$(TEST_WORKDIR_PREFIX) RUST_BACKTRACE=1 ${CARGO} test --no-fail-fast --workspace $(EXCLUDE_PACKAGES) $(CARGO_COMMON) $(CARGO_BUILD_FLAGS) -- --skip integration --nocapture --test-threads=8

# you need install cargo nextest first from: https://nexte.st/book/pre-built-binaries.html
ut-nextest: .release_version
TEST_WORKDIR_PREFIX=$(TEST_WORKDIR_PREFIX) RUST_BACKTRACE=1 ${CARGO} nextest run --no-fail-fast --filter-expr 'test(test) - test(integration)' --workspace $(EXCLUDE_PACKAGES) $(CARGO_COMMON) $(CARGO_BUILD_FLAGS) --test-threads 8

# install test dependencies
pre-coverage:
Expand Down

0 comments on commit ff6cd48

Please sign in to comment.