diff --git a/.github/docker/Dockerfile.pecl-alpine b/.github/docker/Dockerfile.pecl-alpine new file mode 100644 index 000000000..fd5889d6c --- /dev/null +++ b/.github/docker/Dockerfile.pecl-alpine @@ -0,0 +1,15 @@ +FROM php:alpine + +RUN apk add --no-cache \ + autoconf \ + build-base \ + openssl-dev + +COPY mongodb-*.tgz /tmp/mongodb.tgz + +# Install from the PECL package (fresh configure+build in a temp directory, +# same as a real user install, but without zstd available) +RUN pecl install --nodeps /tmp/mongodb.tgz < /dev/null + +# Verify the extension loads correctly +RUN php -n -d extension=mongodb.so --ri mongodb diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 078bcdd3a..ee3687805 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -130,6 +130,11 @@ jobs: - name: "Install release archive to verify correctness" run: sudo pecl install ${{ env.PACKAGE_FILE }} + - name: "Install on Alpine Linux" + run: | + cp "${{ env.PACKAGE_FILE }}" .github/docker/ + docker build .github/docker/ -f .github/docker/Dockerfile.pecl-alpine + windows-test: name: "Windows Tests" runs-on: "${{ matrix.os }}" diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 89e1c2edb..155d3bad6 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -28,6 +28,23 @@ will report `phpinfo()` output for the extension: $ php --ri mongodb ``` +## Testing the PECL package on Alpine Linux + +Alpine Linux uses musl libc instead of glibc and does not include zstd by default. It is +a popular base image for PHP Docker containers and represents a distinct build environment +from RHEL/Debian. Testing PECL installation on Alpine catches issues that would not appear +on glibc-based systems, such as missing POSIX extensions (e.g. `GLOB_BRACE`) or generated +config headers that are incorrectly bundled in the package. + +First generate the PECL package, then test installation on Alpine: + +``` +make package.xml RELEASE_NOTES_FILE=/dev/null +make package +cp mongodb-*.tgz .github/docker/ +docker build .github/docker/ -f .github/docker/Dockerfile.pecl-alpine +``` + ## Generating arginfo from stub files Arginfo structures are generated from stub files using the `gen_stub.php` diff --git a/bin/prep-release.php b/bin/prep-release.php index 7ca4b6950..494cbee83 100644 --- a/bin/prep-release.php +++ b/bin/prep-release.php @@ -1,4 +1,9 @@ array( - "Vagrantfile", - "scripts/*/*.{sh}", "scripts/*.{json,php,py,sh}", "tests/utils/*.{inc,json.gz,php}", @@ -92,7 +95,7 @@ function get_files() { $files = array(); foreach($dirs as $role => $patterns) { foreach ($patterns as $pattern) { - foreach (glob($pattern, GLOB_BRACE) as $file) { + foreach (glob($pattern, GLOB_BRACE) ?: [] as $file) { $files[$file] = $role; } } @@ -215,4 +218,3 @@ function usage() { file_put_contents(__DIR__ . "/../package.xml", $contents); echo "Wrote package.xml\n"; -