Skip to content

Commit

Permalink
Update lib support (#59)
Browse files Browse the repository at this point in the history
Add support to

- Laravel 10
- Laravel 11
- PHP 8.2
- PHP 8.3

Co-authored-by: Victor Pereira <[email protected]>
  • Loading branch information
vpereira13 and Victor Pereira authored Sep 12, 2024
1 parent 51b0730 commit f538100
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 138 deletions.
79 changes: 6 additions & 73 deletions .github/workflows/build-base-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ on:
- 'build/base/**'

jobs:
build-base-image-php7:
build-base-image:
runs-on: ubuntu-latest
strategy:
matrix:
php: [ '7.4' ]
librdkafka: [ 'v1.8.2' ]
extrdkafka: [ '3.0.5', '3.1.2', '4.0.4', '4.1.2', '5.0.2' ]
laravel: [ '6', '7', '8' ]
php: [ '7.4', '8.0', '8.1', '8.2', '8.3' ]
librdkafka: [ 'v1.9.2', 'v2.5.0' ]
extrdkafka: [ '4', '5', '6' ]
laravel: [ '6', '7', '8', '9', '10', '11' ]
steps:
- name: Checkout
uses: actions/checkout@v2
Expand All @@ -37,71 +37,4 @@ jobs:
EXT_RDKAFKA_VERSION=${{ matrix.extrdkafka }}
LARAVEL_VERSION=${{ matrix.laravel }}
push: true
tags: arquivei/php-kafka-consumer:${{ matrix.php }}-${{ matrix.librdkafka }}-${{ matrix.extrdkafka }}-${{ matrix.laravel }}

build-base-image-php8:
runs-on: ubuntu-latest
strategy:
matrix:
php: [ '8.0' ]
librdkafka: [ 'v1.8.2' ]
extrdkafka: [ '5.0.2', '6.0.0' ]
laravel: [ '7', '8', '9' ]
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v2
with:
context: build/base
build-args: |
PHP_VERSION=${{ matrix.php }}
LIBRDKAFKA_VERSION=${{ matrix.librdkafka }}
EXT_RDKAFKA_VERSION=${{ matrix.extrdkafka }}
LARAVEL_VERSION=${{ matrix.laravel }}
push: true
tags: arquivei/php-kafka-consumer:${{ matrix.php }}-${{ matrix.librdkafka }}-${{ matrix.extrdkafka }}-${{ matrix.laravel }}

build-base-image-php81:
runs-on: ubuntu-latest
strategy:
matrix:
php: [ '8.1' ]
librdkafka: [ 'v1.8.2' ]
extrdkafka: [ '5.0.2', '6.0.0' ]
laravel: [ '8', '9' ]
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v2
with:
context: build/base
build-args: |
PHP_VERSION=${{ matrix.php }}
LIBRDKAFKA_VERSION=${{ matrix.librdkafka }}
EXT_RDKAFKA_VERSION=${{ matrix.extrdkafka }}
LARAVEL_VERSION=${{ matrix.laravel }}
push: true
tags: arquivei/php-kafka-consumer:${{ matrix.php }}-${{ matrix.librdkafka }}-${{ matrix.extrdkafka }}-${{ matrix.laravel }}

tags: arquivei/php-kafka-consumer:${{ matrix.php }}-${{ matrix.librdkafka }}-${{ matrix.extrdkafka }}-${{ matrix.laravel }}
47 changes: 4 additions & 43 deletions .github/workflows/version-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,49 +11,10 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
php: [7.4]
librdkafka: [v1.8.2]
extrdkafka: [3.0.5, 3.1.2, 4.0.4, 4.1.2, 5.0.2]
laravel: [6, 7, 8]
steps:
- uses: actions/checkout@v2
- name: Test ${{ matrix.php }}-${{ matrix.librdkafka }}-${{ matrix.extrdkafka }}-${{ matrix.laravel }}
run:
make version-test-${{ matrix.php }}-${{ matrix.librdkafka }}-${{ matrix.extrdkafka }}-${{ matrix.laravel }}
run-tests-8:
runs-on: ubuntu-latest
strategy:
matrix:
php: ["8.0"]
librdkafka: [v1.8.2]
extrdkafka: [5.0.2, 6.0.0]
laravel: [8, 9]
steps:
- uses: actions/checkout@v2
- name: Test ${{ matrix.php }}-${{ matrix.librdkafka }}-${{ matrix.extrdkafka }}-${{ matrix.laravel }}
run:
make version-test-${{ matrix.php }}-${{ matrix.librdkafka }}-${{ matrix.extrdkafka }}-${{ matrix.laravel }}
run-tests-8-laravel-7:
runs-on: ubuntu-latest
strategy:
matrix:
php: ["8.0"]
librdkafka: [v1.8.2]
extrdkafka: [5.0.2]
laravel: [7]
steps:
- uses: actions/checkout@v2
- name: Test ${{ matrix.php }}-${{ matrix.librdkafka }}-${{ matrix.extrdkafka }}-${{ matrix.laravel }}
run:
make version-test-${{ matrix.php }}-${{ matrix.librdkafka }}-${{ matrix.extrdkafka }}-${{ matrix.laravel }}
run-tests-8-1:
runs-on: ubuntu-latest
strategy:
matrix:
php: ["8.1"]
librdkafka: [v1.8.2]
extrdkafka: [5.0.2, 6.0.0]
laravel: [8, 9]
php: [ '7.4', '8.0', '8.1', '8.2', '8.3' ]
librdkafka: [ 'v1.9.2', 'v2.5.0' ]
extrdkafka: [ '3.0.5', '3.1.2', '4.0.4', '4.1.2', '5.0.2', '6.0.2' ]
laravel: [ '6', '7', '8', '9', '10', '11' ]
steps:
- uses: actions/checkout@v2
- name: Test ${{ matrix.php }}-${{ matrix.librdkafka }}-${{ matrix.extrdkafka }}-${{ matrix.laravel }}
Expand Down
28 changes: 14 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,43 +3,43 @@ CURRENT_DIRECTORY := $(shell pwd)
.PHONY: up stop restart build tail php test coverage version-test-1 version-test-2 version-test-3 version-test-4 version-test-5 version-test-6 version-test-7 version-test-8 version-test-9 version-test-10 version-test-11 version-test-12 version-test-13 version-test-14 version-test-15 version-test-16 version-test-17 version-test-18 version-test-19 version-test-20 version-test-21 version-test-22 version-test-23 version-test-24

up:
@docker-compose up -d
@docker compose up -d

stop:
@docker-compose stop
@docker compose stop

restart: stop up

build:
@docker-compose up -d --build
@docker compose up -d --build

tail:
@docker-compose logs -f
@docker compose logs -f

laravel:
@docker-compose exec laravel bash
@docker compose exec laravel bash

test: up
@docker-compose exec -T laravel ./vendor/phpunit/phpunit/phpunit tests -c phpunit.xml
@docker compose exec -T laravel ./vendor/phpunit/phpunit/phpunit tests -c phpunit.xml

unit-tests: up
@docker-compose exec -T laravel ./vendor/phpunit/phpunit/phpunit tests --filter Unit
@docker compose exec -T laravel ./vendor/phpunit/phpunit/phpunit tests --filter Unit

integration-tests: up
@docker-compose exec -T laravel ./vendor/phpunit/phpunit/phpunit tests --filter Integration
@docker compose exec -T laravel ./vendor/phpunit/phpunit/phpunit tests --filter Integration

coverage: up
@docker-compose exec laravel phpdbg -qrr ./vendor/bin/phpunit tests --whitelist /application/php-kafka-consumer/src --coverage-html /application/php-kafka-consumer/coverage
@docker compose exec laravel phpdbg -qrr ./vendor/bin/phpunit tests --whitelist /application/php-kafka-consumer/src --coverage-html /application/php-kafka-consumer/coverage

unit-coverage:
@docker-compose exec laravel phpdbg -qrr ./vendor/bin/phpunit tests --whitelist /application/php-kafka-consumer/src --coverage-html /application/php-kafka-consumer/coverage --filter Unit
@docker compose exec laravel phpdbg -qrr ./vendor/bin/phpunit tests --whitelist /application/php-kafka-consumer/src --coverage-html /application/php-kafka-consumer/coverage --filter Unit

integration-coverage:
@docker-compose exec laravel phpdbg -qrr ./vendor/bin/phpunit tests --whitelist /application/php-kafka-consumer/src --coverage-html /application/php-kafka-consumer/coverage --filter Integration
@docker compose exec laravel phpdbg -qrr ./vendor/bin/phpunit tests --whitelist /application/php-kafka-consumer/src --coverage-html /application/php-kafka-consumer/coverage --filter Integration

version-test-%:
@$(eval TAG = $(@:version-test-%=%))
@$(eval LARAVEL_VERSION=$(shell echo ${TAG} | cut -c18))
@docker-compose -f docker-compose-test.yaml build --build-arg TAG=${TAG} --build-arg LARAVEL_VERSION=${LARAVEL_VERSION}
@docker-compose -f docker-compose-test.yaml up -d
@docker-compose -f docker-compose-test.yaml exec -T test ./vendor/phpunit/phpunit/phpunit tests
@docker compose -f docker-compose-test.yaml build --build-arg TAG=${TAG} --build-arg LARAVEL_VERSION=${LARAVEL_VERSION}
@docker compose -f docker-compose-test.yaml up -d
@docker compose -f docker-compose-test.yaml exec -T test ./vendor/phpunit/phpunit/phpunit tests
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
"license": "MIT",
"type": "project",
"require": {
"php": "~7.2 || ~7.3 || ~7.4 || ~8.0 || ~8.1",
"monolog/monolog": "~1 || ~2",
"illuminate/console": "~6 || ~7 || ~8 || ~9",
"php": "~7.2 || ~7.3 || ~7.4 || ^8.0",
"monolog/monolog": "~1 || ~2 || ~3",
"illuminate/console": "~6 || ~7 || ~8 || ~9 || ~10 || ~11",
"ext-rdkafka": "~3.0 || ~3.1 || ~4.0 || ~5.0 || ~6.0"
},
"require-dev": {
"phpunit/phpunit": "~7 || ~8 || ~9"
"phpunit/phpunit": "~7 || ~8 || ~9 || ~10 || ~11"
},
"autoload": {
"psr-4": {
Expand Down
8 changes: 4 additions & 4 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,31 +158,31 @@ If you want to contribute, there are a few utilities that will help.

First create a container:

`docker-compose up -d --build`
`docker compose up -d --build`

If you have make, you can use pre defined commands in the Makefile

`make build`

Then install the dependencies:

`docker-compose exec php-fpm composer install`
`docker compose exec php-fpm composer install`

or with make:

`make composer install`

You can run tests locally:

`docker-compose exec php-fpm ./vendor/phpunit/phpunit/phpunit tests`
`docker compose exec php-fpm ./vendor/phpunit/phpunit/phpunit tests`

or with make:

`make test`

and check for coverage:

`docker-compose exec php-fpm phpdbg -qrr ./vendor/bin/phpunit --whitelist src/ --coverage-html coverage/`
`docker compose exec php-fpm phpdbg -qrr ./vendor/bin/phpunit --whitelist src/ --coverage-html coverage/`

or with make:

Expand Down

0 comments on commit f538100

Please sign in to comment.