Skip to content

Commit 4257d28

Browse files
authored
Document parallel builds for GitHub Actions
1 parent ae0042c commit 4257d28

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

docs/recipes/splitting-tests-ci.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,33 @@ export default {
2020
sortTestFiles: (file1, file2) => testData[file1].order - testData[file2].order,
2121
};
2222
```
23+
24+
## Splitting tests on GitHub Actions
25+
26+
Although GitHub Actions doesn't support parallel builds out-of-the-box with AVA, you can configure it manually by using a matrix:
27+
28+
**`.github/workflows/test.yml`:**
29+
30+
```yml
31+
on: push
32+
jobs:
33+
test:
34+
strategy:
35+
# Don't cancel test runs if one fails
36+
fail-fast: false
37+
# Run 4 jobs in parallel, each executing a subset of all tests
38+
matrix:
39+
node_index: [0, 1, 2, 3]
40+
total_nodes: [4]
41+
42+
runs-on: ubuntu-latest
43+
steps:
44+
# Check out code and perform setup steps
45+
# ...
46+
47+
- name: Test
48+
run: npx ava
49+
env:
50+
CI_NODE_INDEX: ${{ matrix.node_index }}
51+
CI_NODE_TOTAL: ${{ matrix.total_nodes }}
52+
```

0 commit comments

Comments
 (0)