From f46830cc6bf45a40d1daf1e10c79e9a864a3e1fb Mon Sep 17 00:00:00 2001 From: zqhxuyuan Date: Wed, 23 Aug 2023 06:25:49 +0800 Subject: [PATCH] CI test use nextest (#2275) * use nextest * fix action * use cargo-nextest if installed * fix cmd * remove target from cache, too large, github action failing, limit 10GB * fix --------- Co-authored-by: Ermal Kaleci --- .github/workflows/benchmark.yml | 8 ++++++++ .github/workflows/test.yml | 4 ++++ .github/workflows/test.yml.src | 2 ++ Makefile | 26 +++++++++++++++----------- 4 files changed, 29 insertions(+), 11 deletions(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 1811f86374..2922507ef4 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -71,6 +71,14 @@ jobs: ` }) return data.data.id + - uses: actions/cache@v3 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - name: Install toolchain uses: actions-rs/toolchain@v1 with: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 18ddacb502..de541e569c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -86,6 +86,8 @@ jobs: toolchain: nightly-2023-04-15 components: rustfmt target: wasm32-unknown-unknown + - name: Install cargo-nextest + uses: taiki-e/install-action@nextest - name: Setup cmake uses: jwlawson/actions-setup-cmake@v1.13 - name: Run benchmarking tests @@ -113,6 +115,8 @@ jobs: toolchain: nightly-2023-04-15 components: rustfmt target: wasm32-unknown-unknown + - name: Install cargo-nextest + uses: taiki-e/install-action@nextest - name: Setup cmake uses: jwlawson/actions-setup-cmake@v1.13 - name: Run runtime tests diff --git a/.github/workflows/test.yml.src b/.github/workflows/test.yml.src index ee143c19c2..c6c4db47dc 100644 --- a/.github/workflows/test.yml.src +++ b/.github/workflows/test.yml.src @@ -51,6 +51,8 @@ jobs: toolchain: nightly-2023-04-15 components: rustfmt target: wasm32-unknown-unknown + - name: Install cargo-nextest + uses: taiki-e/install-action@nextest - name: Check format run: cargo fmt --all -- --check - name: Build diff --git a/Makefile b/Makefile index d5f089082b..c66381d359 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,6 @@ +# use `cargo nextest run` if cargo-nextest is installed +cargo_test = $(shell which cargo-nextest >/dev/null && echo "cargo nextest run" || echo "cargo test") + .PHONY: run run: cargo run --features with-mandala-runtime -- --dev -lruntime=debug --instant-sealing @@ -137,27 +140,28 @@ try-runtime-acala: .PHONY: test test: githooks - SKIP_WASM_BUILD= cargo test --features with-mandala-runtime --all + SKIP_WASM_BUILD= ${cargo_test} --features with-mandala-runtime --all .PHONY: test-eth test-eth: githooks test-evm - SKIP_WASM_BUILD= cargo test -p runtime-common --features with-ethereum-compatibility schedule_call_precompile_should_work - SKIP_WASM_BUILD= cargo test -p runtime-integration-tests --features with-mandala-runtime --features with-ethereum-compatibility should_not_kill_contract_on_transfer_all - SKIP_WASM_BUILD= cargo test -p runtime-integration-tests --features with-mandala-runtime --features with-ethereum-compatibility schedule_call_precompile_should_handle_invalid_input + SKIP_WASM_BUILD= ${cargo_test} -p runtime-common --features with-ethereum-compatibility schedule_call_precompile_should_work + SKIP_WASM_BUILD= ${cargo_test} -p runtime-integration-tests --features with-mandala-runtime --features with-ethereum-compatibility should_not_kill_contract_on_transfer_all + SKIP_WASM_BUILD= ${cargo_test} -p runtime-integration-tests --features with-mandala-runtime --features with-ethereum-compatibility schedule_call_precompile_should_handle_invalid_input .PHONY: test-evm test-evm: githooks - SKIP_WASM_BUILD= cargo test --release -p evm-jsontests --features evm-tests + SKIP_WASM_BUILD= ${cargo_test} --release -p evm-jsontests --features evm-tests .PHONY: test-runtimes test-runtimes: - SKIP_WASM_BUILD= cargo test --all --features with-all-runtime --lib - SKIP_WASM_BUILD= cargo test -p runtime-integration-tests --features=with-mandala-runtime --lib - SKIP_WASM_BUILD= cargo test -p runtime-integration-tests --features=with-karura-runtime --lib - SKIP_WASM_BUILD= cargo test -p runtime-integration-tests --features=with-acala-runtime --lib + SKIP_WASM_BUILD= ${cargo_test} --all --features with-all-runtime --lib + SKIP_WASM_BUILD= ${cargo_test} -p runtime-integration-tests --features=with-mandala-runtime --lib + SKIP_WASM_BUILD= ${cargo_test} -p runtime-integration-tests --features=with-karura-runtime --lib + SKIP_WASM_BUILD= ${cargo_test} -p runtime-integration-tests --features=with-acala-runtime --lib .PHONY: test-e2e test-e2e: + # TODO: use cargo-nextest cargo test --release --package test-service -- --include-ignored --skip test_full_node_catching_up --skip simple_balances_test --test-threads=1 .PHONY: test-ts @@ -166,8 +170,8 @@ test-ts: build-mandala-internal-release .PHONY: test-benchmarking test-benchmarking: - cargo test --features bench --package module-evm --package runtime-common - cargo test --features runtime-benchmarks --features with-all-runtime --all benchmarking + SKIP_WASM_BUILD= ${cargo_test} --features bench --package module-evm --package runtime-common + SKIP_WASM_BUILD= ${cargo_test} --features runtime-benchmarks --features with-all-runtime --all benchmarking .PHONY: test-all test-all: test-runtimes test-eth test-benchmarking