Skip to content

Commit 8192de1

Browse files
committed
Gate Playwright CI setup on bucket content
Six Playwright setup steps in test-smokes.yml (node install, browser cache/install, system deps) ran on every Linux job regardless of whether the job's test bucket contained a Playwright test. Under test-smokes-parallel (~20 bucket jobs per push/PR to main) that meant ~19 jobs paid 2-3 min of unused browser/system-deps installation and carried its failure surface: run 30081294158 died in `npx playwright install-deps` on a transient apt failure a bucket without Playwright had no reason to touch. Gate the six steps the way the rsvg-convert step already gates on bucket content: run only for a full serial run (empty buckets) or a bucket containing integration/playwright-tests.test.ts. Drop the schedule escape, since the suite is ignored on Windows CI (ignore: gha.isGitHubActions() && isWindows) and browser setup was pure waste there in every mode.
1 parent c3e0f5c commit 8192de1

1 file changed

Lines changed: 29 additions & 6 deletions

File tree

‎.github/workflows/test-smokes.yml‎

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,16 @@ jobs:
8585
with:
8686
node-version: 22
8787

88+
# Playwright setup is only needed when this job can actually run the
89+
# playwright suite: a bucket containing playwright-tests.test.ts, or a
90+
# full run (empty buckets, which includes integration/). Windows never
91+
# needs it: the suite is ignored on Windows CI (playwright-tests.test.ts,
92+
# `ignore: gha.isGitHubActions() && isWindows`).
8893
- name: Cache multiplex server node_modules
89-
if: ${{ runner.os != 'Windows' || github.event_name == 'schedule' }}
94+
if: >-
95+
runner.os != 'Windows'
96+
&& (format('{0}', inputs.buckets) == ''
97+
|| contains(inputs.buckets, 'playwright-tests.test.ts'))
9098
uses: actions/cache@v5
9199
with:
92100
path: tests/integration/playwright/multiplex-server/node_modules
@@ -95,21 +103,30 @@ jobs:
95103
${{ runner.os }}-multiplex-server-
96104
97105
- name: Install node dependencies
98-
if: ${{ runner.os != 'Windows' || github.event_name == 'schedule' }}
106+
if: >-
107+
runner.os != 'Windows'
108+
&& (format('{0}', inputs.buckets) == ''
109+
|| contains(inputs.buckets, 'playwright-tests.test.ts'))
99110
run: npm install --loglevel=error --no-audit
100111
working-directory: ./tests/integration/playwright
101112
shell: bash
102113

103114
- name: Get Playwright version
104-
if: ${{ runner.os != 'Windows' || github.event_name == 'schedule' }}
115+
if: >-
116+
runner.os != 'Windows'
117+
&& (format('{0}', inputs.buckets) == ''
118+
|| contains(inputs.buckets, 'playwright-tests.test.ts'))
105119
run: |
106120
VERSION=$(node -p "require('@playwright/test/package.json').version")
107121
echo "PLAYWRIGHT_VERSION=$VERSION" >> "$GITHUB_ENV"
108122
working-directory: ./tests/integration/playwright
109123
shell: bash
110124

111125
- name: Cache Playwright browsers
112-
if: ${{ runner.os != 'Windows' || github.event_name == 'schedule' }}
126+
if: >-
127+
runner.os != 'Windows'
128+
&& (format('{0}', inputs.buckets) == ''
129+
|| contains(inputs.buckets, 'playwright-tests.test.ts'))
113130
uses: actions/cache@v5
114131
with:
115132
path: ${{ env.PLAYWRIGHT_BROWSERS_PATH }}
@@ -118,13 +135,19 @@ jobs:
118135
${{ runner.os }}-playwright-
119136
120137
- name: Install Playwright system dependencies
121-
if: ${{ runner.os != 'Windows' || github.event_name == 'schedule' }}
138+
if: >-
139+
runner.os != 'Windows'
140+
&& (format('{0}', inputs.buckets) == ''
141+
|| contains(inputs.buckets, 'playwright-tests.test.ts'))
122142
timeout-minutes: 15
123143
run: npx playwright install-deps
124144
working-directory: ./tests/integration/playwright
125145

126146
- name: Install Playwright Browsers
127-
if: ${{ runner.os != 'Windows' || github.event_name == 'schedule' }}
147+
if: >-
148+
runner.os != 'Windows'
149+
&& (format('{0}', inputs.buckets) == ''
150+
|| contains(inputs.buckets, 'playwright-tests.test.ts'))
128151
timeout-minutes: 15
129152
run: npx playwright install
130153
working-directory: ./tests/integration/playwright

0 commit comments

Comments
 (0)