Skip to content

Commit f135967

Browse files
authored
use gotestsum for tests (#2336)
this shows only a concise summary for skipped and successful tests, but fully expands all failed tests with names
1 parent 56fabe8 commit f135967

File tree

3 files changed

+22
-14
lines changed

3 files changed

+22
-14
lines changed

.github/workflows/sanitizers.yaml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ permissions:
1818
contents: read
1919
env:
2020
GOTOOLCHAIN: local
21+
GOTESTSUM_FORMAT: pkgname-and-test-fails
2122
jobs:
2223
# Adapted from https://github.com/beberlei/hdrhistogram-php
2324
sanitizers:
@@ -102,13 +103,13 @@ jobs:
102103
run: echo "$(pwd)/php/target/bin" >> "$GITHUB_PATH"
103104
- name: Install e-dant/watcher
104105
uses: ./.github/actions/watcher
105-
- name: Set Set CGO flags
106+
- name: Install gotestsum
107+
run: go install gotest.tools/gotestsum@latest
108+
- name: Set CGO flags
106109
run: |
107110
{
108111
echo "CGO_CFLAGS=$CFLAGS -I${PWD}/watcher/target/include $(php-config --includes)"
109112
echo "CGO_LDFLAGS=$LDFLAGS $(php-config --ldflags) $(php-config --libs)"
110113
} >> "$GITHUB_ENV"
111-
- name: Compile tests
112-
run: go test ${{ matrix.sanitizer == 'msan' && '-tags=nowatcher' || '' }} -${{ matrix.sanitizer }} -v -x -c
113114
- name: Run tests
114-
run: ./frankenphp.test -test.v
115+
run: gotestsum -- ${{ matrix.sanitizer == 'msan' && '-tags=nowatcher' || '' }} -${{ matrix.sanitizer }} ./...

.github/workflows/tests.yaml

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ permissions:
1919
env:
2020
GOTOOLCHAIN: local
2121
GOEXPERIMENT: cgocheck2
22+
GOTESTSUM_FORMAT: pkgname-and-test-fails
2223
jobs:
2324
tests-linux:
2425
name: Tests (Linux, PHP ${{ matrix.php-versions }})
@@ -64,13 +65,13 @@ jobs:
6465
- name: Build testcli binary
6566
working-directory: internal/testcli/
6667
run: go build
67-
- name: Compile library tests
68-
run: go test -race -v -x -c
68+
- name: Install gotestsum
69+
run: go install gotest.tools/gotestsum@latest
6970
- name: Run library tests
70-
run: ./frankenphp.test -test.v
71+
run: gotestsum -- -race ./...
7172
- name: Run Caddy module tests
7273
working-directory: caddy/
73-
run: go test -race -v ./...
74+
run: gotestsum -- -race ./...
7475
- name: Run Fuzzing Tests
7576
working-directory: caddy/
7677
run: go test -fuzz FuzzRequest -fuzztime 20s
@@ -136,9 +137,11 @@ jobs:
136137
run: |
137138
echo "CGO_CFLAGS=$(php-config --includes)" >> "${GITHUB_ENV}"
138139
echo "CGO_LDFLAGS=$(php-config --ldflags) $(php-config --libs)" >> "${GITHUB_ENV}"
140+
- name: Install gotestsum
141+
run: go install gotest.tools/gotestsum@latest
139142
- name: Run integration tests
140143
working-directory: internal/extgen/
141-
run: go test -tags integration -v -timeout 30m
144+
run: gotestsum -- -tags integration -timeout 30m
142145
tests-mac:
143146
name: Tests (macOS, PHP 8.5)
144147
runs-on: macos-latest
@@ -164,7 +167,9 @@ jobs:
164167
env:
165168
phpts: ts
166169
debug: true
167-
- name: Set Set CGO flags
170+
- name: Install gotestsum
171+
run: go install gotest.tools/gotestsum@latest
172+
- name: Set CGO flags
168173
run: |
169174
{
170175
echo "CGO_CFLAGS=-I/opt/homebrew/include/ $(php-config --includes)"
@@ -173,7 +178,7 @@ jobs:
173178
- name: Build
174179
run: go build -tags nowatcher
175180
- name: Run library tests
176-
run: go test -tags nowatcher -race -v ./...
181+
run: gotestsum -- -tags nowatcher -race ./...
177182
- name: Run Caddy module tests
178183
working-directory: caddy/
179-
run: go test -race -v ./...
184+
run: gotestsum -- -race ./...

.github/workflows/windows.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ permissions:
3333

3434
env:
3535
GOTOOLCHAIN: local
36+
GOTESTSUM_FORMAT: pkgname-and-test-fails
3637
GOFLAGS: "-ldflags=-extldflags=-fuse-ld=lld -tags=nobadger,nomysql,nopgx"
3738
PHP_DOWNLOAD_BASE: "https://downloads.php.net/~windows/releases/"
3839
CC: clang
@@ -228,9 +229,10 @@ jobs:
228229
"opcache.enable=0`r`nopcache.enable_cli=0" | Out-File php.ini
229230
$env:PHPRC = Get-Location
230231
231-
go test -race ./...
232+
go install gotest.tools/gotestsum@latest
233+
gotestsum -- -race ./...
232234
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
233235
cd caddy
234-
go test -race ./...
236+
gotestsum -- -race ./...
235237
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
236238
working-directory: ${{ github.workspace }}\frankenphp

0 commit comments

Comments
 (0)