From f56b209d5cbeb7366c31ca9beda38ffc4d351e98 Mon Sep 17 00:00:00 2001 From: tianfenghan Date: Mon, 31 Aug 2026 15:43:36 +0800 Subject: [PATCH] fix(ci): include EXT/LIB integration fixtures --- {tests => .github}/integration/README.md | 5 +- .../ext/lifecycle/host/request.php | 57 +++++++++++++++++++ .../ext/lifecycle/src/extension.php | 24 ++++++++ .github/integration/lib/consumer/main.php | 16 ++++++ .../integration/lib/provider/project.yml | 0 .../integration/lib/provider/src/library.php | 29 ++++++++++ bin/run-integration-tests.php | 2 +- 7 files changed, 130 insertions(+), 3 deletions(-) rename {tests => .github}/integration/README.md (83%) create mode 100644 .github/integration/ext/lifecycle/host/request.php create mode 100644 .github/integration/ext/lifecycle/src/extension.php create mode 100644 .github/integration/lib/consumer/main.php rename {tests => .github}/integration/lib/provider/project.yml (100%) create mode 100644 .github/integration/lib/provider/src/library.php diff --git a/tests/integration/README.md b/.github/integration/README.md similarity index 83% rename from tests/integration/README.md rename to .github/integration/README.md index 986dd684..599bf906 100644 --- a/tests/integration/README.md +++ b/.github/integration/README.md @@ -1,7 +1,8 @@ # EXT/LIB integration tests -This suite protects build-mode boundaries rather than duplicating the PHP -syntax coverage in `tests/compiler`. +This suite lives below `.github` because repository test fixtures with a `.php` +suffix are intentionally ignored below `tests/`. It protects build-mode +boundaries rather than duplicating the PHP syntax coverage in `tests/compiler`. - `ext/lifecycle` builds a real Zend extension and loads it through CLI, `php -S`, and PHP-FPM. The long-running hosts alternate implementations of diff --git a/.github/integration/ext/lifecycle/host/request.php b/.github/integration/ext/lifecycle/host/request.php new file mode 100644 index 00000000..79aec680 --- /dev/null +++ b/.github/integration/ext/lifecycle/host/request.php @@ -0,0 +1,57 @@ +value; + } + } + + function typephp_integration_request_transform(string $value): string + { + return 'even-handler[' . $value . ']'; + } +} else { + final class TypePhpIntegrationRequestValue + { + public function __construct(private int $value) + { + } + + public function render(): string + { + return 'odd:' . $this->value; + } + } + + function typephp_integration_request_transform(string $value): string + { + return 'odd-handler[' . $value . ']'; + } +} + +header('Content-Type: application/json'); +echo json_encode([ + 'request' => $request, + 'results' => [ + typephp_integration_probe($request), + typephp_integration_probe($request), + ], + 'main_registered' => function_exists('main'), + 'pid' => getmypid(), +], JSON_THROW_ON_ERROR); diff --git a/.github/integration/ext/lifecycle/src/extension.php b/.github/integration/ext/lifecycle/src/extension.php new file mode 100644 index 00000000..271c80b0 --- /dev/null +++ b/.github/integration/ext/lifecycle/src/extension.php @@ -0,0 +1,24 @@ +format('U') . '|' + . typephp_integration_request_transform($value->render()); +} + +// main() belongs to the embedded bin entry path. An extension must neither +// register it as a PHP function nor invoke it from RINIT. +function main(): void +{ + throw new RuntimeException('ext mode invoked bin main()'); +} diff --git a/.github/integration/lib/consumer/main.php b/.github/integration/lib/consumer/main.php new file mode 100644 index 00000000..a8ef391a --- /dev/null +++ b/.github/integration/lib/consumer/main.php @@ -0,0 +1,16 @@ +add(3); + $counter->add(4); + echo 'counter=', $counter->value, "\n"; +} diff --git a/tests/integration/lib/provider/project.yml b/.github/integration/lib/provider/project.yml similarity index 100% rename from tests/integration/lib/provider/project.yml rename to .github/integration/lib/provider/project.yml diff --git a/.github/integration/lib/provider/src/library.php b/.github/integration/lib/provider/src/library.php new file mode 100644 index 00000000..62c7ce66 --- /dev/null +++ b/.github/integration/lib/provider/src/library.php @@ -0,0 +1,29 @@ +value += $delta; + } + } +} diff --git a/bin/run-integration-tests.php b/bin/run-integration-tests.php index ee9f3d29..24673048 100755 --- a/bin/run-integration-tests.php +++ b/bin/run-integration-tests.php @@ -13,7 +13,7 @@ use RuntimeException; use Throwable; const TYPEPHP_INTEGRATION_ROOT = __DIR__ . '/..'; -const TYPEPHP_INTEGRATION_TEST_ROOT = TYPEPHP_INTEGRATION_ROOT . '/tests/integration'; +const TYPEPHP_INTEGRATION_TEST_ROOT = TYPEPHP_INTEGRATION_ROOT . '/.github/integration'; final class IntegrationFailure extends RuntimeException {