From 88dacb506f7599bf0bdc3d011ec09bef90c34140 Mon Sep 17 00:00:00 2001 From: Muhammed Mustafa Date: Tue, 26 Sep 2023 17:54:09 +0530 Subject: [PATCH] fix: Reduce playwright threads and increase shards, reduce retries to 1 --- .github/workflows/ci-cd.yml | 29 ++++++++++++++++--- .../workflows/playwright-test-workflow.yml | 2 +- tests/playwright/package.json | 7 +++-- tests/playwright/playwright.config.ts | 2 +- 4 files changed, 31 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index 584eb1e37d..fcf267fdef 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -119,11 +119,18 @@ jobs: shard: 2 playwright-mysql-3: needs: pre-build-for-playwright - if: ${{ always() && ( github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'trigger-CI') || !github.event.pull_request.draft )}} + if: ${{ github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'trigger-CI') || !github.event.pull_request.draft }} uses: ./.github/workflows/playwright-test-workflow.yml with: db: mysql shard: 3 + playwright-mysql-4: + needs: pre-build-for-playwright + if: ${{ github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'trigger-CI') || !github.event.pull_request.draft }} + uses: ./.github/workflows/playwright-test-workflow.yml + with: + db: mysql + shard: 4 playwright-sqlite-1: needs: pre-build-for-playwright if: ${{ github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'trigger-CI') || !github.event.pull_request.draft }} @@ -144,7 +151,14 @@ jobs: uses: ./.github/workflows/playwright-test-workflow.yml with: db: sqlite - shard: 3 + shard: 3 + playwright-sqlite-4: + needs: pre-build-for-playwright + if: ${{ github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'trigger-CI') || !github.event.pull_request.draft }} + uses: ./.github/workflows/playwright-test-workflow.yml + with: + db: sqlite + shard: 4 playwright-pg-shard-1: needs: pre-build-for-playwright if: ${{ github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'trigger-CI') || !github.event.pull_request.draft }} @@ -161,8 +175,15 @@ jobs: shard: 2 playwright-pg-shard-3: needs: pre-build-for-playwright - if: ${{ always() && ( github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'trigger-CI') || !github.event.pull_request.draft )}} + if: ${{ github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'trigger-CI') || !github.event.pull_request.draft }} + uses: ./.github/workflows/playwright-test-workflow.yml + with: + db: pg + shard: 3 + playwright-pg-shard-4: + needs: pre-build-for-playwright + if: ${{ github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'trigger-CI') || !github.event.pull_request.draft }} uses: ./.github/workflows/playwright-test-workflow.yml with: db: pg - shard: 3 \ No newline at end of file + shard: 4 \ No newline at end of file diff --git a/.github/workflows/playwright-test-workflow.yml b/.github/workflows/playwright-test-workflow.yml index 6c9e95acef..fe13cc0711 100644 --- a/.github/workflows/playwright-test-workflow.yml +++ b/.github/workflows/playwright-test-workflow.yml @@ -29,7 +29,7 @@ jobs: - name: Get pnpm store directory shell: bash run: | - echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV + echo "STORE_PATH=/root/setup-pnpm/node_modules/.bin/store/v3" >> $GITHUB_ENV - name: check if npm cache is needed shell: bash run: | diff --git a/tests/playwright/package.json b/tests/playwright/package.json index 27d07c54be..d17657e6b6 100644 --- a/tests/playwright/package.json +++ b/tests/playwright/package.json @@ -30,9 +30,10 @@ "test:debug:watch": "pnpm dlx nodemon -e ts -w ./ -x \"pnpm run test:debug\"", "test:debug:quick:sqlite": "./startPlayWrightServer.sh; PW_QUICK_TEST=1 PW_TEST_REUSE_CONTEXT=1 PW_TEST_CONNECT_WS_ENDPOINT=ws://127.0.0.1:31000/ PWDEBUG=console pnpm exec playwright test -c playwright.config.ts --headed --project=chromium --retries 0 --timeout 5 --workers 1 --max-failures=1", "ci:test": "pnpm exec playwright test --workers=2", - "ci:test:shard:1": "pnpm exec playwright test --workers=4 --shard=1/3", - "ci:test:shard:2": "pnpm exec playwright test --workers=4 --shard=2/3", - "ci:test:shard:3": "pnpm exec playwright test --workers=4 --shard=3/3", + "ci:test:shard:1": "pnpm exec playwright test --workers=2 --shard=1/4", + "ci:test:shard:2": "pnpm exec playwright test --workers=2 --shard=2/4", + "ci:test:shard:3": "pnpm exec playwright test --workers=2 --shard=3/4", + "ci:test:shard:4": "pnpm exec playwright test --workers=2 --shard=4/4", "ci:test:mysql": "E2E_DB_TYPE=mysql pnpm exec playwright test --workers=2", "ci:test:pg": "E2E_DB_TYPE=pg pnpm exec playwright test --workers=2", "preinstall": "npx only-allow pnpm" diff --git a/tests/playwright/playwright.config.ts b/tests/playwright/playwright.config.ts index 8f7359dca8..34f4409af3 100644 --- a/tests/playwright/playwright.config.ts +++ b/tests/playwright/playwright.config.ts @@ -27,7 +27,7 @@ export default defineConfig({ /* Fail the build on CI if you accidentally left test.only in the source code. */ forbidOnly: !!process.env.CI, /* Retry on CI only */ - retries: process.env.CI ? 3 : 0, + retries: process.env.CI ? 1 : 0, /* Opt out of parallel tests on CI. */ // workers: process.env.CI ? 2 : 4, workers: process.env.CI ? 2 : 4,