Speed up playwright runs by sharding using tenbin

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski
2025-01-09 13:26:43 +00:00
parent 9826a8851d
commit b394f5e186
4 changed files with 44 additions and 2 deletions

View File

@@ -164,13 +164,25 @@ jobs:
if: matrix.project == 'WebKit' && steps.playwright-cache.outputs.cache-hit == 'true'
run: yarn playwright install-deps webkit
# Restore test-results.json file, which records the execution time of each test file.
# splitTests function uses this file for sharding.
- name: Restore playwright-results.json
uses: actions/cache/restore@v4
with:
path: playwright-results.json
key: playwright-results-${{ github.ref_name }}
restore-keys: |
playwright-results-${{ github.base_ref }}
playwright-results-develop
# We skip tests tagged with @mergequeue when running on PRs, but run them in MQ and everywhere else
- name: Run Playwright tests
run: |
yarn playwright test \
--shard "${{ matrix.runner }}/${{ needs.build.outputs.num-runners }}" \
--project="${{ matrix.project }}" \
${{ (github.event_name == 'pull_request' && matrix.runAllTests == false ) && '--grep-invert @mergequeue' || '' }}
env:
SHARD: "${{ matrix.runner }}/${{ needs.build.outputs.num-runners }}"
- name: Upload blob report to GitHub Actions Artifacts
if: always()
@@ -212,10 +224,17 @@ jobs:
- name: Merge into HTML Report
if: inputs.skip != true
run: yarn playwright merge-reports --reporter=html,./playwright/flaky-reporter.ts,./playwright/stale-screenshot-reporter.ts ./all-blob-reports
run: yarn playwright merge-reports --reporter=html,json,./playwright/flaky-reporter.ts,./playwright/stale-screenshot-reporter.ts ./all-blob-reports
env:
# Only pass creds to the flaky-reporter on main branch runs
GITHUB_TOKEN: ${{ github.ref_name == 'develop' && secrets.ELEMENT_BOT_TOKEN || '' }}
PLAYWRIGHT_JSON_OUTPUT_NAME: playwright-results.json
- name: Cache playwright-results.json
uses: actions/cache/save@v4
with:
path: playwright-results.json
key: playwright-results-${{ github.ref_name }}
# Upload the HTML report even if one of our reporters fails, this can happen when stale screenshots are detected
- name: Upload HTML report