diff --git a/.github/workflows/build-base-image.yml b/.github/workflows/build-base-image.yml index dee2163..4d4bc01 100644 --- a/.github/workflows/build-base-image.yml +++ b/.github/workflows/build-base-image.yml @@ -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 @@ -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 }} \ No newline at end of file diff --git a/.github/workflows/version-test.yml b/.github/workflows/version-test.yml index 0a02042..0e9ae16 100644 --- a/.github/workflows/version-test.yml +++ b/.github/workflows/version-test.yml @@ -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 }} diff --git a/Makefile b/Makefile index 8f1e8db..dcbc02f 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/composer.json b/composer.json index ccc0603..dfd85d7 100644 --- a/composer.json +++ b/composer.json @@ -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": { diff --git a/readme.md b/readme.md index 277eee9..c5088ce 100644 --- a/readme.md +++ b/readme.md @@ -158,7 +158,7 @@ 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 @@ -166,7 +166,7 @@ If you have make, you can use pre defined commands in the Makefile Then install the dependencies: -`docker-compose exec php-fpm composer install` +`docker compose exec php-fpm composer install` or with make: @@ -174,7 +174,7 @@ or with make: 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: @@ -182,7 +182,7 @@ or with make: 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: