From fb96c82faece094801967012f5a65766dfd0ba42 Mon Sep 17 00:00:00 2001 From: DrJKL Date: Thu, 4 Sep 2025 11:24:53 -0700 Subject: [PATCH] devex: re-add caching of playwright browser installs --- .github/workflows/test-ui.yaml | 55 +++++++++++++++++++++++++++------- 1 file changed, 45 insertions(+), 10 deletions(-) diff --git a/.github/workflows/test-ui.yaml b/.github/workflows/test-ui.yaml index be5c0cfc2b..451c4b903a 100644 --- a/.github/workflows/test-ui.yaml +++ b/.github/workflows/test-ui.yaml @@ -12,6 +12,7 @@ jobs: runs-on: ubuntu-latest outputs: cache-key: ${{ steps.cache-key.outputs.key }} + playwright-version: ${{ steps.playwright-version.outputs.PLAYWRIGHT_VERSION }} steps: - name: Checkout ComfyUI uses: actions/checkout@v4 @@ -66,6 +67,13 @@ jobs: id: cache-key run: echo "key=$(date +%s)" >> $GITHUB_OUTPUT + - name: Playwright Version + id: playwright-version + run: | + PLAYWRIGHT_VERSION=$(pnpm ls @playwright/test --json | jq --raw-output '.[0].devDependencies["@playwright/test"].version') + echo "PLAYWRIGHT_VERSION=$PLAYWRIGHT_VERSION" >> $GITHUB_OUTPUT + working-directory: ComfyUI_frontend + - name: Save cache uses: actions/cache/save@5a3ec84eff668545956fd18022155c47e93e2684 with: @@ -116,16 +124,30 @@ jobs: pip install wait-for-it working-directory: ComfyUI + + - name: Cache Playwright Browsers + uses: actions/cache@v4 + id: cache-playwright-browsers + with: + path: '~/.cache/ms-playwright' + key: '${{ runner.os }}-playwright-browsers-${{ needs.setup.outputs.playwright-version }}' + + - name: Install Playwright Browsers + if: steps.cache-playwright-browsers.outputs.cache-hit != 'true' + run: pnpm exec playwright install chromium --with-deps + working-directory: ComfyUI_frontend + + - name: Install Playwright Browsers (operating system dependencies) + if: steps.cache-playwright-browsers.outputs.cache-hit == 'true' + run: pnpm exec playwright install-deps + working-directory: ComfyUI_frontend + - 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: 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 @@ -141,7 +163,7 @@ jobs: retention-days: 1 playwright-tests: - # Ideally, each shard runs test in 6 minutes, but allow up to 15 minutes + # Ideally, each shard runs test in 6 minutes, but allow up to 15 minutes timeout-minutes: 15 needs: setup runs-on: ubuntu-latest @@ -182,16 +204,29 @@ jobs: pip install wait-for-it working-directory: ComfyUI + - name: Cache Playwright Browsers + uses: actions/cache@v4 + id: cache-playwright-browsers + with: + path: '~/.cache/ms-playwright' + key: '${{ runner.os }}-playwright-browsers-${{ needs.setup.outputs.playwright-version }}' + + - name: Install Playwright Browsers + if: steps.cache-playwright-browsers.outputs.cache-hit != 'true' + run: pnpm exec playwright install chromium --with-deps + working-directory: ComfyUI_frontend + + - name: Install Playwright Browsers (operating system dependencies) + if: steps.cache-playwright-browsers.outputs.cache-hit == 'true' + run: pnpm exec playwright install-deps + working-directory: ComfyUI_frontend + - 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: Install Playwright Browsers - run: npx playwright install chromium --with-deps - working-directory: ComfyUI_frontend - - name: Run Playwright tests (${{ matrix.browser }}) id: playwright run: npx playwright test --project=${{ matrix.browser }} --reporter=html @@ -248,4 +283,4 @@ jobs: with: name: playwright-report-chromium path: ComfyUI_frontend/playwright-report/ - retention-days: 30 \ No newline at end of file + retention-days: 30