use gotestsum for tests (#2336)

this shows only a concise summary for skipped and successful tests, but
fully expands all failed tests with names
This commit is contained in:
Marc
2026-04-09 16:27:21 +07:00
committed by GitHub
parent 56fabe8de3
commit f1359679cf
3 changed files with 22 additions and 14 deletions
+5 -4
View File
@@ -18,6 +18,7 @@ permissions:
contents: read
env:
GOTOOLCHAIN: local
GOTESTSUM_FORMAT: pkgname-and-test-fails
jobs:
# Adapted from https://github.com/beberlei/hdrhistogram-php
sanitizers:
@@ -102,13 +103,13 @@ jobs:
run: echo "$(pwd)/php/target/bin" >> "$GITHUB_PATH"
- name: Install e-dant/watcher
uses: ./.github/actions/watcher
- name: Set Set CGO flags
- name: Install gotestsum
run: go install gotest.tools/gotestsum@latest
- name: Set CGO flags
run: |
{
echo "CGO_CFLAGS=$CFLAGS -I${PWD}/watcher/target/include $(php-config --includes)"
echo "CGO_LDFLAGS=$LDFLAGS $(php-config --ldflags) $(php-config --libs)"
} >> "$GITHUB_ENV"
- name: Compile tests
run: go test ${{ matrix.sanitizer == 'msan' && '-tags=nowatcher' || '' }} -${{ matrix.sanitizer }} -v -x -c
- name: Run tests
run: ./frankenphp.test -test.v
run: gotestsum -- ${{ matrix.sanitizer == 'msan' && '-tags=nowatcher' || '' }} -${{ matrix.sanitizer }} ./...
+13 -8
View File
@@ -19,6 +19,7 @@ permissions:
env:
GOTOOLCHAIN: local
GOEXPERIMENT: cgocheck2
GOTESTSUM_FORMAT: pkgname-and-test-fails
jobs:
tests-linux:
name: Tests (Linux, PHP ${{ matrix.php-versions }})
@@ -64,13 +65,13 @@ jobs:
- name: Build testcli binary
working-directory: internal/testcli/
run: go build
- name: Compile library tests
run: go test -race -v -x -c
- name: Install gotestsum
run: go install gotest.tools/gotestsum@latest
- name: Run library tests
run: ./frankenphp.test -test.v
run: gotestsum -- -race ./...
- name: Run Caddy module tests
working-directory: caddy/
run: go test -race -v ./...
run: gotestsum -- -race ./...
- name: Run Fuzzing Tests
working-directory: caddy/
run: go test -fuzz FuzzRequest -fuzztime 20s
@@ -136,9 +137,11 @@ jobs:
run: |
echo "CGO_CFLAGS=$(php-config --includes)" >> "${GITHUB_ENV}"
echo "CGO_LDFLAGS=$(php-config --ldflags) $(php-config --libs)" >> "${GITHUB_ENV}"
- name: Install gotestsum
run: go install gotest.tools/gotestsum@latest
- name: Run integration tests
working-directory: internal/extgen/
run: go test -tags integration -v -timeout 30m
run: gotestsum -- -tags integration -timeout 30m
tests-mac:
name: Tests (macOS, PHP 8.5)
runs-on: macos-latest
@@ -164,7 +167,9 @@ jobs:
env:
phpts: ts
debug: true
- name: Set Set CGO flags
- name: Install gotestsum
run: go install gotest.tools/gotestsum@latest
- name: Set CGO flags
run: |
{
echo "CGO_CFLAGS=-I/opt/homebrew/include/ $(php-config --includes)"
@@ -173,7 +178,7 @@ jobs:
- name: Build
run: go build -tags nowatcher
- name: Run library tests
run: go test -tags nowatcher -race -v ./...
run: gotestsum -- -tags nowatcher -race ./...
- name: Run Caddy module tests
working-directory: caddy/
run: go test -race -v ./...
run: gotestsum -- -race ./...
+4 -2
View File
@@ -33,6 +33,7 @@ permissions:
env:
GOTOOLCHAIN: local
GOTESTSUM_FORMAT: pkgname-and-test-fails
GOFLAGS: "-ldflags=-extldflags=-fuse-ld=lld -tags=nobadger,nomysql,nopgx"
PHP_DOWNLOAD_BASE: "https://downloads.php.net/~windows/releases/"
CC: clang
@@ -228,9 +229,10 @@ jobs:
"opcache.enable=0`r`nopcache.enable_cli=0" | Out-File php.ini
$env:PHPRC = Get-Location
go test -race ./...
go install gotest.tools/gotestsum@latest
gotestsum -- -race ./...
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
cd caddy
go test -race ./...
gotestsum -- -race ./...
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
working-directory: ${{ github.workspace }}\frankenphp