-
Notifications
You must be signed in to change notification settings - Fork 1
Implement test sharding in CI with workflow optimization to reduce build time #481
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: hudson-newey <33742269+hudson-newey@users.noreply.github.com>
Co-authored-by: hudson-newey <33742269+hudson-newey@users.noreply.github.com>
.github/workflows/tests.yml
Outdated
| name: blob-report-${{ matrix.os }}-${{ matrix.shard }} | ||
| path: blob-report/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Revert blob-report name change.
| name: blob-report-${{ matrix.os }}-${{ matrix.shard }} | |
| path: blob-report/ | |
| name: test-report-${{ matrix.os }}-${{ matrix.shard }} | |
| path: test-report/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed the artifact name back to test-report-${{ matrix.os }}-${{ matrix.shard }} and updated path to test-report/ as requested. Commit 5ecd98a
.github/workflows/tests.yml
Outdated
| path: all-blob-reports/ | ||
| pattern: blob-report-* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| path: all-blob-reports/ | |
| pattern: blob-report-* | |
| path: all-test-reports/ | |
| pattern: test-report-* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated to use path: all-test-reports/ and pattern: test-report-* as suggested. Commit 5ecd98a
.github/workflows/tests.yml
Outdated
| path: all-blob-reports/ | ||
| pattern: blob-report-* | ||
|
|
||
| - name: Merge Blob Reports |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| - name: Merge Blob Reports | |
| - name: Merge Test Reports |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renamed to "Merge Test Reports" for clarity. Commit 5ecd98a
.github/workflows/tests.yml
Outdated
| - recursive: true | ||
| - args: [--frozen-lockfile] | ||
| - name: Download All Blob Reports |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| - name: Download All Blob Reports | |
| - name: Download All Test Reports |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renamed to "Download All Test Reports" for clarity. Commit 5ecd98a
.github/workflows/tests.yml
Outdated
| pattern: blob-report-* | ||
|
|
||
| - name: Merge Blob Reports | ||
| run: pnpm exec playwright merge-reports --reporter=html,github all-blob-reports/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| run: pnpm exec playwright merge-reports --reporter=html,github all-blob-reports/ | |
| run: pnpm exec playwright merge-reports --reporter=html,github all-test-reports/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated run command to use all-test-reports/ directory. Commit 5ecd98a
playwright.config.ts
Outdated
| reporter: process.env.PLAYWRIGHT_SHARD | ||
| ? [ | ||
| ["blob"], | ||
| ["github"], | ||
| ] | ||
| : [ | ||
| // create a HTML report of the test results | ||
| // this is the best way to debug why tests are failing locally | ||
| [ | ||
| "html", | ||
| { | ||
| outputFolder: "test-report", | ||
| open: "never", | ||
| }, | ||
| ], | ||
| // print the test results out to the console. | ||
| // this can be useful for seeing why a test has failed in CI | ||
| isCi ? ["github"] : ["list"], | ||
| ], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a TypeScript file.
Extract this out to a function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extracted the reporter configuration logic into a getPlaywrightReporters() function to improve code organization in the TypeScript file. Commit 5ecd98a
|
@copilot Address review feedback |
…ction Co-authored-by: hudson-newey <33742269+hudson-newey@users.noreply.github.com>
|
Good starter. I might have to do some minor formatting changes, but copilot seems to have (almost) nailed it |
|
@copilot Instead of cloning and pnpm installing dependencies on each testing shard, can you use a common base workflow task to set up the environment and use that as the base for all subsequent tests |
Co-authored-by: hudson-newey <33742269+hudson-newey@users.noreply.github.com>
Added a Setup job that runs once to prepare the environment and shared dependency cache across all test matrix jobs. Enhanced caching for both pnpm dependencies and Playwright browsers per OS. This reduces redundant setup work while maintaining the cross-platform testing matrix. Commit b5c7e9b |
This PR implements test sharding for Playwright tests across multiple OS platforms to significantly reduce CI build time. The implementation includes:
Key Features
Technical Implementation
PLAYWRIGHT_SHARDenvironment variable to enable blob reporting modegetPlaywrightReporters()function inplaywright.config.tsBenefits
The workflow now runs a Setup job once to prepare cached dependencies, then executes 12 parallel test jobs (3 OS × 4 shards) that leverage the shared cache, followed by a merge job that combines all test reports into a unified result.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.