To chunk your Pest tests so that each node runs a portion of the entire suite successfully, you can make use of the --filter option provided by Pest.
Here's how you can modify your GitHub Actions workflow to achieve this:
name: pest
on:
push:
branches:
- main
jobs:
test:
name: Run tests
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ci_node_total: [4]
ci_node_index: [0, 1, 2, 3]
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install dependencies
run: composer install
- name: Run tests
run: ./vendor/bin/pest --filter "ci_node_index == ${{ matrix.ci_node_index }}" --parallel
With this configuration, each node will run a portion of the entire test suite based on its ci_node_index. The --filter option filters the tests based on the condition ci_node_index == ${{ matrix.ci_node_index }}, ensuring that each node only runs the relevant tests.
Make sure to update your workflow file with the above configuration and commit it to your repository.