mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-10 01:50:08 +00:00
- 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 <noreply@anthropic.com>
199 lines
6.1 KiB
YAML
199 lines
6.1 KiB
YAML
name: Tests CI
|
|
|
|
on:
|
|
push:
|
|
branches: [main, master, core/*, desktop/*]
|
|
pull_request:
|
|
branches-ignore:
|
|
[wip/*, draft/*, temp/*, vue-nodes-migration, sno-playwright-*]
|
|
|
|
jobs:
|
|
setup:
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
cache-key: ${{ steps.cache-key.outputs.key }}
|
|
steps:
|
|
- name: Checkout ComfyUI
|
|
uses: actions/checkout@v4
|
|
with:
|
|
repository: 'comfyanonymous/ComfyUI'
|
|
path: 'ComfyUI'
|
|
ref: master
|
|
|
|
- name: Checkout ComfyUI_frontend
|
|
uses: actions/checkout@v4
|
|
with:
|
|
repository: 'Comfy-Org/ComfyUI_frontend'
|
|
path: 'ComfyUI_frontend'
|
|
|
|
- name: Checkout ComfyUI_devtools
|
|
uses: actions/checkout@v4
|
|
with:
|
|
repository: 'Comfy-Org/ComfyUI_devtools'
|
|
path: 'ComfyUI/custom_nodes/ComfyUI_devtools'
|
|
ref: 'd05fd48dd787a4192e16802d4244cfcc0e2f9684'
|
|
|
|
- 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: Cache tool outputs
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
ComfyUI_frontend/.cache
|
|
ComfyUI_frontend/tsconfig.tsbuildinfo
|
|
key: playwright-setup-cache-${{ runner.os }}-${{ hashFiles('ComfyUI_frontend/pnpm-lock.yaml') }}-${{ hashFiles('ComfyUI_frontend/src/**/*.{ts,vue,js}', 'ComfyUI_frontend/*.config.*') }}
|
|
restore-keys: |
|
|
playwright-setup-cache-${{ runner.os }}-${{ hashFiles('ComfyUI_frontend/pnpm-lock.yaml') }}-
|
|
playwright-setup-cache-${{ runner.os }}-
|
|
playwright-tools-cache-${{ runner.os }}-
|
|
|
|
- name: Build ComfyUI_frontend
|
|
run: |
|
|
pnpm install --frozen-lockfile
|
|
pnpm build
|
|
working-directory: ComfyUI_frontend
|
|
|
|
- name: Generate cache key
|
|
id: cache-key
|
|
run: echo "key=$(date +%s)" >> $GITHUB_OUTPUT
|
|
|
|
- name: Save cache
|
|
uses: actions/cache/save@5a3ec84eff668545956fd18022155c47e93e2684
|
|
with:
|
|
path: |
|
|
ComfyUI
|
|
ComfyUI_frontend
|
|
key: comfyui-setup-${{ steps.cache-key.outputs.key }}
|
|
|
|
playwright-tests:
|
|
needs: setup
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
# Chromium tests with 5 shards (optimized distribution)
|
|
- browser: chromium
|
|
shard: 1
|
|
shard-total: 5
|
|
- browser: chromium
|
|
shard: 2
|
|
shard-total: 5
|
|
- browser: chromium
|
|
shard: 3
|
|
shard-total: 5
|
|
- browser: chromium
|
|
shard: 4
|
|
shard-total: 5
|
|
- browser: chromium
|
|
shard: 5
|
|
shard-total: 5
|
|
# Other browser variants without sharding (faster tests)
|
|
- browser: chromium-2x
|
|
shard: 1
|
|
shard-total: 1
|
|
- browser: chromium-0.5x
|
|
shard: 1
|
|
shard-total: 1
|
|
- browser: mobile-chrome
|
|
shard: 1
|
|
shard-total: 1
|
|
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: |
|
|
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') }}-${{ matrix.browser }}
|
|
restore-keys: |
|
|
playwright-browsers-${{ runner.os }}-${{ hashFiles('ComfyUI_frontend/pnpm-lock.yaml') }}-
|
|
playwright-browsers-${{ runner.os }}-
|
|
|
|
- name: Install Playwright Browsers
|
|
run: npx playwright install chromium --with-deps
|
|
working-directory: ComfyUI_frontend
|
|
|
|
- name: Run Playwright tests (${{ matrix.browser }}${{ matrix.shard-total > 1 && format(', shard {0}/{1}', matrix.shard, matrix.shard-total) || '' }})
|
|
id: playwright
|
|
run: |
|
|
if [ "${{ matrix.shard-total }}" -gt 1 ]; then
|
|
npx playwright test --project=${{ matrix.browser }} --shard=${{ matrix.shard }}/${{ matrix.shard-total }}
|
|
else
|
|
npx playwright test --project=${{ matrix.browser }}
|
|
fi
|
|
working-directory: ComfyUI_frontend
|
|
|
|
- uses: actions/upload-artifact@v4
|
|
if: always() # note: use always() to allow results to be upload/report even tests failed.
|
|
with:
|
|
name: playwright-report-${{ matrix.browser }}-shard-${{ matrix.shard }}
|
|
path: ComfyUI_frontend/playwright-report/
|
|
retention-days: 30
|
|
|
|
merge-reports:
|
|
needs: playwright-tests
|
|
if: always()
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Download all workflow artifacts
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
pattern: playwright-report-*
|
|
path: all-reports/
|
|
|
|
- name: Upload merged report
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: playwright-report-merged
|
|
path: all-reports/
|
|
retention-days: 30
|
|
|