Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .github/docker/Dockerfile.pecl-alpine
Original file line number Diff line number Diff line change
@@ -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
5 changes: 5 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}"
Expand Down
17 changes: 17 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
10 changes: 6 additions & 4 deletions bin/prep-release.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
<?php
if (!defined('GLOB_BRACE')) {
echo "Error: GLOB_BRACE is not available on this system\n";
exit(1);
}

function verify_stability($stability) {
$stabilities = array(
"snapshot",
Expand Down Expand Up @@ -74,8 +79,6 @@ function get_files() {
"src/libmongocrypt/kms-message/src/kms_message/*.{c,h}",
),
'test' => array(
"Vagrantfile",

"scripts/*/*.{sh}",
"scripts/*.{json,php,py,sh}",
"tests/utils/*.{inc,json.gz,php}",
Expand All @@ -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;
}
}
Expand Down Expand Up @@ -215,4 +218,3 @@ function usage() {

file_put_contents(__DIR__ . "/../package.xml", $contents);
echo "Wrote package.xml\n";

Loading