Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade the illuminate/console library support to 9.x #53

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .github/workflows/build-base-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Build Base Image

on:
pull_request:
paths:
- 'build/base/**'

jobs:
build-base-image:
runs-on: ubuntu-latest
strategy:
matrix:
php: [ 7.4, 8, 9 ]
librdkafka: [ v1.8.2 ]
extrdkafka: [ 4, 5, 6 ]
laravel: [ 6, 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 }}
48 changes: 3 additions & 45 deletions .github/workflows/version-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,51 +11,9 @@ 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]
laravel: [6, 8, 9]
steps:
- uses: actions/checkout@v2
- name: Test ${{ matrix.php }}-${{ matrix.librdkafka }}-${{ matrix.extrdkafka }}-${{ matrix.laravel }}
- name: Test Laravel[${{ 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]
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 }}
make version-test-${{ matrix.laravel }}
10 changes: 7 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,12 @@ 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

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}
@$(eval LARAVEL_VERSION=$(@:version-test-%=%))
@docker-compose -f docker-compose-test.yaml build --build-arg PHP_VERSION=${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

version-test-latest:
@docker-compose -f docker-compose-test.yaml build
@docker-compose -f docker-compose-test.yaml up -d
@docker-compose -f docker-compose-test.yaml exec -T test ./vendor/phpunit/phpunit/phpunit tests
36 changes: 36 additions & 0 deletions build/base/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
ARG PHP_VERSION

FROM php:${PHP_VERSION}-fpm-alpine

ARG LIBRDKAFKA_VERSION
ARG EXT_RDKAFKA_VERSION
ARG LARAVEL_VERSION


RUN apk update && \
apk add git zlib-dev libressl-dev libsasl zstd-dev zstd-static build-base && \
git config --global advice.detachedHead false && \
apk add bash

RUN git clone --branch ${LIBRDKAFKA_VERSION} https://github.com/edenhill/librdkafka.git && \
cd librdkafka && \
./configure --install-deps && \
make && \
make install

RUN apk update && \
apk add autoconf && \
pecl install rdkafka-${EXT_RDKAFKA_VERSION}

RUN apk update && \
apk add libzip-dev unzip && \
pecl install zip

COPY --from=composer /usr/bin/composer /usr/local/bin/composer

RUN composer global require laravel/installer

WORKDIR /application

RUN cd /application && \
composer create-project --prefer-dist laravel/laravel laravel-test "${LARAVEL_VERSION}.*"
62 changes: 0 additions & 62 deletions build/composer-files/composer.json-9

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,4 @@
"@php artisan key:generate --ansi"
]
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,4 @@
"@php artisan key:generate --ansi"
]
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,18 @@
],
"license": "MIT",
"require": {
"php": "^7.3 || ^8.0",
"fideloper/proxy": "^4.2",
"fruitcake/laravel-cors": "^2.0",
"guzzlehttp/guzzle": "^7.0.1",
"laravel/framework": "^8.0",
"laravel/tinker": "^2.0"
"php": "^8.0",
"fideloper/proxy": "~4",
"fruitcake/laravel-cors": "~2",
"guzzlehttp/guzzle": "~7",
"laravel/framework": "~9",
"laravel/tinker": "~2"
},
"require-dev": {
"facade/ignition": "^2.3.6",
"fzaninotto/faker": "^1.9.1",
"mockery/mockery": "^1.3.1",
"nunomaduro/collision": "^5.0",
"phpunit/phpunit": "^9.3"
"fakerphp/faker": "^1.19",
"mockery/mockery": "~1",
"nunomaduro/collision": "~6",
"phpunit/phpunit": "~9"
},
"config": {
"optimize-autoloader": true,
Expand Down Expand Up @@ -58,4 +57,4 @@
"@php artisan key:generate --ansi"
]
}
}
}
36 changes: 30 additions & 6 deletions build/test/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,42 @@
ARG TAG
ARG PHP_VERSION

FROM joesantos386/laravel:${TAG}
FROM php:${PHP_VERSION}-fpm-alpine

ARG LIBRDKAFKA_VERSION
ARG EXT_RDKAFKA_VERSION
ARG LARAVEL_VERSION

RUN apk add libzip-dev
RUN apk update && \
apk add git zlib-dev libressl-dev libsasl zstd-dev zstd-static build-base && \
git config --global advice.detachedHead false && \
apk add bash

RUN apk add unzip
RUN git clone --branch ${LIBRDKAFKA_VERSION} https://github.com/edenhill/librdkafka.git && \
cd librdkafka && \
./configure --install-deps && \
make && \
make install

RUN pecl install zip
RUN apk update && \
apk add autoconf && \
pecl install rdkafka-${EXT_RDKAFKA_VERSION}

RUN apk update && \
apk add libzip-dev unzip && \
pecl install zip

COPY --from=composer /usr/bin/composer /usr/local/bin/composer

RUN composer global require laravel/installer

WORKDIR /application

RUN cd /application && \
composer create-project --prefer-dist laravel/laravel laravel-test "${LARAVEL_VERSION}.*"

COPY dev/php.ini /usr/local/etc/php/conf.d

COPY build/composer-files/composer.json-${LARAVEL_VERSION} /application/laravel-test/composer.json
COPY build/composer-files/composer.json-laravel${LARAVEL_VERSION} /application/laravel-test/composer.json

COPY tests /application/laravel-test/tests

Expand Down
10 changes: 5 additions & 5 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",
"ext-rdkafka": "~3.0 || ~3.1 || ~4.0 || ~5.0 || ~6.0"
"php": "~7.4 || ~8 || ~9",
"monolog/monolog": "~2",
"illuminate/console": "~8.12 || ~9",
"ext-rdkafka": "~4 || ~5 || ~6"
},
"require-dev": {
"phpunit/phpunit": "~7 || ~8 || ~9"
"phpunit/phpunit": "~9.3"
},
"autoload": {
"psr-4": {
Expand Down
7 changes: 4 additions & 3 deletions docker-compose-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ services:

kafka-test:
image: 'bitnami/kafka:latest'
restart: always
ports:
- '9094:9092'
- '9095:9093'
Expand All @@ -41,8 +40,10 @@ services:
context: .
dockerfile: build/test/Dockerfile
args:
TAG: 8.0-v1.6.1-5.0.0-8
LARAVEL_VERSION: 8
PHP_VERSION: 8.0.18
LARAVEL_VERSION: 9
LIBRDKAFKA_VERSION: v1.8.2
EXT_RDKAFKA_VERSION: 6.0.1
entrypoint: /application/php-kafka-consumer/start.sh
networks:
- app-test
Expand Down