forked from scruplelesswizard/split-tests
-
Notifications
You must be signed in to change notification settings - Fork 0
42 lines (38 loc) · 1.25 KB
/
example.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
name: Example Workflow
on: push
env:
total-runners: 5
jobs:
runner-indexes:
runs-on: ubuntu-latest
name: Generate runner indexes
outputs:
json: ${{ steps.generate-index-list.outputs.json }}
steps:
- id: generate-index-list
run: |
MAX_INDEX=$((${{ env.total-runners }}-1))
INDEX_LIST=$(seq 0 ${MAX_INDEX})
INDEX_JSON=$(jq --null-input --compact-output '. |= [inputs]' <<< ${INDEX_LIST})
echo "::set-output name=json::${INDEX_JSON}"
run-parallel-tests:
runs-on: ubuntu-latest
name: "Runner #${{ matrix.runner-index }}: Run test suite in parallel"
needs:
- runner-indexes
strategy:
matrix:
runner-index: ${{ fromjson(needs.runner-indexes.outputs.json) }}
steps:
- uses: actions/checkout@v2
with:
repository: eliotsykes/rspec-rails-examples
path: examples/
- uses: chaosaffe/[email protected]
id: split-tests
name: Split tests
with:
glob: examples/spec/**/*_spec.rb
split-total: ${{ env.total-runners }}
split-index: ${{ matrix.runner-index }}
- run: 'echo "This runner will execute the following tests: ${{ steps.split-tests.outputs.test-suite }}"'