From d2576c2dd792f0e2704492eea24feb0b79caee23 Mon Sep 17 00:00:00 2001 From: Dirk Adler Date: Mon, 28 Oct 2024 19:27:12 +0100 Subject: [PATCH] ci: set LIBRDKAFKA_LIBRARY_PATH for macOS --- .github/workflows/test-macos.yml | 1 + resources/phpunit/bootstrap.php | 2 +- resources/phpunit/config.php | 1 + tests/RdKafka/FFI/LibraryPreloadTest.php | 10 +++++++--- tests/RdKafka/FFI/LibraryTest.php | 6 +++++- 5 files changed, 15 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test-macos.yml b/.github/workflows/test-macos.yml index c912f397..3597a3f7 100644 --- a/.github/workflows/test-macos.yml +++ b/.github/workflows/test-macos.yml @@ -25,6 +25,7 @@ jobs: COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH }} GH_TOKEN: ${{ secrets.GH_TOKEN }} KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://localhost:9092 + LIBRDKAFKA_LIBRARY_PATH: /opt/homebrew/lib/librdkafka.dylib steps: - name: Checkout uses: actions/checkout@v4 diff --git a/resources/phpunit/bootstrap.php b/resources/phpunit/bootstrap.php index 146cf6a7..2d0c88fb 100644 --- a/resources/phpunit/bootstrap.php +++ b/resources/phpunit/bootstrap.php @@ -10,4 +10,4 @@ $version = getenv('LIBRDKAFKA_VERSION') ?: ''; $version = ltrim($version, 'v'); $version = $version === 'master' ? Library::VERSION_LATEST : $version; -Library::init($version); +Library::init($version, 'RdKafka', LIBRDKAFKA_LIBRARY_PATH); diff --git a/resources/phpunit/config.php b/resources/phpunit/config.php index 289348c6..45ab2f47 100644 --- a/resources/phpunit/config.php +++ b/resources/phpunit/config.php @@ -1,5 +1,6 @@ expectException(\FFI\Exception::class); - Library::preload(Library::getLibraryVersion(), 'Any', null, 'invalid'); + Library::preload(Library::getLibraryVersion(), __METHOD__, LIBRDKAFKA_LIBRARY_PATH, 'invalid'); } /** @@ -33,7 +37,7 @@ public function testPreloadWithInvalidCdef(): void */ public function testPreload(): void { - $ffi = Library::preload(); + $ffi = Library::preload(Library::getLibraryVersion(), __METHOD__, LIBRDKAFKA_LIBRARY_PATH); $this->assertInstanceOf(FFI::class, $ffi); $this->assertMatchesRegularExpression('/^\d+\.\d+\./', $ffi->rd_kafka_version_str()); diff --git a/tests/RdKafka/FFI/LibraryTest.php b/tests/RdKafka/FFI/LibraryTest.php index 235d4a6d..a7baf778 100644 --- a/tests/RdKafka/FFI/LibraryTest.php +++ b/tests/RdKafka/FFI/LibraryTest.php @@ -20,7 +20,11 @@ class LibraryTest extends TestCase protected function tearDown(): void { - Library::init(); + Library::init( + Library::VERSION_AUTODETECT, + 'RdKafka', + LIBRDKAFKA_LIBRARY_PATH + ); } public function testGetFFI(): void