ci: use optional LIBRDKAFKA_LIBRARY_PATH in examples #91
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build macOS | |
on: | |
push: | |
pull_request: | |
jobs: | |
tests-macos: | |
name: Tests | |
runs-on: macos-latest | |
strategy: | |
fail-fast: true | |
matrix: | |
php: | |
- '8.1' | |
- '8.2' | |
- '8.3' | |
- '8.4' | |
defaults: | |
run: | |
shell: bash | |
env: | |
PHP_VERSION: ${{ matrix.php }} | |
KAFKA_BROKERS: localhost:9092 | |
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 | |
- name: Install latest librdkafka & kafka via brew | |
shell: bash | |
run: | | |
brew update | |
brew install librdkafka kafka | |
- name: Start Kafka | |
shell: bash | |
run: | | |
zookeeper-server-start -daemon /usr/local/etc/kafka/zookeeper.properties; | |
kafka-server-start -daemon /usr/local/etc/kafka/server.properties --override broker.id=111 --override advertised.listeners=${{ env.KAFKA_ADVERTISED_LISTENERS }}; | |
- name: Install PHP ${{ matrix.php }} | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
coverage: none | |
extensions: ffi, pcntl | |
ini-values: "${{ (matrix.php == '8.3' || matrix.php == '8.4') && 'zend.max_allowed_stack_size=256k' || '' }}" | |
- name: Install dependencies | |
uses: ramsey/composer-install@v2 | |
with: | |
composer-options: "--prefer-dist --prefer-stable" | |
- name: Run tests | |
run: | | |
composer test-init | |
composer test | |
- name: Stop kafka | |
run: | | |
kafka-server-stop; | |
zookeeper-server-stop; |