Skip to content

Commit c316dcc

Browse files
authored
Merge pull request #624 from TypedDevs/ci/optimize-tests-workflow
ci(tests): optimize workflow jobs and windows shards
2 parents 8e128ec + 1b0699d commit c316dcc

1 file changed

Lines changed: 32 additions & 89 deletions

File tree

.github/workflows/tests.yml

Lines changed: 32 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,23 @@ concurrency:
1818

1919
jobs:
2020
ubuntu:
21-
name: "Ubuntu - latest"
21+
name: "Ubuntu - ${{ matrix.name }}"
2222
runs-on: ubuntu-latest
2323
timeout-minutes: 10
24+
strategy:
25+
fail-fast: false
26+
matrix:
27+
include:
28+
- name: "make test"
29+
command: "make test"
30+
- name: "simple"
31+
command: "./bashunit --simple tests/"
32+
- name: "parallel simple"
33+
command: "./bashunit --parallel --simple tests/"
34+
- name: "parallel extended"
35+
command: "./bashunit --parallel tests/"
36+
- name: "strict"
37+
command: "./bashunit --parallel --simple --strict tests/"
2438
steps:
2539
- name: Checkout
2640
uses: actions/checkout@v4
@@ -31,7 +45,7 @@ jobs:
3145
run: cp .env.example .env
3246

3347
- name: Run Tests
34-
run: make test
48+
run: ${{ matrix.command }}
3549

3650
localized-ubuntu:
3751
name: "Ubuntu - ${{ matrix.name }} Locale"
@@ -92,25 +106,25 @@ jobs:
92106
run: make test
93107

94108
windows:
95-
name: "On windows (${{ matrix.name }})"
109+
name: "Windows - ${{ matrix.name }}"
96110
timeout-minutes: 10
97111
runs-on: windows-latest
98112
strategy:
113+
fail-fast: false
99114
matrix:
100115
include:
101-
- name: functional
116+
- name: "functional"
102117
test_path: "tests/functional/*_test.sh"
103118
- name: "unit a-b"
104119
test_path: "tests/unit/[a-b]*_test.sh"
105-
- name: "unit c"
106-
test_path: "tests/unit/ch*_test.sh tests/unit/cl*_test.sh tests/unit/console*_test.sh tests/unit/cu*_test.sh"
107-
- name: "unit coverage"
108-
test_path: "tests/unit/coverage_*_test.sh"
109-
- name: "unit d-p"
110-
test_path: "tests/unit/[d-p]*_test.sh"
120+
- name: "unit c + coverage"
121+
test_path: "tests/unit/ch*_test.sh tests/unit/cl*_test.sh tests/unit/console*_test.sh tests/unit/cu*_test.sh tests/unit/coverage_*_test.sh"
122+
- name: "unit d-g"
123+
test_path: "tests/unit/[d-g]*_test.sh"
124+
- name: "unit h-p"
125+
test_path: "tests/unit/[h-p]*_test.sh"
111126
- name: "unit r-z"
112127
test_path: "tests/unit/[r-z]*_test.sh"
113-
fail-fast: false
114128
steps:
115129
- name: Checkout code
116130
uses: actions/checkout@v4
@@ -123,24 +137,22 @@ jobs:
123137

124138
- name: Run tests
125139
shell: bash
126-
run: |
127-
./bashunit --parallel --jobs 4 ${{ matrix.test_path }}
140+
run: ./bashunit --parallel --jobs 4 ${{ matrix.test_path }}
128141

129142
windows-acceptance:
130-
name: "On windows (${{ matrix.name }})"
131143
if: github.event_name == 'push'
132144
timeout-minutes: 10
133145
runs-on: windows-latest
134146
strategy:
147+
fail-fast: false
135148
matrix:
136149
include:
137-
- name: "acceptance a-e"
150+
- name: "a-e"
138151
test_path: "tests/acceptance/bashunit_[a-e]*_test.sh"
139-
- name: "acceptance f-l"
152+
- name: "f-l"
140153
test_path: "tests/acceptance/bashunit_[f-l]*_test.sh"
141-
- name: "acceptance m-z"
154+
- name: "m-z"
142155
test_path: "tests/acceptance/bashunit_[m-z]*_test.sh tests/acceptance/[i-p]*_test.sh"
143-
fail-fast: false
144156
steps:
145157
- name: Checkout code
146158
uses: actions/checkout@v4
@@ -153,11 +165,10 @@ jobs:
153165

154166
- name: Run tests
155167
shell: bash
156-
run: |
157-
./bashunit --parallel --jobs 4 ${{ matrix.test_path }}
168+
run: ./bashunit --parallel --jobs 4 ${{ matrix.test_path }}
158169

159170
alpine:
160-
name: "On alpine-latest"
171+
name: "Alpine - latest"
161172
runs-on: ubuntu-latest
162173
timeout-minutes: 10
163174
steps:
@@ -177,71 +188,3 @@ jobs:
177188
adduser -D builder && \
178189
chown -R builder /project && \
179190
su - builder -c 'cd /project; make test';"
180-
181-
simple-output:
182-
name: "Simple output"
183-
runs-on: ubuntu-latest
184-
timeout-minutes: 10
185-
steps:
186-
- name: Checkout
187-
uses: actions/checkout@v4
188-
with:
189-
fetch-depth: 1
190-
191-
- name: Setup Config
192-
run: cp .env.example .env
193-
194-
- name: Run Tests
195-
run: |
196-
./bashunit --simple tests/
197-
198-
simple-output-parallel:
199-
name: "Simple output in parallel"
200-
runs-on: ubuntu-latest
201-
timeout-minutes: 10
202-
steps:
203-
- name: Checkout
204-
uses: actions/checkout@v4
205-
with:
206-
fetch-depth: 1
207-
208-
- name: Setup Config
209-
run: cp .env.example .env
210-
211-
- name: Run Tests
212-
run: |
213-
./bashunit --parallel --simple tests/
214-
215-
extended-output-parallel:
216-
name: "Extended output in parallel"
217-
runs-on: ubuntu-latest
218-
timeout-minutes: 10
219-
steps:
220-
- name: Checkout
221-
uses: actions/checkout@v4
222-
with:
223-
fetch-depth: 1
224-
225-
- name: Setup Config
226-
run: cp .env.example .env
227-
228-
- name: Run Tests
229-
run: |
230-
./bashunit --parallel tests/
231-
232-
strict-mode:
233-
name: "Strict mode"
234-
runs-on: ubuntu-latest
235-
timeout-minutes: 10
236-
steps:
237-
- name: Checkout
238-
uses: actions/checkout@v4
239-
with:
240-
fetch-depth: 1
241-
242-
- name: Setup Config
243-
run: cp .env.example .env
244-
245-
- name: Run Tests with strict mode
246-
run: |
247-
./bashunit --parallel --simple --strict tests/

0 commit comments

Comments
 (0)