Skip to content

Commit 3abb35e

Browse files
snomiaoactions-user
authored andcommitted
Add Playwright composite action to reduce workflow duplication (#5754)
This PR introduces a reusable composite action for Playwright setup to reduce duplication across workflows. ## Changes - Created `.github/actions/setup-playwright/action.yml` composite action that: - Detects or uses provided Playwright version - Caches Playwright browsers with intelligent cache keys - Installs browsers only when cache miss occurs - Installs OS dependencies when cache hit occurs ## Technical Details - **Important:** The composite action requires `shell: bash` for all `run` steps as per [GitHub Actions requirements for composite actions](https://docs.github.com/en/actions/creating-actions/creating-a-composite-action#creating-an-action-metadata-file). This is a mandatory field for composite actions, unlike regular workflow steps. - Updated workflow paths to account for repository checkout locations (some workflows checkout to subdirectories like `ComfyUI_frontend/`) - Uses conditional caching to avoid redundant browser installations ## Benefits - Reduces code duplication across 6 workflow files - Centralizes Playwright caching logic - Consistent browser setup across all workflows - Easier maintenance and updates - Faster CI runs through intelligent caching ## Affected Workflows - `.github/workflows/test-ui.yaml` (2 uses) - `.github/workflows/i18n-custom-nodes.yaml` - `.github/workflows/i18n-node-defs.yaml` - `.github/workflows/i18n.yaml` - `.github/workflows/test-browser-exp.yaml` --------- Co-authored-by: GitHub Action <[email protected]>
1 parent 9a66452 commit 3abb35e

File tree

7 files changed

+45
-68
lines changed

7 files changed

+45
-68
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Setup Playwright
2+
description: Cache and install Playwright browsers with dependencies
3+
runs:
4+
using: composite
5+
steps:
6+
- name: Detect Playwright version
7+
id: detect-version
8+
shell: bash
9+
working-directory: ComfyUI_frontend
10+
run: |
11+
PLAYWRIGHT_VERSION=$(pnpm ls @playwright/test --json | jq --raw-output '.[0].devDependencies["@playwright/test"].version')
12+
echo "playwright-version=$PLAYWRIGHT_VERSION" >> $GITHUB_OUTPUT
13+
14+
- name: Cache Playwright Browsers
15+
uses: actions/cache@v4
16+
id: cache-playwright-browsers
17+
with:
18+
path: '~/.cache/ms-playwright'
19+
key: ${{ runner.os }}-playwright-browsers-${{ steps.detect-version.outputs.playwright-version }}
20+
21+
- name: Install Playwright Browsers
22+
if: steps.cache-playwright-browsers.outputs.cache-hit != 'true'
23+
shell: bash
24+
run: pnpm exec playwright install chromium --with-deps
25+
working-directory: ComfyUI_frontend
26+
27+
- name: Install Playwright Browsers (operating system dependencies)
28+
if: steps.cache-playwright-browsers.outputs.cache-hit == 'true'
29+
shell: bash
30+
run: pnpm exec playwright install-deps
31+
working-directory: ComfyUI_frontend

.github/workflows/tests-ci.yaml

Lines changed: 4 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ jobs:
1212
runs-on: ubuntu-latest
1313
outputs:
1414
cache-key: ${{ steps.cache-key.outputs.key }}
15-
playwright-version: ${{ steps.playwright-version.outputs.PLAYWRIGHT_VERSION }}
1615
steps:
1716
- name: Checkout ComfyUI
1817
uses: actions/checkout@v5
@@ -65,12 +64,6 @@ jobs:
6564
id: cache-key
6665
run: echo "key=$(date +%s)" >> $GITHUB_OUTPUT
6766

68-
- name: Playwright Version
69-
id: playwright-version
70-
run: |
71-
PLAYWRIGHT_VERSION=$(pnpm ls @playwright/test --json | jq --raw-output '.[0].devDependencies["@playwright/test"].version')
72-
echo "PLAYWRIGHT_VERSION=$PLAYWRIGHT_VERSION" >> $GITHUB_OUTPUT
73-
working-directory: ComfyUI_frontend
7467

7568
- name: Save cache
7669
uses: actions/cache/save@5a3ec84eff668545956fd18022155c47e93e2684
@@ -123,22 +116,8 @@ jobs:
123116
working-directory: ComfyUI
124117

125118

126-
- name: Cache Playwright Browsers
127-
uses: actions/cache@v4
128-
id: cache-playwright-browsers
129-
with:
130-
path: '~/.cache/ms-playwright'
131-
key: '${{ runner.os }}-playwright-browsers-${{ needs.setup.outputs.playwright-version }}'
132-
133-
- name: Install Playwright Browsers
134-
if: steps.cache-playwright-browsers.outputs.cache-hit != 'true'
135-
run: pnpm exec playwright install chromium --with-deps
136-
working-directory: ComfyUI_frontend
137-
138-
- name: Install Playwright Browsers (operating system dependencies)
139-
if: steps.cache-playwright-browsers.outputs.cache-hit == 'true'
140-
run: pnpm exec playwright install-deps
141-
working-directory: ComfyUI_frontend
119+
- name: Setup Playwright
120+
uses: ./ComfyUI_frontend/.github/actions/setup-playwright
142121

143122
- name: Start ComfyUI server
144123
run: |
@@ -202,22 +181,8 @@ jobs:
202181
pip install wait-for-it
203182
working-directory: ComfyUI
204183

205-
- name: Cache Playwright Browsers
206-
uses: actions/cache@v4
207-
id: cache-playwright-browsers
208-
with:
209-
path: '~/.cache/ms-playwright'
210-
key: '${{ runner.os }}-playwright-browsers-${{ needs.setup.outputs.playwright-version }}'
211-
212-
- name: Install Playwright Browsers
213-
if: steps.cache-playwright-browsers.outputs.cache-hit != 'true'
214-
run: pnpm exec playwright install chromium --with-deps
215-
working-directory: ComfyUI_frontend
216-
217-
- name: Install Playwright Browsers (operating system dependencies)
218-
if: steps.cache-playwright-browsers.outputs.cache-hit == 'true'
219-
run: pnpm exec playwright install-deps
220-
working-directory: ComfyUI_frontend
184+
- name: Setup Playwright
185+
uses: ./ComfyUI_frontend/.github/actions/setup-playwright
221186

222187
- name: Start ComfyUI server
223188
run: |

.github/workflows/update-locales-for-given-custom-node-repository.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,8 @@ jobs:
7777
python main.py --cpu --multi-user &
7878
wait-for-it --service 127.0.0.1:8188 -t 600
7979
working-directory: ComfyUI
80-
- name: Install Playwright Browsers
81-
run: pnpm exec playwright install chromium --with-deps
82-
working-directory: ComfyUI_frontend
80+
- name: Setup Playwright
81+
uses: ./ComfyUI_frontend/.github/actions/setup-playwright
8382
- name: Start dev server
8483
# Run electron dev server as it is a superset of the web dev server
8584
# We do want electron specific UIs to be translated.

.github/workflows/update-locales.yaml

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,8 @@ jobs:
2626
key: i18n-tools-cache-${{ runner.os }}-${{ hashFiles('ComfyUI_frontend/pnpm-lock.yaml') }}
2727
restore-keys: |
2828
i18n-tools-cache-${{ runner.os }}-
29-
- name: Cache Playwright browsers
30-
uses: actions/cache@v4
31-
with:
32-
path: ~/.cache/ms-playwright
33-
key: playwright-browsers-${{ runner.os }}-${{ hashFiles('ComfyUI_frontend/pnpm-lock.yaml') }}
34-
restore-keys: |
35-
playwright-browsers-${{ runner.os }}-
36-
- name: Install Playwright Browsers
37-
run: pnpm exec playwright install chromium --with-deps
38-
working-directory: ComfyUI_frontend
29+
- name: Setup Playwright
30+
uses: ./.github/actions/setup-playwright
3931
- name: Start dev server
4032
# Run electron dev server as it is a superset of the web dev server
4133
# We do want electron specific UIs to be translated.

.github/workflows/update-node-definitions-locales.yaml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,9 @@ jobs:
1313
update-locales:
1414
runs-on: ubuntu-latest
1515
steps:
16-
- name: Setup Frontend
17-
uses: ./.github/actions/setup-frontend
18-
- name: Install Playwright Browsers
19-
run: pnpm exec playwright install chromium --with-deps
20-
working-directory: ComfyUI_frontend
16+
- uses: Comfy-Org/ComfyUI_frontend_setup_action@v3
17+
- name: Setup Playwright
18+
uses: ./.github/actions/setup-playwright
2119
- name: Start dev server
2220
# Run electron dev server as it is a superset of the web dev server
2321
# We do want electron specific UIs to be translated.

.github/workflows/update-playwright-expectations.yaml

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,8 @@ jobs:
1414
uses: actions/checkout@v5
1515
- name: Setup Frontend
1616
uses: ./.github/actions/setup-frontend
17-
- name: Cache Playwright browsers
18-
uses: actions/cache@v4
19-
with:
20-
path: ~/.cache/ms-playwright
21-
key: playwright-browsers-${{ runner.os }}-${{ hashFiles('ComfyUI_frontend/pnpm-lock.yaml') }}
22-
restore-keys: |
23-
playwright-browsers-${{ runner.os }}-
24-
- name: Install Playwright Browsers
25-
run: pnpm exec playwright install chromium --with-deps
26-
working-directory: ComfyUI_frontend
17+
- name: Setup Playwright
18+
uses: ./.github/actions/setup-playwright
2719
- name: Run Playwright tests and update snapshots
2820
id: playwright-tests
2921
run: pnpm exec playwright test --update-snapshots

src/lib/litegraph/src/LGraphNode.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -902,7 +902,7 @@ export class LGraphNode
902902

903903
if (this.onSerialize?.(o))
904904
console.warn(
905-
'node onSerialize shouldn\'t return anything, data should be stored in the object pass in the first parameter'
905+
"node onSerialize shouldn't return anything, data should be stored in the object pass in the first parameter"
906906
)
907907

908908
return o

0 commit comments

Comments
 (0)