Skip to content

Commit

Permalink
CI test use nextest (#2275)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
zqhxuyuan and ermalkaleci authored Aug 22, 2023
1 parent a7e5aea commit f46830c
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 11 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected]
- name: Run benchmarking tests
Expand Down Expand Up @@ -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/[email protected]
- name: Run runtime tests
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/test.yml.src
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
26 changes: 15 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit f46830c

Please sign in to comment.