Skip to content
This repository was archived by the owner on Oct 27, 2025. It is now read-only.

Commit d2576c2

Browse files
committed
ci: set LIBRDKAFKA_LIBRARY_PATH for macOS
1 parent b390a32 commit d2576c2

File tree

5 files changed

+15
-5
lines changed

5 files changed

+15
-5
lines changed

.github/workflows/test-macos.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ jobs:
2525
COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH }}
2626
GH_TOKEN: ${{ secrets.GH_TOKEN }}
2727
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://localhost:9092
28+
LIBRDKAFKA_LIBRARY_PATH: /opt/homebrew/lib/librdkafka.dylib
2829
steps:
2930
- name: Checkout
3031
uses: actions/checkout@v4

resources/phpunit/bootstrap.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@
1010
$version = getenv('LIBRDKAFKA_VERSION') ?: '';
1111
$version = ltrim($version, 'v');
1212
$version = $version === 'master' ? Library::VERSION_LATEST : $version;
13-
Library::init($version);
13+
Library::init($version, 'RdKafka', LIBRDKAFKA_LIBRARY_PATH);

resources/phpunit/config.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?php
22

3+
define('LIBRDKAFKA_LIBRARY_PATH', getenv('LIBRDKAFKA_LIBRARY_PATH') ?: null);
34
define('KAFKA_BROKERS', getenv('KAFKA_BROKERS') ?: 'kafka:9092');
45
const KAFKA_TEST_TOPIC = "test";
56
const KAFKA_TEST_TOPIC_ADMIN = "test_admin";

tests/RdKafka/FFI/LibraryPreloadTest.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,25 @@ class LibraryPreloadTest extends TestCase
1919

2020
protected function tearDown(): void
2121
{
22-
Library::init();
22+
Library::init(
23+
Library::VERSION_AUTODETECT,
24+
'RdKafka',
25+
LIBRDKAFKA_LIBRARY_PATH
26+
);
2327
}
2428

2529
public function testPreloadWithInvalidCdef(): void
2630
{
2731
$this->expectException(\FFI\Exception::class);
28-
Library::preload(Library::getLibraryVersion(), 'Any', null, 'invalid');
32+
Library::preload(Library::getLibraryVersion(), __METHOD__, LIBRDKAFKA_LIBRARY_PATH, 'invalid');
2933
}
3034

3135
/**
3236
* @depends testPreloadWithInvalidCdef
3337
*/
3438
public function testPreload(): void
3539
{
36-
$ffi = Library::preload();
40+
$ffi = Library::preload(Library::getLibraryVersion(), __METHOD__, LIBRDKAFKA_LIBRARY_PATH);
3741

3842
$this->assertInstanceOf(FFI::class, $ffi);
3943
$this->assertMatchesRegularExpression('/^\d+\.\d+\./', $ffi->rd_kafka_version_str());

tests/RdKafka/FFI/LibraryTest.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,11 @@ class LibraryTest extends TestCase
2020

2121
protected function tearDown(): void
2222
{
23-
Library::init();
23+
Library::init(
24+
Library::VERSION_AUTODETECT,
25+
'RdKafka',
26+
LIBRDKAFKA_LIBRARY_PATH
27+
);
2428
}
2529

2630
public function testGetFFI(): void

0 commit comments

Comments
 (0)