Skip to content

Commit c5e07e0

Browse files
committed
ci(tests): optimize workflow jobs and windows shards
Consolidate 5 standalone Ubuntu full-suite jobs into a single matrix. Rebalance Windows shards (6 to 5) by merging `unit c` with `unit coverage`. Rename Windows jobs to remove name collision between `windows` and `windows-acceptance` (the skipped job on PRs now shows a clean label). Keep acceptance matrix push-only.
1 parent b0a3e79 commit c5e07e0

File tree

1 file changed

+59
-81
lines changed

1 file changed

+59
-81
lines changed

.github/workflows/tests.yml

Lines changed: 59 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,39 @@ name: Tests
22

33
on:
44
pull_request:
5+
paths-ignore:
6+
- 'docs/**'
7+
- 'adrs/**'
8+
- '**/*.md'
9+
- '.github/ISSUE_TEMPLATE/**'
10+
- '.github/PULL_REQUEST_TEMPLATE.md'
511
push:
612
branches:
713
- main
814

15+
concurrency:
16+
group: tests-${{ github.workflow }}-${{ github.ref }}
17+
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
18+
919
jobs:
1020
ubuntu:
11-
name: "Ubuntu - latest"
21+
name: "Ubuntu - ${{ matrix.name }}"
1222
runs-on: ubuntu-latest
1323
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/"
1438
steps:
1539
- name: Checkout
1640
uses: actions/checkout@v4
@@ -21,7 +45,7 @@ jobs:
2145
run: cp .env.example .env
2246

2347
- name: Run Tests
24-
run: make test
48+
run: ${{ matrix.command }}
2549

2650
localized-ubuntu:
2751
name: "Ubuntu - ${{ matrix.name }} Locale"
@@ -82,29 +106,23 @@ jobs:
82106
run: make test
83107

84108
windows:
85-
name: "On windows (${{ matrix.name }})"
109+
name: "Windows - ${{ matrix.name }}"
86110
timeout-minutes: 10
87111
runs-on: windows-latest
88112
strategy:
113+
fail-fast: false
89114
matrix:
90115
include:
91-
- name: "acceptance a-l"
92-
test_path: "tests/acceptance/bashunit_[a-l]*_test.sh"
93-
- name: "acceptance m-z"
94-
test_path: "tests/acceptance/bashunit_[m-z]*_test.sh tests/acceptance/[i-p]*_test.sh"
95-
- name: functional
116+
- name: "functional"
96117
test_path: "tests/functional/*_test.sh"
97118
- name: "unit a-b"
98119
test_path: "tests/unit/[a-b]*_test.sh"
99-
- name: "unit c"
100-
test_path: "tests/unit/ch*_test.sh tests/unit/cl*_test.sh tests/unit/console*_test.sh tests/unit/cu*_test.sh"
101-
- name: "unit coverage"
102-
test_path: "tests/unit/coverage_*_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"
103122
- name: "unit d-p"
104123
test_path: "tests/unit/[d-p]*_test.sh"
105124
- name: "unit r-z"
106125
test_path: "tests/unit/[r-z]*_test.sh"
107-
fail-fast: false
108126
steps:
109127
- name: Checkout code
110128
uses: actions/checkout@v4
@@ -117,67 +135,39 @@ jobs:
117135

118136
- name: Run tests
119137
shell: bash
120-
run: |
121-
./bashunit --parallel ${{ matrix.test_path }}
122-
123-
alpine:
124-
name: "On alpine-latest"
125-
runs-on: ubuntu-latest
126-
timeout-minutes: 10
127-
steps:
128-
- name: Checkout
129-
uses: actions/checkout@v4
130-
with:
131-
fetch-depth: 1
132-
133-
- name: Setup Config
134-
run: cp .env.example .env
135-
136-
- name: Run Tests
137-
run: |
138-
docker run --rm -v "$(pwd)":/project alpine:latest /bin/sh -c " \
139-
apk update && \
140-
apk add --no-cache bash make git jq && \
141-
adduser -D builder && \
142-
chown -R builder /project && \
143-
su - builder -c 'cd /project; make test';"
138+
run: ./bashunit --parallel --jobs 4 ${{ matrix.test_path }}
144139

145-
simple-output:
146-
name: "Simple output"
147-
runs-on: ubuntu-latest
148-
timeout-minutes: 10
149-
steps:
150-
- name: Checkout
151-
uses: actions/checkout@v4
152-
with:
153-
fetch-depth: 1
154-
155-
- name: Setup Config
156-
run: cp .env.example .env
157-
158-
- name: Run Tests
159-
run: |
160-
./bashunit --simple tests/
161-
162-
simple-output-parallel:
163-
name: "Simple output in parallel"
164-
runs-on: ubuntu-latest
140+
windows-acceptance:
141+
name: "Windows acceptance - ${{ matrix.name }}"
142+
if: github.event_name == 'push'
165143
timeout-minutes: 10
144+
runs-on: windows-latest
145+
strategy:
146+
fail-fast: false
147+
matrix:
148+
include:
149+
- name: "a-e"
150+
test_path: "tests/acceptance/bashunit_[a-e]*_test.sh"
151+
- name: "f-l"
152+
test_path: "tests/acceptance/bashunit_[f-l]*_test.sh"
153+
- name: "m-z"
154+
test_path: "tests/acceptance/bashunit_[m-z]*_test.sh tests/acceptance/[i-p]*_test.sh"
166155
steps:
167-
- name: Checkout
156+
- name: Checkout code
168157
uses: actions/checkout@v4
169158
with:
170159
fetch-depth: 1
171160

172161
- name: Setup Config
162+
shell: bash
173163
run: cp .env.example .env
174164

175-
- name: Run Tests
176-
run: |
177-
./bashunit --parallel --simple tests/
165+
- name: Run tests
166+
shell: bash
167+
run: ./bashunit --parallel --jobs 4 ${{ matrix.test_path }}
178168

179-
extended-output-parallel:
180-
name: "Extended output in parallel"
169+
alpine:
170+
name: "Alpine - latest"
181171
runs-on: ubuntu-latest
182172
timeout-minutes: 10
183173
steps:
@@ -191,21 +181,9 @@ jobs:
191181

192182
- name: Run Tests
193183
run: |
194-
./bashunit --parallel tests/
195-
196-
strict-mode:
197-
name: "Strict mode"
198-
runs-on: ubuntu-latest
199-
timeout-minutes: 10
200-
steps:
201-
- name: Checkout
202-
uses: actions/checkout@v4
203-
with:
204-
fetch-depth: 1
205-
206-
- name: Setup Config
207-
run: cp .env.example .env
208-
209-
- name: Run Tests with strict mode
210-
run: |
211-
./bashunit --parallel --simple --strict tests/
184+
docker run --rm -v "$(pwd)":/project alpine:latest /bin/sh -c " \
185+
apk update && \
186+
apk add --no-cache bash make git jq && \
187+
adduser -D builder && \
188+
chown -R builder /project && \
189+
su - builder -c 'cd /project; make test';"

0 commit comments

Comments
 (0)