Skip to content

Commit 5ae99d5

Browse files
committed
chore: Shard testscript tests
1 parent 5ffd538 commit 5ae99d5

File tree

1 file changed

+34
-5
lines changed

1 file changed

+34
-5
lines changed

.github/workflows/main.yml

+34-5
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,11 @@ jobs:
126126
export DOCKER_GOCACHE="$HOME/.go-archlinux"
127127
./assets/docker/test.sh archlinux
128128
test-macos:
129+
name: test-macos-${{ matrix.test-index }}
130+
strategy:
131+
fail-fast: false
132+
matrix:
133+
test-index: [0, 1, 2]
129134
needs: changes
130135
if: github.event_name == 'push' || needs.changes.outputs.code == 'true'
131136
runs-on: macos-15
@@ -159,7 +164,14 @@ jobs:
159164
env:
160165
CHEZMOI_GITHUB_TOKEN: ${{ secrets.CHEZMOI_GITHUB_TOKEN }}
161166
run: |
162-
go test -race ./...
167+
if [ "${{ matrix.test-index }}" = "0" ]; then
168+
go test ./... -short -race
169+
go test ./internal/cmd -run=TestScript -filter='^[0-9a-dA-D]' -race
170+
elif [ "${{ matrix.test-index }}" = "1" ]; then
171+
go test ./internal/cmd -run=TestScript -filter='^[e-iE-I]' -race
172+
else
173+
go test ./internal/cmd -run=TestScript -filter='^[j-zJ-Z]' -race
174+
fi
163175
test-oldstable-go:
164176
needs: changes
165177
if: github.event_name == 'push' || needs.changes.outputs.code == 'true'
@@ -257,13 +269,14 @@ jobs:
257269
name: chezmoi-windows-amd64
258270
path: dist/chezmoi-nocgo_windows_amd64_v1/chezmoi.exe
259271
test-ubuntu:
260-
name: test-ubuntu-umask${{ matrix.umask }}
272+
name: test-ubuntu-umask${{ matrix.umask }}-${{ matrix.test-index }}
261273
strategy:
262274
fail-fast: false
263275
matrix:
264276
umask:
265277
- "022"
266278
- "002"
279+
test-index: [0, 1]
267280
needs: changes
268281
runs-on: ubuntu-22.04
269282
permissions:
@@ -298,8 +311,14 @@ jobs:
298311
if: github.event_name == 'push' || needs.changes.outputs.code == 'true'
299312
env:
300313
CHEZMOI_GITHUB_TOKEN: ${{ secrets.CHEZMOI_GITHUB_TOKEN }}
301-
run: |
302-
go test -ldflags="-X github.com/twpayne/chezmoi/v2/internal/chezmoitest.umaskStr=0o${{ matrix.umask }}" -race -timeout=1h ./...
314+
TEST_FLAGS: '-ldflags="-X github.com/twpayne/chezmoi/v2/internal/chezmoitest.umaskStr=0o${{ matrix.umask }}" -race -timeout=1h'
315+
run: |
316+
if [ "${{ matrix.test-index }}" = "0" ]; then
317+
go test ./... -short ${{ env.TEST_FLAGS }}
318+
go test ./internal/cmd -run=TestScript -filter='^[0-9a-hA-h]' ${{ env.TEST_FLAGS }}
319+
else
320+
go test ./internal/cmd -run=TestScript -filter='^[i-zI-Z]' ${{ env.TEST_FLAGS }}
321+
fi
303322
test-website:
304323
runs-on: ubuntu-22.04
305324
permissions:
@@ -323,6 +342,11 @@ jobs:
323342
env:
324343
CHEZMOI_GITHUB_TOKEN: ${{ secrets.CHEZMOI_GITHUB_TOKEN }}
325344
test-windows:
345+
name: test-windows-${{ matrix.test-index }}
346+
strategy:
347+
fail-fast: false
348+
matrix:
349+
test-index: [0, 1]
326350
needs: changes
327351
if: github.event_name == 'push' || needs.changes.outputs.code == 'true'
328352
runs-on: windows-2022
@@ -343,7 +367,12 @@ jobs:
343367
env:
344368
CHEZMOI_GITHUB_TOKEN: ${{ secrets.CHEZMOI_GITHUB_TOKEN }}
345369
run: |
346-
go test -race ./...
370+
if (${{ matrix.test-index }} -eq 0) {
371+
go test ./... -short -race
372+
go test ./internal/cmd -run=TestScript -filter='^[0-9a-hA-h]' -race
373+
} else {
374+
go test ./internal/cmd -run=TestScript -filter='^[i-zI-Z]' -race
375+
}
347376
check:
348377
runs-on: ubuntu-22.04
349378
permissions:

0 commit comments

Comments
 (0)