From dc721503e40523ccaf2d6aab3b4d7e2d744cf1ee Mon Sep 17 00:00:00 2001 From: Ermal Kaleci Date: Thu, 16 May 2024 10:21:21 +0200 Subject: [PATCH] update tests to use cargo-nextest if present (#1243) --- .github/workflows/release.yml | 5 ++++- .github/workflows/tests.yaml | 9 ++++++--- Makefile | 20 +++++++++++++++++--- 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2d7a8a540a..751344b346 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -33,11 +33,14 @@ jobs: - name: Check targets are installed correctly run: rustup target list --installed + - name: Install cargo-nextest + run: curl -LsSf https://get.nexte.st/latest/linux | tar zxf - -C ${CARGO_HOME:-~/.cargo}/bin + - name: Check all features compilation run: cargo check --verbose --features try-runtime,runtime-benchmarks --locked - name: Run all tests - run: cargo test --features try-runtime,runtime-benchmarks --locked + run: make test-all native-linux: needs: checks-and-tests diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 6884a0de5d..708c6d1ea9 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -11,7 +11,7 @@ concurrency: cancel-in-progress: ${{ github.ref != 'refs/heads/master' }} jobs: - test-runtimes: + tests: runs-on: [self-hosted, Linux, X64] steps: - name: Checkout the source code @@ -26,5 +26,8 @@ jobs: - name: Check targets are installed correctly run: rustup target list --installed - - name: Runtime integration tests - run: make test-runtimes + - name: Install cargo-nextest + run: curl -LsSf https://get.nexte.st/latest/linux | tar zxf - -C ${CARGO_HOME:-~/.cargo}/bin + + - name: Run all tests + run: make test-all diff --git a/Makefile b/Makefile index 19c89747e5..b636a907f1 100644 --- a/Makefile +++ b/Makefile @@ -3,8 +3,22 @@ runtime-upgrade-test: cargo build -p $(runtime)-runtime --release --locked cd tests/e2e && yarn --frozen-lockfile && yarn test:runtime-upgrade-$(runtime) +# use `cargo nextest run` if cargo-nextest is installed, fallback cargo test +cargo_test = $(shell which cargo-nextest >/dev/null && echo "cargo nextest run" || echo "cargo test") + +.PHONY: test +test: + ${cargo_test} --workspace + +.PHONY: test-features +test-features: + ${cargo_test} --workspace --features try-runtime,runtime-benchmarks,evm-tracing + .PHONY: test-runtimes test-runtimes: - SKIP_WASM_BUILD= cargo test -p integration-tests --features=shibuya - SKIP_WASM_BUILD= cargo test -p integration-tests --features=shiden - SKIP_WASM_BUILD= cargo test -p integration-tests --features=astar + SKIP_WASM_BUILD= ${cargo_test} -p integration-tests --features=shibuya + SKIP_WASM_BUILD= ${cargo_test} -p integration-tests --features=shiden + SKIP_WASM_BUILD= ${cargo_test} -p integration-tests --features=astar + +.PHONY: test-all +test-all: test test-runtimes test-features