Skip to content

Commit dd92852

Browse files
feat(extgen): add integration tests
1 parent 49e98cc commit dd92852

File tree

9 files changed

+708
-2
lines changed

9 files changed

+708
-2
lines changed

.github/workflows/tests.yaml

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