Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add documentation for GitHub Actions #3007

Merged
merged 1 commit into from Apr 10, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
30 changes: 30 additions & 0 deletions docs/recipes/splitting-tests-ci.md
Expand Up @@ -20,3 +20,33 @@ export default {
sortTestFiles: (file1, file2) => testData[file1].order - testData[file2].order,
};
```

## Splitting tests on GitHub Actions

Although GitHub Actions doesn't support parallel builds out-of-the-box with AVA, you can configure it manually by using a matrix:

**`.github/workflows/test.yml`:**

```yml
on: push
jobs:
test:
strategy:
# Don't cancel test runs if one fails
fail-fast: false
# Run 4 jobs in parallel, each executing a subset of all tests
matrix:
node_index: [0, 1, 2, 3]
total_nodes: [4]

runs-on: ubuntu-latest
steps:
# Check out code and perform setup steps
# ...

- name: Test
run: npx ava
env:
CI_NODE_INDEX: ${{ matrix.node_index }}
CI_NODE_TOTAL: ${{ matrix.total_nodes }}
```