-
Notifications
You must be signed in to change notification settings - Fork 449
Playwright Test Sharding #5311
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
Merged
Merged
Playwright Test Sharding #5311
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -44,7 +44,6 @@ jobs: | |
| cache: 'pnpm' | ||
| cache-dependency-path: 'ComfyUI_frontend/pnpm-lock.yaml' | ||
|
|
||
|
|
||
| - name: Cache tool outputs | ||
| uses: actions/cache@v4 | ||
| with: | ||
|
|
@@ -75,15 +74,17 @@ jobs: | |
| ComfyUI_frontend | ||
| key: comfyui-setup-${{ steps.cache-key.outputs.key }} | ||
|
|
||
| playwright-tests: | ||
| # Sharded chromium tests | ||
| playwright-tests-chromium-sharded: | ||
| needs: setup | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| browser: [chromium, chromium-2x, chromium-0.5x, mobile-chrome] | ||
| shardIndex: [1, 2, 3, 4, 5, 6, 7, 8] | ||
| shardTotal: [8] | ||
| steps: | ||
| - name: Wait for cache propagation | ||
| run: sleep 10 | ||
|
|
@@ -107,6 +108,78 @@ jobs: | |
| python-version: '3.10' | ||
| cache: 'pip' | ||
|
|
||
| - name: Install requirements | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu | ||
| pip install -r requirements.txt | ||
| pip install wait-for-it | ||
| working-directory: ComfyUI | ||
|
|
||
| - name: Start ComfyUI server | ||
| run: | | ||
| python main.py --cpu --multi-user --front-end-root ../ComfyUI_frontend/dist & | ||
| wait-for-it --service 127.0.0.1:8188 -t 600 | ||
| working-directory: ComfyUI | ||
|
|
||
| - name: Cache Playwright browsers | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: ~/.cache/ms-playwright | ||
| key: playwright-browsers-${{ runner.os }}-${{ hashFiles('ComfyUI_frontend/pnpm-lock.yaml') }}-chromium | ||
| restore-keys: | | ||
| playwright-browsers-${{ runner.os }}-${{ hashFiles('ComfyUI_frontend/pnpm-lock.yaml') }}- | ||
| playwright-browsers-${{ runner.os }}- | ||
|
Comment on lines
+125
to
+132
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The official recommendation is to not cache the browsers: https://playwright.dev/docs/ci#caching-browsers |
||
|
|
||
| - name: Install Playwright Browsers | ||
| run: npx playwright install chromium --with-deps | ||
| working-directory: ComfyUI_frontend | ||
|
|
||
| - name: Run Playwright tests (Shard ${{ matrix.shardIndex }}/${{ matrix.shardTotal }}) | ||
| id: playwright | ||
| run: npx playwright test --project=chromium --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }} --reporter=blob | ||
| working-directory: ComfyUI_frontend | ||
| env: | ||
| PLAYWRIGHT_BLOB_OUTPUT_DIR: ../blob-report | ||
|
|
||
| - uses: actions/upload-artifact@v4 | ||
| if: ${{ !cancelled() }} | ||
| with: | ||
| name: blob-report-chromium-${{ matrix.shardIndex }} | ||
| path: blob-report/ | ||
| retention-days: 1 | ||
|
|
||
| playwright-tests: | ||
| needs: setup | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| browser: [chromium-2x, chromium-0.5x, mobile-chrome] | ||
| steps: | ||
| - name: Wait for cache propagation | ||
| run: sleep 10 | ||
|
|
||
| - name: Restore cached setup | ||
| uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 | ||
| with: | ||
| fail-on-cache-miss: true | ||
| path: | | ||
| ComfyUI | ||
| ComfyUI_frontend | ||
| key: comfyui-setup-${{ needs.setup.outputs.cache-key }} | ||
|
|
||
| - name: Install pnpm | ||
| uses: pnpm/action-setup@v4 | ||
| with: | ||
| version: 10 | ||
|
|
||
| - uses: actions/setup-python@v4 | ||
| with: | ||
| python-version: '3.10' | ||
| cache: 'pip' | ||
|
|
||
| - name: Install requirements | ||
| run: | | ||
|
|
@@ -141,9 +214,54 @@ jobs: | |
| working-directory: ComfyUI_frontend | ||
|
|
||
| - uses: actions/upload-artifact@v4 | ||
| if: always() # note: use always() to allow results to be upload/report even tests failed. | ||
| if: always() | ||
| with: | ||
| name: playwright-report-${{ matrix.browser }} | ||
| path: ComfyUI_frontend/playwright-report/ | ||
| retention-days: 30 | ||
|
|
||
| # Merge sharded test reports | ||
| merge-reports: | ||
| needs: [playwright-tests-chromium-sharded] | ||
| runs-on: ubuntu-latest | ||
| if: ${{ !cancelled() }} | ||
| steps: | ||
| - name: Checkout ComfyUI_frontend | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| repository: 'Comfy-Org/ComfyUI_frontend' | ||
| path: 'ComfyUI_frontend' | ||
|
|
||
| - name: Install pnpm | ||
| uses: pnpm/action-setup@v4 | ||
| with: | ||
| version: 10 | ||
|
|
||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: lts/* | ||
| cache: 'pnpm' | ||
| cache-dependency-path: 'ComfyUI_frontend/pnpm-lock.yaml' | ||
|
|
||
| - name: Install dependencies | ||
| run: | | ||
| pnpm install --frozen-lockfile | ||
| working-directory: ComfyUI_frontend | ||
|
|
||
| - name: Download blob reports | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| path: ComfyUI_frontend/all-blob-reports | ||
| pattern: blob-report-chromium-* | ||
| merge-multiple: true | ||
|
|
||
| - name: Merge into HTML Report | ||
| run: npx playwright merge-reports --reporter html ./all-blob-reports | ||
| working-directory: ComfyUI_frontend | ||
|
|
||
| - name: Upload HTML report | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: playwright-report-chromium-merged | ||
| path: ComfyUI_frontend/playwright-report/ | ||
Myestery marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| retention-days: 30 | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
https://playwright.dev/docs/test-sharding#github-actions-example
We should add a
timeoutfor the upper limit of test run time. Hitting the timeout can be a signal that we need to increase shard totals or rethink our browser test suite.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.
we should also add a comment explaining this if we do it.
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.
true