Skip to content

Conversation

@snomiao
Copy link
Member

@snomiao snomiao commented Sep 2, 2025

Summary

  • Split Playwright tests into 5 shards to reduce CI runtime from 17min to ~3-4min
  • Each browser now runs tests in 5 parallel jobs (20 total jobs: 4 browsers × 5 shards)
  • Updated workflows to handle sharded test execution and report merging

Changes

test-ui.yaml

  • Added shard matrix parameter (1-5) to run tests in parallel
  • Updated test execution to use --shard=${{ matrix.shard }}/5 flag
  • Added merge-reports job to consolidate test artifacts
  • Modified artifact names to include shard numbers for unique identification

pr-playwright-deploy.yaml

  • Updated to download sharded test reports (playwright-report--shard-)
  • Added Playwright installation and report merging steps
  • Merges all shard reports into a single HTML report before deploying
  • Updated PR comment to indicate tests are running in parallel shards

Benefits

  • Significantly faster CI/CD: Runtime reduced from 17 minutes to ~3-4 minutes
  • Better resource utilization: Tests run in parallel across 20 jobs
  • Maintains test coverage: All tests still run, just distributed across shards
  • Improved developer experience: Faster feedback on PRs

Test Plan

  • Updated workflow files pass YAML validation
  • Workflow runs successfully on this PR
  • All test shards complete and reports are properly merged
  • Cloudflare deployment works with merged reports
  • PR comments display correctly

🤖 Generated with Claude Code

┆Issue is synchronized with this Notion page by Unito

- Split Playwright tests into 5 shards to reduce CI runtime from 17min to ~3-4min
- Each browser now runs tests in 5 parallel jobs (20 total jobs: 4 browsers × 5 shards)
- Updated test-ui.yaml workflow to use matrix strategy with sharding
- Added merge-reports job to consolidate test results
- Updated pr-playwright-deploy.yaml to handle sharded test reports
- Merge sharded reports before deploying to Cloudflare Pages

This change will significantly improve CI/CD performance by running tests in parallel,
matching the runtime of other workflows (~3-4 minutes).

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@github-actions
Copy link

github-actions bot commented Sep 2, 2025

🎭 Playwright Test Results

All tests passed across all browsers!

⏰ Completed at: 09/03/2025, 04:53:05 PM UTC

📊 Test Reports by Browser


🎉 Your tests are passing across all browsers!

snomiao and others added 4 commits September 2, 2025 20:41
- Implement weighted test distribution algorithm to balance shard execution times
- Create automated shard optimization script that analyzes test complexity
- Remove unnecessary sharding for fast test suites (mobile-chrome, chromium-0.5x, chromium-2x)
- Update GitHub workflow to use optimized shard configuration
- Add comprehensive sharding documentation

The previous naive sharding caused shard 5 to take 9 minutes while others completed in 2-6 minutes.
This was due to interaction.spec.ts containing 61 tests with 81 screenshot comparisons.

New approach uses weighted distribution based on:
- Number of tests per file
- Screenshot comparison count
- Test complexity and historical execution time

Results:
- Achieved ~4.5% imbalance (vs previous ~80%)
- All chromium shards now complete in 3-4 minutes
- Total CI time reduced from 9 minutes to ~4 minutes

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@snomiao
Copy link
Member Author

snomiao commented Sep 3, 2025

@snomiao snomiao closed this Sep 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants