From ff6cd48e7f0fae5eb5b532e149bb57cc96480c7f Mon Sep 17 00:00:00 2001 From: Qinqi Qu Date: Tue, 25 Apr 2023 11:18:02 +0800 Subject: [PATCH] action: replace cargo test with cargo nextest in CI 1. improve test speed and presents test results concisely. Signed-off-by: Qinqi Qu --- .github/workflows/smoke.yml | 10 ++++++---- Makefile | 7 ++++++- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/.github/workflows/smoke.yml b/.github/workflows/smoke.yml index e9d0aee6c4f..3da28b3fdee 100644 --- a/.github/workflows/smoke.yml +++ b/.github/workflows/smoke.yml @@ -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 @@ -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 @@ -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 diff --git a/Makefile b/Makefile index 2e37e561c05..f455a127d4e 100644 --- a/Makefile +++ b/Makefile @@ -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: