Skip to content

Fix: Fixing CI #1382

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

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
34 changes: 16 additions & 18 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ jobs:
name: Static analysis
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- uses: technote-space/get-diff-action@v4
- uses: technote-space/get-diff-action@v6
with:
PATTERNS: |
pkg/**/*.php
Expand All @@ -25,7 +25,7 @@ jobs:

- run: php ./bin/fix-symfony-version.php "5.4.*"

- uses: "ramsey/composer-install@v1"
- uses: "ramsey/composer-install@v3"

- run: sed -i 's/525568/16777471/' vendor/kwn/php-rdkafka-stubs/stubs/constants.php

Expand All @@ -37,9 +37,9 @@ jobs:
name: Code style check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- uses: technote-space/get-diff-action@v4
- uses: technote-space/get-diff-action@v6
with:
PATTERNS: |
pkg/**/*.php
Expand All @@ -49,7 +49,7 @@ jobs:
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"

- uses: actions/cache@v2
- uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: composer-cs-check-${{ hashFiles('**/composer.json') }}
Expand Down Expand Up @@ -87,14 +87,14 @@ jobs:
name: PHP ${{ matrix.php }} unit tests on Sf ${{ matrix.symfony_version }}, deps=${{ matrix.dependencies }}

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Get Composer Cache Directory
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"

- uses: actions/cache@v2
- uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: composer-${{ matrix.php }}-${{ matrix.symfony_version }}-${{ matrix.dependencies }}-${{ hashFiles('**/composer.json') }}
Expand Down Expand Up @@ -122,23 +122,27 @@ jobs:
fail-fast: false
matrix:
php: [ '8.1', '8.2' ]
symfony_version: [ '6.2.*', '6.3.*', '6.4.*', '7.0.*' ]
symfony_version: [ '6.4.*', '7.0.*', '7.1.*', '7.2.*' ]
dependencies: [ '--prefer-lowest', '--prefer-dist' ]
exclude:
- php: '8.1'
symfony_version: '7.0.*'
- php: '8.1'
symfony_version: '7.1.*'
- php: '8.1'
symfony_version: '7.2.*'

name: PHP ${{ matrix.php }} functional tests on Sf ${{ matrix.symfony_version }}, deps=${{ matrix.dependencies }}

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Get Composer Cache Directory
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"

- uses: actions/cache@v2
- uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: composer-${{ matrix.php }}-${{ matrix.symfony_version }}-${{ matrix.dependencies }}-${{ hashFiles('**/composer.json') }}
Expand All @@ -162,10 +166,4 @@ jobs:
env:
PHP_VERSION: ${{ matrix.php }}

# TODO: convert these two steps into one w/o excludes when Gearman extension gets a release for PHP 8.1
# See https://github.com/php/pecl-networking-gearman/issues/16
- run: bin/test.sh
if: ${{ matrix.php != '8.1' && matrix.php != '8.2' }}

- run: bin/test.sh --exclude-group=gearman
if: ${{ matrix.php == '8.1' && matrix.php != '8.2' }}
- run: bin/test.sh --group=functional
2 changes: 1 addition & 1 deletion bin/fix-symfony-version.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

$newVersion = $argv[1];

$composer = file_get_contents(__DIR__.'/../composer.json');
$composer = trim(file_get_contents(__DIR__.'/../composer.json'));

$updatedComposer = preg_replace('/"symfony\/(.*)": ".*"/', '"symfony/$1": "'.$newVersion.'"', $composer).\PHP_EOL;
echo $updatedComposer.\PHP_EOL;
Expand Down
28 changes: 14 additions & 14 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "enqueue/enqueue-dev",
"type": "project",
"minimum-stability": "beta",
"minimum-stability": "stable",
"homepage": "https://enqueue.forma-pro.com/",
"scripts": {
"cs-fix": "bin/php-cs-fixer fix",
Expand All @@ -18,30 +18,30 @@

"queue-interop/amqp-interop": "^0.8.2",
"queue-interop/queue-interop": "^0.8.1",
"bunny/bunny": "^0.4|^0.5",
"php-amqplib/php-amqplib": "^3.0",
"doctrine/dbal": "^2.12|^3.1",
"ramsey/uuid": "^3.5|^4",
"bunny/bunny": "^0.5.5",
"php-amqplib/php-amqplib": "^3.1",
"doctrine/dbal": "^3.2",
"ramsey/uuid": "^4.3",
"psr/log": "^1.1 || ^2.0 || ^3.0",
"psr/container": "^1.1 || ^2.0",
"makasim/temp-file": "^0.2",
"google/cloud-pubsub": "^1.4.3",
"google/cloud-pubsub": "^1.46",
"doctrine/orm": "^2.12",
"doctrine/persistence": "^2.0|^3.0",
"mongodb/mongodb": "^1.2",
"mongodb/mongodb": "^1.17",
"pda/pheanstalk": "^3.1",
"aws/aws-sdk-php": "^3.290",
"stomp-php/stomp-php": "^4.5|^5",
"stomp-php/stomp-php": "^5.1",
"php-http/guzzle7-adapter": "^0.1.1",
"php-http/client-common": "^2.2.1",
"andrewmy/rabbitmq-management-api": "^2.1.2",
"predis/predis": "^1.1",
"predis/predis": "^2.1",
"thruway/client": "^0.5.5",
"thruway/pawl-transport": "^0.5.1",
"thruway/pawl-transport": "^0.5.2",
"influxdb/influxdb-php": "^1.14",
"datadog/php-datadogstatsd": "^1.3",
"guzzlehttp/guzzle": "^7.0.1",
"guzzlehttp/psr7": "^1.0",
"guzzlehttp/psr7": "^1.9.1",
"php-http/discovery": "^1.13",
"voryx/thruway-common": "^1.0.1",
"react/dns": "^1.4",
Expand All @@ -50,7 +50,7 @@
},
"require-dev": {
"ext-pcntl": "*",
"phpunit/phpunit": "^9.5",
"phpunit/phpunit": "^9.5.28",
"phpstan/phpstan": "^1.0",
"queue-interop/queue-spec": "^0.6.2",
"symfony/browser-kit": "^6.2|^7.0",
Expand All @@ -66,8 +66,8 @@
"symfony/validator": "^6.2|^7.0",
"symfony/yaml": "^6.2|^7.0",
"empi89/php-amqp-stubs": "*@dev",
"doctrine/doctrine-bundle": "^2.3.2",
"doctrine/mongodb-odm-bundle": "^3.5|^4.3|^5.0",
"doctrine/doctrine-bundle": "^2.5",
"doctrine/mongodb-odm-bundle": "^4.7|^5.0",
"alcaeus/mongo-php-adapter": "^1.0",
"kwn/php-rdkafka-stubs": "^2.0.3",
"friendsofphp/php-cs-fixer": "^3.4",
Expand Down
6 changes: 2 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
version: '2'

services:
dev:
# when image publishing gets sorted:
# image: enqueue/dev:${PHP_VERSION:-7.4}
# image: enqueue/dev:${PHP_VERSION:-8.2}
build:
context: docker
args:
PHP_VERSION: "${PHP_VERSION:-8.1}"
PHP_VERSION: "${PHP_VERSION:-8.2}"
depends_on:
- rabbitmq
- mysql
Expand Down
91 changes: 27 additions & 64 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,76 +1,39 @@
ARG PHP_VERSION=8.2
FROM makasim/nginx-php-fpm:${PHP_VERSION}-all-exts
FROM php:${PHP_VERSION}-alpine

ARG PHP_VERSION

## libs
RUN set -x && \
apt-get update && \
apt-get install -y --no-install-recommends --no-install-suggests \
wget \
curl \
openssl \
ca-certificates \
nano \
netcat \
php${PHP_VERSION}-dev \
php${PHP_VERSION}-redis \
php${PHP_VERSION}-pgsql \
git \
python \
php${PHP_VERSION}-amqp \
php${PHP_VERSION}-xml \
php${PHP_VERSION}-mysql \
php${PHP_VERSION}-curl \
php${PHP_VERSION}-mongodb \
php${PHP_VERSION}-mbstring \
make \
g++ \
unzip \
&& \
update-alternatives --install /usr/bin/php php /usr/bin/php${PHP_VERSION} 100

## gearman
RUN set -x && \
apt-get install -y --no-install-recommends --no-install-suggests \
libgearman-dev \
&& \
mkdir -p $HOME/gearman && \
cd $HOME/gearman && \
git clone https://github.com/php/pecl-networking-gearman.git . && \
git checkout gearman-2.1.0 && \
phpize && ./configure && make && make install && \
if [ ! -f /etc/php/${PHP_VERSION}/cli/conf.d/20-gearman.ini ]; then \
echo "extension=gearman.so" > /etc/php/${PHP_VERSION}/cli/conf.d/20-gearman.ini && \
echo "extension=gearman.so" > /etc/php/${PHP_VERSION}/fpm/conf.d/20-gearman.ini \
; \
fi;

## librdkafka
RUN set -x && \
mkdir -p $HOME/librdkafka && \
cd $HOME/librdkafka && \
git clone https://github.com/edenhill/librdkafka.git . && \
git checkout v1.0.0 && \
./configure && make && make install

## php-rdkafka
RUN set -x && \
mkdir -p $HOME/php-rdkafka && \
cd $HOME/php-rdkafka && \
git clone https://github.com/arnaud-lb/php-rdkafka.git . && \
git checkout 5.0.1 && \
phpize && ./configure && make all && make install && \
echo "extension=rdkafka.so" > /etc/php/${PHP_VERSION}/cli/conf.d/10-rdkafka.ini && \
echo "extension=rdkafka.so" > /etc/php/${PHP_VERSION}/fpm/conf.d/10-rdkafka.ini

COPY ./php/cli.ini /etc/php/${PHP_VERSION}/cli/conf.d/1-dev_cli.ini
RUN --mount=type=cache,target=/var/cache/apk apk add --no-cache $PHPIZE_DEPS \
libpq-dev \
librdkafka-dev \
rabbitmq-c-dev \
linux-headers && \
apk add --no-cache --repository=https://dl-cdn.alpinelinux.org/alpine/edge/testing \
gearman-dev

# Install First Party Modules
RUN docker-php-ext-install -j$(nproc) \
pcntl \
pdo_mysql \
pdo_pgsql

# Install Third Party Modules
RUN --mount=type=cache,target=/tmp/pear pecl install redis \
mongodb-1.21.0 \
gearman \
rdkafka \
xdebug && \
pecl install --configureoptions 'with-librabbitmq-dir="autodetect"' amqp
RUN docker-php-ext-enable redis mongodb gearman rdkafka xdebug amqp

COPY ./php/cli.ini /usr/local/etc/php/conf.d/1-dev_cli
COPY ./bin/dev_entrypoiny.sh /usr/local/bin/entrypoint.sh
RUN mv /usr/local/etc/php/php.ini-development /usr/local/etc/php/php.ini
RUN chmod u+x /usr/local/bin/entrypoint.sh

RUN mkdir -p /mqdev
WORKDIR /mqdev

COPY --from=composer:2 /usr/bin/composer /usr/bin/composer

CMD /usr/local/bin/entrypoint.sh
CMD ["/usr/local/bin/entrypoint.sh"]
2 changes: 1 addition & 1 deletion docker/bin/dev_entrypoiny.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/env bash
#!/usr/bin/env sh

while true; do sleep 1; done
6 changes: 3 additions & 3 deletions docker/bin/test.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env bash
#!/usr/bin/env sh

# wait for service
# $1 host
Expand All @@ -12,7 +12,7 @@ function waitForService()
ATTEMPTS=0
until nc -z $1 $2; do
printf "wait for service %s:%s\n" $1 $2
((ATTEMPTS++))
ATTEMPTS=$((ATTEMPTS++))
if [ $ATTEMPTS -ge $3 ]; then
printf "service is not running %s:%s\n" $1 $2
exit 1
Expand Down Expand Up @@ -47,4 +47,4 @@ php pkg/job-queue/Tests/Functional/app/console doctrine:database:create --if-not
php pkg/job-queue/Tests/Functional/app/console doctrine:schema:update --force --complete || exit 1

#php pkg/enqueue-bundle/Tests/Functional/app/console.php config:dump-reference enqueue
bin/phpunit "$@"
php -d memory_limit=-1 bin/phpunit "$@"
4 changes: 2 additions & 2 deletions pkg/dbal/DbalConsumerHelperTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ protected function fetchMessage(array $queues, int $redeliveryDelay): ?DbalMessa

while (microtime(true) < $endAt) {
try {
$result = $select->execute()->fetch();
$result = $select->execute()->fetchAssociative();
if (empty($result)) {
return null;
}
Expand All @@ -69,7 +69,7 @@ protected function fetchMessage(array $queues, int $redeliveryDelay): ?DbalMessa
->setParameter('deliveryId', $deliveryId, DbalType::GUID)
->setMaxResults(1)
->execute()
->fetch();
->fetchAssociative();

// the message has been removed by a 3rd party, such as truncate operation.
if (false === $deliveredMessage) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/enqueue/Client/DriverFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ private function findDriverInfo(Dsn $dsn, array $factories): ?array
private function createRabbitMqStompDriver(ConnectionFactory $factory, Dsn $dsn, Config $config, RouteCollection $collection): RabbitMqStompDriver
{
$defaultManagementHost = $dsn->getHost() ?: $config->getTransportOption('host', 'localhost');
$managementVast = ltrim($dsn->getPath(), '/') ?: $config->getTransportOption('vhost', '/');
$managementVast = ltrim($dsn->getPath() ?? '', '/') ?: $config->getTransportOption('vhost', '/');

$managementClient = StompManagementClient::create(
urldecode($managementVast),
Expand Down
2 changes: 1 addition & 1 deletion pkg/enqueue/Symfony/Client/ConsumeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
try {
$consumer = $this->getQueueConsumer($client);
} catch (NotFoundExceptionInterface $e) {
throw new \LogicException(sprintf('Client "%s" is not supported.', $client), null, $e);
throw new \LogicException(sprintf('Client "%s" is not supported.', $client), previous: $e);
}

$driver = $this->getDriver($client);
Expand Down
2 changes: 1 addition & 1 deletion pkg/enqueue/Symfony/Client/ProduceCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
try {
$producer = $this->getProducer($client);
} catch (NotFoundExceptionInterface $e) {
throw new \LogicException(sprintf('Client "%s" is not supported.', $client), null, $e);
throw new \LogicException(sprintf('Client "%s" is not supported.', $client), previous: $e);
}

if ($topic) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/enqueue/Symfony/Client/RoutesCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
try {
$this->driver = $this->getDriver($input->getOption('client'));
} catch (NotFoundExceptionInterface $e) {
throw new \LogicException(sprintf('Client "%s" is not supported.', $input->getOption('client')), null, $e);
throw new \LogicException(sprintf('Client "%s" is not supported.', $input->getOption('client')), previous: $e);
}

$routes = $this->driver->getRouteCollection()->all();
Expand Down
2 changes: 1 addition & 1 deletion pkg/enqueue/Symfony/Client/SetupBrokerCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
try {
$this->getDriver($client)->setupBroker(new ConsoleLogger($output));
} catch (NotFoundExceptionInterface $e) {
throw new \LogicException(sprintf('Client "%s" is not supported.', $client), null, $e);
throw new \LogicException(sprintf('Client "%s" is not supported.', $client), previous: $e);
}

$output->writeln('Broker set up');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
try {
$consumer = $this->getQueueConsumer($transport);
} catch (NotFoundExceptionInterface $e) {
throw new \LogicException(sprintf('Transport "%s" is not supported.', $transport), null, $e);
throw new \LogicException(sprintf('Transport "%s" is not supported.', $transport), previous: $e);
}

$this->setQueueConsumerOptions($consumer, $input);
Expand Down
Loading
Loading