Browse Source

fix: Reduce playwright threads and increase shards, reduce retries to 1

pull/6491/head
Muhammed Mustafa 1 year ago committed by starbirdtech383
parent
commit
88dacb506f
  1. 25
      .github/workflows/ci-cd.yml
  2. 2
      .github/workflows/playwright-test-workflow.yml
  3. 7
      tests/playwright/package.json
  4. 2
      tests/playwright/playwright.config.ts

25
.github/workflows/ci-cd.yml

@ -119,11 +119,18 @@ jobs:
shard: 2 shard: 2
playwright-mysql-3: playwright-mysql-3:
needs: pre-build-for-playwright 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 uses: ./.github/workflows/playwright-test-workflow.yml
with: with:
db: mysql db: mysql
shard: 3 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: playwright-sqlite-1:
needs: pre-build-for-playwright needs: pre-build-for-playwright
if: ${{ 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 }}
@ -145,6 +152,13 @@ jobs:
with: with:
db: sqlite 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: playwright-pg-shard-1:
needs: pre-build-for-playwright needs: pre-build-for-playwright
if: ${{ 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 }}
@ -161,8 +175,15 @@ jobs:
shard: 2 shard: 2
playwright-pg-shard-3: playwright-pg-shard-3:
needs: pre-build-for-playwright 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 uses: ./.github/workflows/playwright-test-workflow.yml
with: with:
db: pg db: pg
shard: 3 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: 4

2
.github/workflows/playwright-test-workflow.yml

@ -29,7 +29,7 @@ jobs:
- name: Get pnpm store directory - name: Get pnpm store directory
shell: bash shell: bash
run: | 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 - name: check if npm cache is needed
shell: bash shell: bash
run: | run: |

7
tests/playwright/package.json

@ -30,9 +30,10 @@
"test:debug:watch": "pnpm dlx nodemon -e ts -w ./ -x \"pnpm run test:debug\"", "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", "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": "pnpm exec playwright test --workers=2",
"ci:test:shard:1": "pnpm exec playwright test --workers=4 --shard=1/3", "ci:test:shard:1": "pnpm exec playwright test --workers=2 --shard=1/4",
"ci:test:shard:2": "pnpm exec playwright test --workers=4 --shard=2/3", "ci:test:shard:2": "pnpm exec playwright test --workers=2 --shard=2/4",
"ci:test:shard:3": "pnpm exec playwright test --workers=4 --shard=3/3", "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:mysql": "E2E_DB_TYPE=mysql pnpm exec playwright test --workers=2",
"ci:test:pg": "E2E_DB_TYPE=pg pnpm exec playwright test --workers=2", "ci:test:pg": "E2E_DB_TYPE=pg pnpm exec playwright test --workers=2",
"preinstall": "npx only-allow pnpm" "preinstall": "npx only-allow pnpm"

2
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. */ /* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly: !!process.env.CI, forbidOnly: !!process.env.CI,
/* Retry on CI only */ /* Retry on CI only */
retries: process.env.CI ? 3 : 0, retries: process.env.CI ? 1 : 0,
/* Opt out of parallel tests on CI. */ /* Opt out of parallel tests on CI. */
// workers: process.env.CI ? 2 : 4, // workers: process.env.CI ? 2 : 4,
workers: process.env.CI ? 2 : 4, workers: process.env.CI ? 2 : 4,

Loading…
Cancel
Save