From 1c1776922355d2317fd14ae9f6ba31619a804b4c Mon Sep 17 00:00:00 2001 From: zjb0807 Date: Thu, 28 Oct 2021 05:27:19 +0800 Subject: [PATCH] Improve workflow (#1539) * improve workflow * run benchmarking separately * increase the timeout --- .github/workflows/test.yml | 140 +++++++++++++++++++++++---------- .github/workflows/test.yml.src | 94 ++++++++++++++++++++++ ts-tests/tests/test-nonce.ts | 2 +- 3 files changed, 192 insertions(+), 44 deletions(-) create mode 100644 .github/workflows/test.yml.src diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3935a4497e..d8ab29d5e6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,5 +1,6 @@ +# generate by yq eval 'explode(.)' test.yml.src > test.yml +# https://github.com/mikefarah/yq name: Test - on: pull_request: branches: @@ -13,7 +14,6 @@ on: - release-** paths-ignore: - '**/README.md' - jobs: clean-up-actions: runs-on: ubuntu-latest @@ -24,6 +24,56 @@ jobs: uses: styfle/cancel-workflow-action@0.9.0 with: access_token: ${{ github.token }} + build: + runs-on: [self-hosted, linux] + env: + SCCACHE_CACHE_SIZE: "50G" + CARGO_INCREMENTAL: 0 + needs: clean-up-actions + steps: + - uses: actions/checkout@v2 + with: + submodules: recursive + - name: Install toolchain + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: nightly-2021-06-17 + components: rustfmt + target: wasm32-unknown-unknown + default: true + - name: Check format + run: cargo fmt --all -- --check + - name: Build + run: make build-all + - name: Install clippy + run: rustup component add clippy + - name: Run mandala-runtime clippy + run: cargo clippy --features with-mandala-runtime -- -D warnings + - name: Run karura-runtime clippy + run: cargo clippy --features with-karura-runtime -- -D warnings + - name: Run acala-runtime clippy + run: cargo clippy --features with-acala-runtime -- -D warnings + benchmarking: + runs-on: [self-hosted, linux] + env: + SCCACHE_CACHE_SIZE: "50G" + CARGO_INCREMENTAL: 0 + needs: clean-up-actions + steps: + - uses: actions/checkout@v2 + with: + submodules: recursive + - name: Install toolchain + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: nightly-2021-06-17 + components: rustfmt + target: wasm32-unknown-unknown + default: true + - name: Run benchmarking tests + run: make test-benchmarking checks-and-tests: runs-on: [self-hosted, linux] env: @@ -31,44 +81,48 @@ jobs: CARGO_INCREMENTAL: 0 needs: clean-up-actions steps: - - uses: actions/checkout@v2 - with: - submodules: recursive - - name: Install toolchain - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: nightly-2021-06-17 - components: rustfmt - target: wasm32-unknown-unknown - default: true - - name: Check format - run: cargo fmt --all -- --check - - name: Build - run: make build-all - - name: Install clippy - run: rustup component add clippy - - name: Run mandala-runtime clippy - run: cargo clippy --features with-mandala-runtime -- -D warnings - - name: Run karura-runtime clippy - run: cargo clippy --features with-karura-runtime -- -D warnings - - name: Run acala-runtime clippy - run: cargo clippy --features with-acala-runtime -- -D warnings - - name: Run runtime tests - run: make test-runtimes - - name: Run eth tests - run: make test-eth - - name: Run benchmarking tests - run: make test-benchmarking - - name: Check benchmarks - run: make check-benchmarks - - name: Check try-runtime - run: make check-try-runtime - - name: Use Node.js - uses: actions/setup-node@v2 - with: - node-version: 14.x - - name: Run ts tests - run: | - npm install -g yarn - make test-ts + - uses: actions/checkout@v2 + with: + submodules: recursive + - name: Install toolchain + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: nightly-2021-06-17 + components: rustfmt + target: wasm32-unknown-unknown + default: true + - name: Run runtime tests + run: make test-runtimes + - name: Run eth tests + run: make test-eth + - name: Check benchmarks + run: make check-benchmarks + - name: Check try-runtime + run: make check-try-runtime + e2e-tests: + runs-on: [self-hosted, linux] + env: + SCCACHE_CACHE_SIZE: "50G" + CARGO_INCREMENTAL: 0 + needs: clean-up-actions + steps: + - uses: actions/checkout@v2 + with: + submodules: recursive + - name: Install toolchain + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: nightly-2021-06-17 + components: rustfmt + target: wasm32-unknown-unknown + default: true + - name: Use Node.js + uses: actions/setup-node@v2 + with: + node-version: 14.x + - name: Run ts tests + run: | + npm install -g yarn + make test-ts diff --git a/.github/workflows/test.yml.src b/.github/workflows/test.yml.src new file mode 100644 index 0000000000..16e0a88796 --- /dev/null +++ b/.github/workflows/test.yml.src @@ -0,0 +1,94 @@ +# generate by yq eval 'explode(.)' test.yml.src > test.yml +# https://github.com/mikefarah/yq + +name: Test +on: + pull_request: + branches: + - master + - release-** + paths-ignore: + - '**/README.md' + push: + branches: + - master + - release-** + paths-ignore: + - '**/README.md' +jobs: + clean-up-actions: + runs-on: ubuntu-latest + steps: + - name: Cancel Previous Runs + # Only cancel non-master branch runs + if: ${{ github.ref != 'refs/heads/master' }} + uses: styfle/cancel-workflow-action@0.9.0 + with: + access_token: ${{ github.token }} + build: &setup + runs-on: + [self-hosted, linux] + env: + SCCACHE_CACHE_SIZE: "50G" + CARGO_INCREMENTAL: 0 + needs: clean-up-actions + steps: + - &checkout + uses: actions/checkout@v2 + with: + submodules: recursive + - &toolchain + name: Install toolchain + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: nightly-2021-06-17 + components: rustfmt + target: wasm32-unknown-unknown + default: true + - name: Check format + run: cargo fmt --all -- --check + - name: Build + run: make build-all + - name: Install clippy + run: rustup component add clippy + - name: Run mandala-runtime clippy + run: cargo clippy --features with-mandala-runtime -- -D warnings + - name: Run karura-runtime clippy + run: cargo clippy --features with-karura-runtime -- -D warnings + - name: Run acala-runtime clippy + run: cargo clippy --features with-acala-runtime -- -D warnings + benchmarking: + <<: *setup + steps: + - *checkout + - *toolchain + - name: Run benchmarking tests + run: make test-benchmarking + checks-and-tests: + <<: *setup + steps: + - *checkout + - *toolchain + - name: Run runtime tests + run: make test-runtimes + - name: Run eth tests + run: make test-eth + + - name: Check benchmarks + run: make check-benchmarks + - name: Check try-runtime + run: make check-try-runtime + e2e-tests: + <<: *setup + steps: + - *checkout + - *toolchain + - name: Use Node.js + uses: actions/setup-node@v2 + with: + node-version: 14.x + - name: Run ts tests + run: | + npm install -g yarn + make test-ts diff --git a/ts-tests/tests/test-nonce.ts b/ts-tests/tests/test-nonce.ts index f97c0ab930..a7bc8a55fb 100644 --- a/ts-tests/tests/test-nonce.ts +++ b/ts-tests/tests/test-nonce.ts @@ -8,7 +8,7 @@ import Erc20DemoContract from "../build/Erc20DemoContract.json" describeWithAcala("Acala RPC (Nonce)", (context) => { step("get nonce", async function () { - this.timeout(10_000); + this.timeout(20000); const [alice, alice_stash] = await context.provider.getWallets(); expect(await context.provider.getTransactionCount(await alice.getAddress(), 'earliest')).to.eq(0);