Skip to content

Commit 1af72cc

Browse files
committed
Try running only when needed
1 parent 9d1f5f3 commit 1af72cc

1 file changed

Lines changed: 11 additions & 7 deletions

File tree

.github/workflows/tests.yml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ jobs:
176176
cache: |
177177
.cache/jest
178178
.cache/puppeteer
179+
puppeteer: true
179180
projects:
180181
- JavaScript component tests
181182

@@ -190,6 +191,7 @@ jobs:
190191
cache: |
191192
.cache/jest
192193
.cache/puppeteer
194+
puppeteer: true
193195
projects:
194196
- Accessibility tests
195197

@@ -212,13 +214,15 @@ jobs:
212214
key: ${{ matrix.task.name }}-${{ runner.os }}
213215
path: ${{ matrix.task.cache }}
214216

215-
- name: Run test task in Windows
216-
if: ${{ matrix.runner.name == 'Windows' }}
217-
run: npx jest --color ${{ format('--coverage={0} --maxWorkers=2 --selectProjects "{1}"', matrix.task.coverage || false, join(matrix.task.projects, '", "')) }}
218-
219-
- name: Run test task in Ubuntu
220-
if: ${{ matrix.runner.name == 'Ubuntu' }}
221-
run: aa-exec --profile=chrome npx jest --color ${{ format('--coverage={0} --maxWorkers=2 --selectProjects "{1}"', matrix.task.coverage || false, join(matrix.task.projects, '", "')) }}
217+
- name: Run test task
218+
run: |
219+
# Ubuntu requires a profile for developer builds of Chrome to run without errors.
220+
# (https://chromium.googlesource.com/chromium/src/+/main/docs/security/apparmor-userns-restrictions.md)
221+
IS_UBUNTU="${{ matrix.runner.name == 'Ubuntu' }}"
222+
# Puppeteer uses Chrome to execute tests.
223+
USES_PUPPETEER="${{ matrix.task.puppeteer || false }}"
224+
${{ (IS_UBUNTU && USES_PUPPETEER) && "aa-exec --profile=chrome \" || "" }}
225+
npx jest --color ${{ format('--coverage={0} --maxWorkers=2 --selectProjects "{1}"', matrix.task.coverage || false, join(matrix.task.projects, '", "')) }}
222226
223227
- name: Save test coverage
224228
uses: actions/upload-artifact@v7.0.1

0 commit comments

Comments
 (0)