Skip to content

Commit 58313ea

Browse files
authored
devex: re-add caching of playwright browser installs (#5350)
1 parent ae690bb commit 58313ea

File tree

1 file changed

+45
-10
lines changed

1 file changed

+45
-10
lines changed

.github/workflows/test-ui.yaml

Lines changed: 45 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ 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 }}
1516
steps:
1617
- name: Checkout ComfyUI
1718
uses: actions/checkout@v4
@@ -66,6 +67,13 @@ jobs:
6667
id: cache-key
6768
run: echo "key=$(date +%s)" >> $GITHUB_OUTPUT
6869

70+
- name: Playwright Version
71+
id: playwright-version
72+
run: |
73+
PLAYWRIGHT_VERSION=$(pnpm ls @playwright/test --json | jq --raw-output '.[0].devDependencies["@playwright/test"].version')
74+
echo "PLAYWRIGHT_VERSION=$PLAYWRIGHT_VERSION" >> $GITHUB_OUTPUT
75+
working-directory: ComfyUI_frontend
76+
6977
- name: Save cache
7078
uses: actions/cache/save@5a3ec84eff668545956fd18022155c47e93e2684
7179
with:
@@ -116,16 +124,30 @@ jobs:
116124
pip install wait-for-it
117125
working-directory: ComfyUI
118126

127+
128+
- name: Cache Playwright Browsers
129+
uses: actions/cache@v4
130+
id: cache-playwright-browsers
131+
with:
132+
path: '~/.cache/ms-playwright'
133+
key: '${{ runner.os }}-playwright-browsers-${{ needs.setup.outputs.playwright-version }}'
134+
135+
- name: Install Playwright Browsers
136+
if: steps.cache-playwright-browsers.outputs.cache-hit != 'true'
137+
run: pnpm exec playwright install chromium --with-deps
138+
working-directory: ComfyUI_frontend
139+
140+
- name: Install Playwright Browsers (operating system dependencies)
141+
if: steps.cache-playwright-browsers.outputs.cache-hit == 'true'
142+
run: pnpm exec playwright install-deps
143+
working-directory: ComfyUI_frontend
144+
119145
- name: Start ComfyUI server
120146
run: |
121147
python main.py --cpu --multi-user --front-end-root ../ComfyUI_frontend/dist &
122148
wait-for-it --service 127.0.0.1:8188 -t 600
123149
working-directory: ComfyUI
124150

125-
- name: Install Playwright Browsers
126-
run: npx playwright install chromium --with-deps
127-
working-directory: ComfyUI_frontend
128-
129151
- name: Run Playwright tests (Shard ${{ matrix.shardIndex }}/${{ matrix.shardTotal }})
130152
id: playwright
131153
run: npx playwright test --project=chromium --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }} --reporter=blob
@@ -141,7 +163,7 @@ jobs:
141163
retention-days: 1
142164

143165
playwright-tests:
144-
# Ideally, each shard runs test in 6 minutes, but allow up to 15 minutes
166+
# Ideally, each shard runs test in 6 minutes, but allow up to 15 minutes
145167
timeout-minutes: 15
146168
needs: setup
147169
runs-on: ubuntu-latest
@@ -182,16 +204,29 @@ jobs:
182204
pip install wait-for-it
183205
working-directory: ComfyUI
184206

207+
- name: Cache Playwright Browsers
208+
uses: actions/cache@v4
209+
id: cache-playwright-browsers
210+
with:
211+
path: '~/.cache/ms-playwright'
212+
key: '${{ runner.os }}-playwright-browsers-${{ needs.setup.outputs.playwright-version }}'
213+
214+
- name: Install Playwright Browsers
215+
if: steps.cache-playwright-browsers.outputs.cache-hit != 'true'
216+
run: pnpm exec playwright install chromium --with-deps
217+
working-directory: ComfyUI_frontend
218+
219+
- name: Install Playwright Browsers (operating system dependencies)
220+
if: steps.cache-playwright-browsers.outputs.cache-hit == 'true'
221+
run: pnpm exec playwright install-deps
222+
working-directory: ComfyUI_frontend
223+
185224
- name: Start ComfyUI server
186225
run: |
187226
python main.py --cpu --multi-user --front-end-root ../ComfyUI_frontend/dist &
188227
wait-for-it --service 127.0.0.1:8188 -t 600
189228
working-directory: ComfyUI
190229

191-
- name: Install Playwright Browsers
192-
run: npx playwright install chromium --with-deps
193-
working-directory: ComfyUI_frontend
194-
195230
- name: Run Playwright tests (${{ matrix.browser }})
196231
id: playwright
197232
run: npx playwright test --project=${{ matrix.browser }} --reporter=html
@@ -248,4 +283,4 @@ jobs:
248283
with:
249284
name: playwright-report-chromium
250285
path: ComfyUI_frontend/playwright-report/
251-
retention-days: 30
286+
retention-days: 30

0 commit comments

Comments
 (0)