Skip to content

Commit

Permalink
update tests to use cargo-nextest if present (#1243)
Browse files Browse the repository at this point in the history
  • Loading branch information
ermalkaleci committed May 16, 2024
1 parent d0aa30b commit dc72150
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 7 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 6 additions & 3 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
20 changes: 17 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit dc72150

Please sign in to comment.