From 9ecb80e0e398b378208bb3bca3c1f5c06b1677f6 Mon Sep 17 00:00:00 2001 From: zqh Date: Thu, 21 Jul 2022 14:58:17 +0800 Subject: [PATCH 1/6] use nextest --- .github/workflows/test.yml | 10 ++++++++++ Makefile | 24 ++++++++++++------------ 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 903c59ec86..849b47ac42 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -74,6 +74,11 @@ jobs: components: rustfmt target: wasm32-unknown-unknown default: true + - name: Install cargo-nextest + uses: baptiste0928/cargo-install@v1 + with: + crate: cargo-nextest + locked: true - name: Run benchmarking tests run: make test-benchmarking checks-and-tests: @@ -94,6 +99,11 @@ jobs: components: rustfmt target: wasm32-unknown-unknown default: true + - name: Install cargo-nextest + uses: baptiste0928/cargo-install@v1 + with: + crate: cargo-nextest + locked: true - name: Run runtime tests run: make test-runtimes - name: Run eth tests diff --git a/Makefile b/Makefile index 7bb9ca751c..4f6ca3b8b9 100644 --- a/Makefile +++ b/Makefile @@ -126,28 +126,28 @@ try-runtime-acala: .PHONY: test test: githooks - SKIP_WASM_BUILD= cargo test --features with-mandala-runtime --all + SKIP_WASM_BUILD= cargo nextest run --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 nextest run -p runtime-common --features with-ethereum-compatibility schedule_call_precompile_should_work + SKIP_WASM_BUILD= cargo nextest run -p runtime-integration-tests --features with-mandala-runtime --features with-ethereum-compatibility should_not_kill_contract_on_transfer_all + SKIP_WASM_BUILD= cargo nextest run -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 --manifest-path evm-tests/jsontests/Cargo.toml + SKIP_WASM_BUILD= cargo nextest run --manifest-path evm-tests/jsontests/Cargo.toml .PHONY: test-runtimes test-runtimes: - SKIP_WASM_BUILD= cargo test --all --features with-all-runtime - SKIP_WASM_BUILD= cargo test -p runtime-integration-tests --features=with-mandala-runtime - SKIP_WASM_BUILD= cargo test -p runtime-integration-tests --features=with-karura-runtime - SKIP_WASM_BUILD= cargo test -p runtime-integration-tests --features=with-acala-runtime + SKIP_WASM_BUILD= cargo nextest run --all --features with-all-runtime + SKIP_WASM_BUILD= cargo nextest run -p runtime-integration-tests --features=with-mandala-runtime + SKIP_WASM_BUILD= cargo nextest run -p runtime-integration-tests --features=with-karura-runtime + SKIP_WASM_BUILD= cargo nextest run -p runtime-integration-tests --features=with-acala-runtime .PHONY: test-e2e test-e2e: - cargo test --release --package test-service -- --include-ignored --skip test_full_node_catching_up --skip simple_balances_test + cargo nextest run --release --package test-service -- --include-ignored --skip test_full_node_catching_up --skip simple_balances_test .PHONY: test-ts test-ts: build-mandala-internal-release @@ -155,8 +155,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 --features --all benchmarking + cargo nextest run --features bench --package module-evm --package runtime-common + cargo nextest run --features runtime-benchmarks --features with-all-runtime --features --all benchmarking .PHONY: test-all test-all: test-runtimes test-eth test-benchmarking From b9775c847e9283fd8f22f689a1113176d4fbffbe Mon Sep 17 00:00:00 2001 From: Ermal Kaleci Date: Fri, 18 Aug 2023 13:50:08 +0200 Subject: [PATCH 2/6] fix action --- .github/workflows/test.yml | 2 -- .github/workflows/test.yml.src | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9dd99d8d4e..de541e569c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -86,7 +86,6 @@ jobs: toolchain: nightly-2023-04-15 components: rustfmt target: wasm32-unknown-unknown - default: true - name: Install cargo-nextest uses: taiki-e/install-action@nextest - name: Setup cmake @@ -116,7 +115,6 @@ jobs: toolchain: nightly-2023-04-15 components: rustfmt target: wasm32-unknown-unknown - default: true - name: Install cargo-nextest uses: taiki-e/install-action@nextest - name: Setup cmake 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 From 32b35b6a48c192738ebf275ccb7f35c7d542cf1c Mon Sep 17 00:00:00 2001 From: Ermal Kaleci Date: Tue, 22 Aug 2023 14:04:34 +0200 Subject: [PATCH 3/6] use cargo-nextest if installed --- Makefile | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index 4eb69f0857..651a293d92 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,6 @@ +# use `cargo nextest run` if cargo-nextest is installed +cargo_test = SKIP_WASM_BUILD= $(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,28 +140,28 @@ try-runtime-acala: .PHONY: test test: githooks - SKIP_WASM_BUILD= cargo nextest run --features with-mandala-runtime --all + ${cargo_test} --features with-mandala-runtime --all .PHONY: test-eth test-eth: githooks test-evm - SKIP_WASM_BUILD= cargo nextest run -p runtime-common --features with-ethereum-compatibility schedule_call_precompile_should_work - SKIP_WASM_BUILD= cargo nextest run -p runtime-integration-tests --features with-mandala-runtime --features with-ethereum-compatibility should_not_kill_contract_on_transfer_all - SKIP_WASM_BUILD= cargo nextest run -p runtime-integration-tests --features with-mandala-runtime --features with-ethereum-compatibility schedule_call_precompile_should_handle_invalid_input + ${cargo_test} -p runtime-common --features with-ethereum-compatibility schedule_call_precompile_should_work + ${cargo_test} -p runtime-integration-tests --features with-mandala-runtime --features with-ethereum-compatibility should_not_kill_contract_on_transfer_all + ${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 nextest run --release -p evm-jsontests --features evm-tests + ${cargo_test} --release -p evm-jsontests --features evm-tests .PHONY: test-runtimes test-runtimes: - SKIP_WASM_BUILD= cargo nextest run --all --features with-all-runtime --lib - SKIP_WASM_BUILD= cargo nextest run -p runtime-integration-tests --features=with-mandala-runtime --lib - SKIP_WASM_BUILD= cargo nextest run -p runtime-integration-tests --features=with-karura-runtime --lib - SKIP_WASM_BUILD= cargo nextest run -p runtime-integration-tests --features=with-acala-runtime --lib + ${cargo_test} --all --features with-all-runtime --lib + ${cargo_test} -p runtime-integration-tests --features=with-mandala-runtime --lib + ${cargo_test} -p runtime-integration-tests --features=with-karura-runtime --lib + ${cargo_test} -p runtime-integration-tests --features=with-acala-runtime --lib .PHONY: test-e2e test-e2e: - cargo nextest run --release --package test-service -- --include-ignored --skip test_full_node_catching_up --skip simple_balances_test --test-threads=1 + ${cargo_test} --release --package test-service -- --include-ignored --skip test_full_node_catching_up --skip simple_balances_test --test-threads=1 .PHONY: test-ts test-ts: build-mandala-internal-release @@ -166,8 +169,8 @@ test-ts: build-mandala-internal-release .PHONY: test-benchmarking test-benchmarking: - cargo nextest run --features bench --package module-evm --package runtime-common - cargo nextest run --features runtime-benchmarks --features with-all-runtime --all benchmarking + ${cargo_test} --features bench --package module-evm --package runtime-common + ${cargo_test} --features runtime-benchmarks --features with-all-runtime --all benchmarking .PHONY: test-all test-all: test-runtimes test-eth test-benchmarking From aa65195666357354a71ab8232f7a1359f9b4d1ea Mon Sep 17 00:00:00 2001 From: Ermal Kaleci Date: Tue, 22 Aug 2023 14:29:08 +0200 Subject: [PATCH 4/6] fix cmd --- .github/workflows/benchmark.yml | 9 +++++++++ .github/workflows/test.yml | 4 ++++ .github/workflows/test.yml.src | 1 + Makefile | 20 ++++++++++---------- 4 files changed, 24 insertions(+), 10 deletions(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 1811f86374..62680a16d7 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -71,6 +71,15 @@ jobs: ` }) return data.data.id + - uses: actions/cache@v3 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ + 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 de541e569c..d5b3934172 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -40,6 +40,7 @@ jobs: ~/.cargo/registry/index/ ~/.cargo/registry/cache/ ~/.cargo/git/db/ + target/ key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - name: Install toolchain uses: dtolnay/rust-toolchain@nightly @@ -79,6 +80,7 @@ jobs: ~/.cargo/registry/index/ ~/.cargo/registry/cache/ ~/.cargo/git/db/ + target/ key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - name: Install toolchain uses: dtolnay/rust-toolchain@nightly @@ -108,6 +110,7 @@ jobs: ~/.cargo/registry/index/ ~/.cargo/registry/cache/ ~/.cargo/git/db/ + target/ key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - name: Install toolchain uses: dtolnay/rust-toolchain@nightly @@ -145,6 +148,7 @@ jobs: ~/.cargo/registry/index/ ~/.cargo/registry/cache/ ~/.cargo/git/db/ + target/ key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - name: Install toolchain uses: dtolnay/rust-toolchain@nightly diff --git a/.github/workflows/test.yml.src b/.github/workflows/test.yml.src index c6c4db47dc..2f310001ff 100644 --- a/.github/workflows/test.yml.src +++ b/.github/workflows/test.yml.src @@ -43,6 +43,7 @@ jobs: ~/.cargo/registry/index/ ~/.cargo/registry/cache/ ~/.cargo/git/db/ + target/ key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - &toolchain name: Install toolchain diff --git a/Makefile b/Makefile index 651a293d92..b1b610be84 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ # use `cargo nextest run` if cargo-nextest is installed -cargo_test = SKIP_WASM_BUILD= $(shell which cargo-nextest >/dev/null && echo "cargo nextest run" || echo "cargo test") +cargo_test = $(shell which cargo-nextest >/dev/null && echo "cargo nextest run" || echo "cargo test") .PHONY: run run: @@ -140,24 +140,24 @@ try-runtime-acala: .PHONY: test test: githooks - ${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 - ${cargo_test} -p runtime-common --features with-ethereum-compatibility schedule_call_precompile_should_work - ${cargo_test} -p runtime-integration-tests --features with-mandala-runtime --features with-ethereum-compatibility should_not_kill_contract_on_transfer_all - ${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 - ${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: - ${cargo_test} --all --features with-all-runtime --lib - ${cargo_test} -p runtime-integration-tests --features=with-mandala-runtime --lib - ${cargo_test} -p runtime-integration-tests --features=with-karura-runtime --lib - ${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: From 93c44aed2fe4e81a643dc9a502713aa5067f8bdf Mon Sep 17 00:00:00 2001 From: Ermal Kaleci Date: Tue, 22 Aug 2023 15:54:40 +0200 Subject: [PATCH 5/6] remove target from cache, too large, github action failing, limit 10GB --- .github/workflows/benchmark.yml | 1 - .github/workflows/test.yml | 4 ---- .github/workflows/test.yml.src | 1 - Makefile | 2 +- 4 files changed, 1 insertion(+), 7 deletions(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 62680a16d7..2922507ef4 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -78,7 +78,6 @@ jobs: ~/.cargo/registry/index/ ~/.cargo/registry/cache/ ~/.cargo/git/db/ - target/ key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - name: Install toolchain uses: actions-rs/toolchain@v1 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d5b3934172..de541e569c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -40,7 +40,6 @@ jobs: ~/.cargo/registry/index/ ~/.cargo/registry/cache/ ~/.cargo/git/db/ - target/ key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - name: Install toolchain uses: dtolnay/rust-toolchain@nightly @@ -80,7 +79,6 @@ jobs: ~/.cargo/registry/index/ ~/.cargo/registry/cache/ ~/.cargo/git/db/ - target/ key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - name: Install toolchain uses: dtolnay/rust-toolchain@nightly @@ -110,7 +108,6 @@ jobs: ~/.cargo/registry/index/ ~/.cargo/registry/cache/ ~/.cargo/git/db/ - target/ key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - name: Install toolchain uses: dtolnay/rust-toolchain@nightly @@ -148,7 +145,6 @@ jobs: ~/.cargo/registry/index/ ~/.cargo/registry/cache/ ~/.cargo/git/db/ - target/ key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - name: Install toolchain uses: dtolnay/rust-toolchain@nightly diff --git a/.github/workflows/test.yml.src b/.github/workflows/test.yml.src index 2f310001ff..c6c4db47dc 100644 --- a/.github/workflows/test.yml.src +++ b/.github/workflows/test.yml.src @@ -43,7 +43,6 @@ jobs: ~/.cargo/registry/index/ ~/.cargo/registry/cache/ ~/.cargo/git/db/ - target/ key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - &toolchain name: Install toolchain diff --git a/Makefile b/Makefile index b1b610be84..d87543ce61 100644 --- a/Makefile +++ b/Makefile @@ -161,7 +161,7 @@ test-runtimes: .PHONY: test-e2e test-e2e: - ${cargo_test} --release --package test-service -- --include-ignored --skip test_full_node_catching_up --skip simple_balances_test --test-threads=1 + cargo test --release --package test-service -- --include-ignored --skip test_full_node_catching_up --skip simple_balances_test --test-threads=1 .PHONY: test-ts test-ts: build-mandala-internal-release From 192e1688f84a7eed1faeed761390ddd90913978d Mon Sep 17 00:00:00 2001 From: Ermal Kaleci Date: Tue, 22 Aug 2023 16:12:48 +0200 Subject: [PATCH 6/6] fix --- Makefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index d87543ce61..c66381d359 100644 --- a/Makefile +++ b/Makefile @@ -161,6 +161,7 @@ test-runtimes: .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 @@ -169,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