Skip to content

Commit 8cc248f

Browse files
feat(extgen): add integration tests
1 parent 12d4c3d commit 8cc248f

File tree

9 files changed

+706
-2
lines changed

9 files changed

+706
-2
lines changed

.github/workflows/tests.yaml

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,49 @@ jobs:
9393
if: matrix.php-versions == '8.5'
9494
run: go mod tidy -diff
9595
working-directory: caddy/
96+
integration-tests:
97+
name: Integration Tests (Linux, PHP ${{ matrix.php-versions }})
98+
runs-on: ubuntu-latest
99+
strategy:
100+
fail-fast: false
101+
matrix:
102+
php-versions: ["8.3", "8.4"]
103+
steps:
104+
- uses: actions/checkout@v5
105+
with:
106+
persist-credentials: false
107+
- uses: actions/setup-go@v6
108+
with:
109+
go-version: "1.25"
110+
cache-dependency-path: |
111+
go.sum
112+
caddy/go.sum
113+
- uses: shivammathur/setup-php@v2
114+
with:
115+
php-version: ${{ matrix.php-versions }}
116+
ini-file: development
117+
coverage: none
118+
tools: none
119+
env:
120+
phpts: ts
121+
debug: true
122+
- name: Install PHP development libraries
123+
run: sudo apt-get update && sudo apt-get install -y libkrb5-dev libsodium-dev libargon2-dev
124+
- name: Install xcaddy
125+
run: go install github.com/caddyserver/xcaddy/cmd/xcaddy@latest
126+
- name: Download PHP sources
127+
run: |
128+
PHP_VERSION=$(php -r "echo PHP_VERSION;")
129+
wget -q "https://www.php.net/distributions/php-${PHP_VERSION}.tar.gz"
130+
tar xzf "php-${PHP_VERSION}.tar.gz"
131+
echo "GEN_STUB_SCRIPT=${PWD}/php-${PHP_VERSION}/build/gen_stub.php" >> "${GITHUB_ENV}"
132+
- name: Set CGO flags
133+
run: |
134+
echo "CGO_CFLAGS=$(php-config --includes)" >> "${GITHUB_ENV}"
135+
echo "CGO_LDFLAGS=$(php-config --ldflags) $(php-config --libs)" >> "${GITHUB_ENV}"
136+
- name: Run integration tests
137+
working-directory: internal/extgen/
138+
run: go test -tags integration -v -timeout 30m
96139
tests-mac:
97140
name: Tests (macOS, PHP 8.5)
98141
runs-on: macos-latest
@@ -106,7 +149,7 @@ jobs:
106149
with:
107150
go-version: "1.25"
108151
cache-dependency-path: |
109-
go.sum
152+
go.sum
110153
caddy/go.sum
111154
- uses: shivammathur/setup-php@v2
112155
with:

internal/extgen/arginfo.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ func (ag *arginfoGenerator) generate() error {
2929
output, err := cmd.CombinedOutput()
3030
if err != nil {
3131
log.Print("gen_stub.php output:\n", string(output))
32-
return fmt.Errorf("running gen_stub script: %w", err)
32+
return fmt.Errorf("running gen_stub script: %w\nOutput: %s", err, string(output))
3333
}
3434

3535
return ag.fixArginfoFile(stubFile)

0 commit comments

Comments
 (0)