From 5bd2302cb14112d3a71ee16c047d9e05b07f7c3b Mon Sep 17 00:00:00 2001 From: Paul Balaji <10051819+paulbalaji@users.noreply.github.com> Date: Tue, 19 Nov 2024 17:43:49 +0000 Subject: [PATCH] chore: parallelise cli e2e tests (#4873) ### Description chore: parallelise cli e2e tests before: ![image](https://github.com/user-attachments/assets/66914b6d-7d64-4689-a5c7-032d34963a7f) after: ![image](https://github.com/user-attachments/assets/d35c91bb-98a3-40be-8432-1a2848394428) ### Drive-by changes ### Related issues ### Backward compatibility ### Testing --- .github/workflows/test.yml | 26 ++++++++++++++++++++++++-- typescript/cli/.mocharc-e2e.json | 1 - typescript/cli/scripts/run-e2e-test.sh | 7 ++++++- 3 files changed, 30 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b780d6585..52410ecd6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -109,9 +109,18 @@ jobs: - name: Unit Tests run: yarn test:ci - cli-e2e: + cli-e2e-matrix: runs-on: ubuntu-latest needs: [yarn-install] + strategy: + fail-fast: false + matrix: + test: + - core + - relay + - warp-read + - warp-apply + - warp-deploy steps: - uses: actions/checkout@v4 with: @@ -130,8 +139,21 @@ jobs: - name: Checkout registry uses: ./.github/actions/checkout-registry - - name: CLI e2e tests + - name: CLI e2e tests (${{ matrix.test }}) run: yarn --cwd typescript/cli test:e2e + env: + CLI_E2E_TEST: ${{ matrix.test }} + + cli-e2e: + runs-on: ubuntu-latest + needs: cli-e2e-matrix + if: always() + steps: + - name: Check cli-e2e matrix status + if: ${{ needs.cli-e2e-matrix.result != 'success' }} + run: | + echo "CLI E2E tests failed" + exit 1 agent-configs: runs-on: ubuntu-latest diff --git a/typescript/cli/.mocharc-e2e.json b/typescript/cli/.mocharc-e2e.json index ecabac62f..0f8803e7a 100644 --- a/typescript/cli/.mocharc-e2e.json +++ b/typescript/cli/.mocharc-e2e.json @@ -1,6 +1,5 @@ { "extensions": ["ts"], - "spec": ["src/**/*.e2e-test.ts"], "node-option": [ "experimental-specifier-resolution=node", "loader=ts-node/esm" diff --git a/typescript/cli/scripts/run-e2e-test.sh b/typescript/cli/scripts/run-e2e-test.sh index bfa89a0b3..c98fc9158 100755 --- a/typescript/cli/scripts/run-e2e-test.sh +++ b/typescript/cli/scripts/run-e2e-test.sh @@ -16,7 +16,12 @@ anvil --chain-id 31338 -p 8555 --state /tmp/anvil2/state --gas-price 1 > /dev/nu anvil --chain-id 31347 -p 8600 --state /tmp/anvil3/state --gas-price 1 > /dev/null & echo "Running E2E tests" -yarn mocha --config .mocharc-e2e.json +if [ -n "${CLI_E2E_TEST}" ]; then + echo "Running only ${CLI_E2E_TEST} test" + yarn mocha --config .mocharc-e2e.json "src/**/${CLI_E2E_TEST}.e2e-test.ts" +else + yarn mocha --config .mocharc-e2e.json "src/**/*.e2e-test.ts" +fi cleanup