Skip to content

Commit 119acea

Browse files
committed
chore: parallelise e2e tests
1 parent 1fada0c commit 119acea

File tree

1 file changed

+28
-9
lines changed

1 file changed

+28
-9
lines changed

.github/workflows/e2e-next.yml

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,38 @@ on:
66
branches: [main]
77

88
jobs:
9+
setup:
10+
runs-on: ubuntu-latest
11+
outputs:
12+
test-chunks: ${{ steps['set-test-chunks'].outputs['test-chunks'] }}
13+
test-chunk-ids: ${{ steps['set-test-chunk-ids'].outputs['test-chunk-ids'] }}
14+
steps:
15+
- uses: actions/checkout@v2
16+
- run: npm install
17+
- id: set-test-chunks
18+
name: Set Chunks
19+
run:
20+
echo "::set-output name=test-chunks::$(npx jest -c test/e2e/jest.config.js --listTests --json | jq -cM
21+
'[_nwise(length / 10 | floor)]')"
22+
- id: set-test-chunk-ids
23+
name: Set Chunk IDs
24+
run: echo "::set-output name=test-chunk-ids::$(echo $CHUNKS | jq -cM 'to_entries | map(.key)')"
25+
env:
26+
CHUNKS: ${{ steps['set-test-chunks'].outputs['test-chunks'] }}
927
test:
10-
name: E2E tests
1128
runs-on: ubuntu-latest
29+
name: test (chunk ${{ matrix.chunk }})
30+
needs:
31+
- setup
32+
strategy:
33+
matrix:
34+
chunk: ${{ fromJson(needs.setup.outputs['test-chunk-ids']) }}
1235
steps:
1336
- uses: actions/checkout@v2
14-
- name: Installing with LTS Node.js
15-
uses: actions/setup-node@v2
16-
with:
17-
node-version: 'lts/*'
18-
- name: NPM Install
19-
run: npm install
20-
- name: Run Next.js e2e test suite
21-
run: npm run test:next
37+
- run: npm install
38+
- name: jest
39+
run: echo $CHUNKS | jq '.[${{ matrix.chunk }}] | .[] | @text' | xargs npx jest -c test/e2e/jest.config.js
2240
env:
41+
CHUNKS: ${{ needs.setup.outputs['test-chunks'] }}
2342
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_BOT_AUTH_TOKEN }}
2443
NETLIFY_SITE_ID: 1d5a5c76-d445-4ae5-b694-b0d3f2e2c395

0 commit comments

Comments
 (0)