Skip to content
Draft
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
4 changes: 1 addition & 3 deletions .github/scripts/src/Dependency/Catalog.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,7 @@ public static function create(): self
'swoole',
'PHP_SWOOLE_VERSION',
'PHP_SWOOLE_COMMIT',
new Git('https://github.com/swoole/swoole-src.git'),
// Unlinks paths named by client Swoole-Upload-File part headers (swoole/swoole-src#6309).
['v6.2.4'],
new Git('https://github.com/appwrite-labs/swoole-rs.git'),
),
new Dependency(
'xdebug',
Expand Down
14 changes: 1 addition & 13 deletions .github/scripts/tests/Unit/Dependency/CatalogTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function test_uses_exact_dockerfile_sources(): void
'redis' => 'https://github.com/phpredis/phpredis.git',
'scrypt' => 'https://github.com/DomBlack/php-scrypt.git',
'snappy' => 'https://github.com/kjdev/php-ext-snappy.git',
'swoole' => 'https://github.com/swoole/swoole-src.git',
'swoole' => 'https://github.com/appwrite-labs/swoole-rs.git',
'xdebug' => 'https://github.com/xdebug/xdebug',
'yaml' => 'https://github.com/php/pecl-file_formats-yaml',
'zstd' => 'https://github.com/kjdev/php-ext-zstd.git',
Expand All @@ -80,18 +80,6 @@ public function test_uses_exact_dockerfile_sources(): void
self::assertSame(Catalog::PECL_RELEASES, $protobuf->source->url());
}

public function test_excludes_swoole_releases_that_unlink_upload_markers(): void
{
$excluded = [];
foreach (Catalog::create()->dependencies() as $dependency) {
if ($dependency->excluded !== []) {
$excluded[$dependency->name] = $dependency->excluded;
}
}

self::assertSame(['swoole' => ['v6.2.4']], $excluded);
}

public function test_source_definitions_are_immutable(): void
{
self::assertSame(true, (new ReflectionClass(Git::class))->isReadOnly());
Expand Down
39 changes: 0 additions & 39 deletions .github/scripts/tests/Unit/Dependency/StructureTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,45 +34,6 @@ public function test_structure_tests_hold_no_version_the_updater_rewrites(): voi
}
}

public function test_swoole_expectation_accepts_every_release_the_updater_selects(): void
{
$matched = preg_match(
"/- name: 'Swoole version'\\n(?:[ ]{4}[^\\n]*\\n)*?"
. "[ ]{4}expectedOutput:\\n[ ]{6}- '([^'\\n]+)'\\n/",
$this->read('tests.yaml'),
$expectation,
);
self::assertSame(1, $matched, 'tests.yaml must assert the Swoole version');
$pattern = '/' . str_replace('/', '\/', $expectation[1]) . '/';

$version = $this->versions()['swoole'];
$major = (int) $version->major;
$minor = (int) $version->minor;
$patch = (int) $version->patch;
$line = static fn (string $release): string => 'Extension [ <persistent> '
. "extension #46 swoole version {$release} ] {";

foreach ([
"{$major}.{$minor}.{$patch}",
"{$major}.{$minor}." . ($patch + 1),
"{$major}." . ($minor + 1) . '.0',
] as $release) {
self::assertSame(
1,
preg_match($pattern, $line($release)),
"Swoole {$release} must pass the structure test",
);
}

foreach ([($major + 1) . '.0.0', "{$major}.{$minor}.{$patch}-dev"] as $release) {
self::assertSame(
0,
preg_match($pattern, $line($release)),
"Swoole {$release} must fail the structure test",
);
}
}

/**
* @return array<string, Version>
*/
Expand Down
7 changes: 7 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# CHANGELOG

## Version 2.4.0

### Change

* Build Swoole from [appwrite-labs/swoole-rs](https://github.com/appwrite-labs/swoole-rs) v0.1.0, Swoole v6.2.5's PHP extension rewritten in Rust, in place of `swoole/swoole-src`. It reports itself as Swoole 6.2.5 and keeps the same switches: c-ares, mysqlnd, sockets, Brotli, zstd, OpenSSL, the curl hook and the coroutine pgsql driver. swoole-rs is experimental; its README covers what is and isn't proven.
* `PHP_SWOOLE_VERSION` is now a swoole-rs release, and the weekly updater follows swoole-rs's tags. The v6.2.4 exclusion goes with swoole-src. `tests-swoole.php` still guards the `Swoole-Upload-File` behaviour (swoole/swoole-src#6309).

## Version 2.3.0

### Remove
Expand Down
38 changes: 20 additions & 18 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ ENV \
PHP_SCRYPT_COMMIT="5a14bc766423dac3f868792fa8c41f85f47263ec" \
PHP_SNAPPY_VERSION="0.2.3" \
PHP_SNAPPY_COMMIT="d31b77d63955dbbf1a302ca13c4795292f91d140" \
PHP_SWOOLE_VERSION="v6.2.5" \
PHP_SWOOLE_COMMIT="76c657d88be39b7af6bf85e46bcbac0da7387760" \
PHP_SWOOLE_VERSION="v0.1.0" \
PHP_SWOOLE_COMMIT="34516580163686bb381c7f644185a226ca03de9a" \
PHP_YAML_VERSION="2.3.0" \
PHP_YAML_COMMIT="c1f0d8ba5ef3884846261bbdb91c2ab0b07db44c" \
PHP_ZSTD_VERSION="0.18.0" \
Expand Down Expand Up @@ -233,27 +233,29 @@ RUN docker-php-ext-configure gd \
/artifacts/pdo_pgsql.so \
/artifacts/sockets.so

# Built without --enable-swoole-stdext: stdext registers user opcode
# handlers, which makes opcache's JIT refuse to enable in downstream images.
# Swoole is appwrite-labs/swoole-rs: Swoole v6.2.5's PHP extension rewritten in
# Rust and built by Cargo, so PHP_SWOOLE_VERSION is a swoole-rs release while
# the extension reports 6.2.5. Brotli, zstd, OpenSSL and sockets are built in;
# the --configure switches are the rest of upstream's. Built without --stdext:
# stdext registers user opcode handlers, which makes opcache's JIT refuse to
# enable in downstream images. rust-toolchain.toml in the source picks Rust.
FROM compile AS swoole
RUN \
apk add --no-cache clang-dev pcre2-dev pkgconf python3 rustup && \
rustup-init -y --profile minimal --default-toolchain none && \
. "$HOME/.cargo/env" && \
git init swoole && \
cd swoole && \
git fetch --depth 1 https://github.com/swoole/swoole-src.git $PHP_SWOOLE_COMMIT && \
git fetch --depth 1 https://github.com/appwrite-labs/swoole-rs.git $PHP_SWOOLE_COMMIT && \
git checkout FETCH_HEAD && \
phpize && \
./configure \
--enable-brotli \
--enable-cares \
--enable-mysqlnd \
--enable-openssl \
--enable-sockets \
--enable-swoole-curl \
--enable-swoole-pgsql \
--enable-zstd \
--with-openssl-dir=/usr && \
make -j"$(nproc)" && make install && \
cp $(php-config --extension-dir)/swoole.so /artifacts/ && \
rustup toolchain install && \
RUSTFLAGS="-C target-feature=-crt-static" python3 tools/build_ext.py \
--php-sockets \
--configure=--enable-cares \
--configure=--enable-mysqlnd \
--configure=--enable-swoole-curl \
--configure=--enable-swoole-pgsql && \
cp target/ext/swoole.so /artifacts/ && \
strip /artifacts/swoole.so

# git-remote-entire, git's remote helper for entire:// URLs: Entire serves git
Expand Down
Loading