Skip to content

Commit 574b13a

Browse files
authored
Merge pull request #1382 from JimTools/fix-ci
Fix: Fixing CI
2 parents b474bb4 + 1bf5b7d commit 574b13a

18 files changed

+77
-117
lines changed

.github/workflows/ci.yml

+16-18
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ jobs:
99
name: Static analysis
1010
runs-on: ubuntu-latest
1111
steps:
12-
- uses: actions/checkout@v2
12+
- uses: actions/checkout@v4
1313

14-
- uses: technote-space/get-diff-action@v4
14+
- uses: technote-space/get-diff-action@v6
1515
with:
1616
PATTERNS: |
1717
pkg/**/*.php
@@ -25,7 +25,7 @@ jobs:
2525

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

28-
- uses: "ramsey/composer-install@v1"
28+
- uses: "ramsey/composer-install@v3"
2929

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

@@ -37,9 +37,9 @@ jobs:
3737
name: Code style check
3838
runs-on: ubuntu-latest
3939
steps:
40-
- uses: actions/checkout@v2
40+
- uses: actions/checkout@v4
4141

42-
- uses: technote-space/get-diff-action@v4
42+
- uses: technote-space/get-diff-action@v6
4343
with:
4444
PATTERNS: |
4545
pkg/**/*.php
@@ -49,7 +49,7 @@ jobs:
4949
run: |
5050
echo "::set-output name=dir::$(composer config cache-files-dir)"
5151
52-
- uses: actions/cache@v2
52+
- uses: actions/cache@v4
5353
with:
5454
path: ${{ steps.composer-cache.outputs.dir }}
5555
key: composer-cs-check-${{ hashFiles('**/composer.json') }}
@@ -87,14 +87,14 @@ jobs:
8787
name: PHP ${{ matrix.php }} unit tests on Sf ${{ matrix.symfony_version }}, deps=${{ matrix.dependencies }}
8888

8989
steps:
90-
- uses: actions/checkout@v2
90+
- uses: actions/checkout@v4
9191

9292
- name: Get Composer Cache Directory
9393
id: composer-cache
9494
run: |
9595
echo "::set-output name=dir::$(composer config cache-files-dir)"
9696
97-
- uses: actions/cache@v2
97+
- uses: actions/cache@v4
9898
with:
9999
path: ${{ steps.composer-cache.outputs.dir }}
100100
key: composer-${{ matrix.php }}-${{ matrix.symfony_version }}-${{ matrix.dependencies }}-${{ hashFiles('**/composer.json') }}
@@ -122,23 +122,27 @@ jobs:
122122
fail-fast: false
123123
matrix:
124124
php: [ '8.1', '8.2' ]
125-
symfony_version: [ '6.2.*', '6.3.*', '6.4.*', '7.0.*' ]
125+
symfony_version: [ '6.4.*', '7.0.*', '7.1.*', '7.2.*' ]
126126
dependencies: [ '--prefer-lowest', '--prefer-dist' ]
127127
exclude:
128128
- php: '8.1'
129129
symfony_version: '7.0.*'
130+
- php: '8.1'
131+
symfony_version: '7.1.*'
132+
- php: '8.1'
133+
symfony_version: '7.2.*'
130134

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

133137
steps:
134-
- uses: actions/checkout@v2
138+
- uses: actions/checkout@v4
135139

136140
- name: Get Composer Cache Directory
137141
id: composer-cache
138142
run: |
139143
echo "::set-output name=dir::$(composer config cache-files-dir)"
140144
141-
- uses: actions/cache@v2
145+
- uses: actions/cache@v4
142146
with:
143147
path: ${{ steps.composer-cache.outputs.dir }}
144148
key: composer-${{ matrix.php }}-${{ matrix.symfony_version }}-${{ matrix.dependencies }}-${{ hashFiles('**/composer.json') }}
@@ -162,10 +166,4 @@ jobs:
162166
env:
163167
PHP_VERSION: ${{ matrix.php }}
164168

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

bin/fix-symfony-version.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
$newVersion = $argv[1];
88

9-
$composer = file_get_contents(__DIR__.'/../composer.json');
9+
$composer = trim(file_get_contents(__DIR__.'/../composer.json'));
1010

1111
$updatedComposer = preg_replace('/"symfony\/(.*)": ".*"/', '"symfony/$1": "'.$newVersion.'"', $composer).\PHP_EOL;
1212
echo $updatedComposer.\PHP_EOL;

composer.json

+14-14
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "enqueue/enqueue-dev",
33
"type": "project",
4-
"minimum-stability": "beta",
4+
"minimum-stability": "stable",
55
"homepage": "https://enqueue.forma-pro.com/",
66
"scripts": {
77
"cs-fix": "bin/php-cs-fixer fix",
@@ -18,30 +18,30 @@
1818

1919
"queue-interop/amqp-interop": "^0.8.2",
2020
"queue-interop/queue-interop": "^0.8.1",
21-
"bunny/bunny": "^0.4|^0.5",
22-
"php-amqplib/php-amqplib": "^3.0",
23-
"doctrine/dbal": "^2.12|^3.1",
24-
"ramsey/uuid": "^3.5|^4",
21+
"bunny/bunny": "^0.5.5",
22+
"php-amqplib/php-amqplib": "^3.1",
23+
"doctrine/dbal": "^3.2",
24+
"ramsey/uuid": "^4.3",
2525
"psr/log": "^1.1 || ^2.0 || ^3.0",
2626
"psr/container": "^1.1 || ^2.0",
2727
"makasim/temp-file": "^0.2",
28-
"google/cloud-pubsub": "^1.4.3",
28+
"google/cloud-pubsub": "^1.46",
2929
"doctrine/orm": "^2.12",
3030
"doctrine/persistence": "^2.0|^3.0",
31-
"mongodb/mongodb": "^1.2",
31+
"mongodb/mongodb": "^1.17",
3232
"pda/pheanstalk": "^3.1",
3333
"aws/aws-sdk-php": "^3.290",
34-
"stomp-php/stomp-php": "^4.5|^5",
34+
"stomp-php/stomp-php": "^5.1",
3535
"php-http/guzzle7-adapter": "^0.1.1",
3636
"php-http/client-common": "^2.2.1",
3737
"andrewmy/rabbitmq-management-api": "^2.1.2",
38-
"predis/predis": "^1.1",
38+
"predis/predis": "^2.1",
3939
"thruway/client": "^0.5.5",
40-
"thruway/pawl-transport": "^0.5.1",
40+
"thruway/pawl-transport": "^0.5.2",
4141
"influxdb/influxdb-php": "^1.14",
4242
"datadog/php-datadogstatsd": "^1.3",
4343
"guzzlehttp/guzzle": "^7.0.1",
44-
"guzzlehttp/psr7": "^1.0",
44+
"guzzlehttp/psr7": "^1.9.1",
4545
"php-http/discovery": "^1.13",
4646
"voryx/thruway-common": "^1.0.1",
4747
"react/dns": "^1.4",
@@ -50,7 +50,7 @@
5050
},
5151
"require-dev": {
5252
"ext-pcntl": "*",
53-
"phpunit/phpunit": "^9.5",
53+
"phpunit/phpunit": "^9.5.28",
5454
"phpstan/phpstan": "^1.0",
5555
"queue-interop/queue-spec": "^0.6.2",
5656
"symfony/browser-kit": "^6.2|^7.0",
@@ -66,8 +66,8 @@
6666
"symfony/validator": "^6.2|^7.0",
6767
"symfony/yaml": "^6.2|^7.0",
6868
"empi89/php-amqp-stubs": "*@dev",
69-
"doctrine/doctrine-bundle": "^2.3.2",
70-
"doctrine/mongodb-odm-bundle": "^3.5|^4.3|^5.0",
69+
"doctrine/doctrine-bundle": "^2.5",
70+
"doctrine/mongodb-odm-bundle": "^4.7|^5.0",
7171
"alcaeus/mongo-php-adapter": "^1.0",
7272
"kwn/php-rdkafka-stubs": "^2.0.3",
7373
"friendsofphp/php-cs-fixer": "^3.4",

docker-compose.yml

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
version: '2'
2-
31
services:
42
dev:
53
# when image publishing gets sorted:
6-
# image: enqueue/dev:${PHP_VERSION:-7.4}
4+
# image: enqueue/dev:${PHP_VERSION:-8.2}
75
build:
86
context: docker
97
args:
10-
PHP_VERSION: "${PHP_VERSION:-8.1}"
8+
PHP_VERSION: "${PHP_VERSION:-8.2}"
119
depends_on:
1210
- rabbitmq
1311
- mysql

docker/Dockerfile

+27-64
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,39 @@
11
ARG PHP_VERSION=8.2
2-
FROM makasim/nginx-php-fpm:${PHP_VERSION}-all-exts
2+
FROM php:${PHP_VERSION}-alpine
33

44
ARG PHP_VERSION
55

6-
## libs
7-
RUN set -x && \
8-
apt-get update && \
9-
apt-get install -y --no-install-recommends --no-install-suggests \
10-
wget \
11-
curl \
12-
openssl \
13-
ca-certificates \
14-
nano \
15-
netcat \
16-
php${PHP_VERSION}-dev \
17-
php${PHP_VERSION}-redis \
18-
php${PHP_VERSION}-pgsql \
19-
git \
20-
python \
21-
php${PHP_VERSION}-amqp \
22-
php${PHP_VERSION}-xml \
23-
php${PHP_VERSION}-mysql \
24-
php${PHP_VERSION}-curl \
25-
php${PHP_VERSION}-mongodb \
26-
php${PHP_VERSION}-mbstring \
27-
make \
28-
g++ \
29-
unzip \
30-
&& \
31-
update-alternatives --install /usr/bin/php php /usr/bin/php${PHP_VERSION} 100
32-
33-
## gearman
34-
RUN set -x && \
35-
apt-get install -y --no-install-recommends --no-install-suggests \
36-
libgearman-dev \
37-
&& \
38-
mkdir -p $HOME/gearman && \
39-
cd $HOME/gearman && \
40-
git clone https://github.com/php/pecl-networking-gearman.git . && \
41-
git checkout gearman-2.1.0 && \
42-
phpize && ./configure && make && make install && \
43-
if [ ! -f /etc/php/${PHP_VERSION}/cli/conf.d/20-gearman.ini ]; then \
44-
echo "extension=gearman.so" > /etc/php/${PHP_VERSION}/cli/conf.d/20-gearman.ini && \
45-
echo "extension=gearman.so" > /etc/php/${PHP_VERSION}/fpm/conf.d/20-gearman.ini \
46-
; \
47-
fi;
48-
49-
## librdkafka
50-
RUN set -x && \
51-
mkdir -p $HOME/librdkafka && \
52-
cd $HOME/librdkafka && \
53-
git clone https://github.com/edenhill/librdkafka.git . && \
54-
git checkout v1.0.0 && \
55-
./configure && make && make install
56-
57-
## php-rdkafka
58-
RUN set -x && \
59-
mkdir -p $HOME/php-rdkafka && \
60-
cd $HOME/php-rdkafka && \
61-
git clone https://github.com/arnaud-lb/php-rdkafka.git . && \
62-
git checkout 5.0.1 && \
63-
phpize && ./configure && make all && make install && \
64-
echo "extension=rdkafka.so" > /etc/php/${PHP_VERSION}/cli/conf.d/10-rdkafka.ini && \
65-
echo "extension=rdkafka.so" > /etc/php/${PHP_VERSION}/fpm/conf.d/10-rdkafka.ini
66-
67-
COPY ./php/cli.ini /etc/php/${PHP_VERSION}/cli/conf.d/1-dev_cli.ini
6+
RUN --mount=type=cache,target=/var/cache/apk apk add --no-cache $PHPIZE_DEPS \
7+
libpq-dev \
8+
librdkafka-dev \
9+
rabbitmq-c-dev \
10+
linux-headers && \
11+
apk add --no-cache --repository=https://dl-cdn.alpinelinux.org/alpine/edge/testing \
12+
gearman-dev
13+
14+
# Install First Party Modules
15+
RUN docker-php-ext-install -j$(nproc) \
16+
pcntl \
17+
pdo_mysql \
18+
pdo_pgsql
19+
20+
# Install Third Party Modules
21+
RUN --mount=type=cache,target=/tmp/pear pecl install redis \
22+
mongodb-1.21.0 \
23+
gearman \
24+
rdkafka \
25+
xdebug && \
26+
pecl install --configureoptions 'with-librabbitmq-dir="autodetect"' amqp
27+
RUN docker-php-ext-enable redis mongodb gearman rdkafka xdebug amqp
28+
29+
COPY ./php/cli.ini /usr/local/etc/php/conf.d/.user.ini
6830
COPY ./bin/dev_entrypoiny.sh /usr/local/bin/entrypoint.sh
31+
RUN mv /usr/local/etc/php/php.ini-development /usr/local/etc/php/php.ini
6932
RUN chmod u+x /usr/local/bin/entrypoint.sh
7033

7134
RUN mkdir -p /mqdev
7235
WORKDIR /mqdev
7336

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

76-
CMD /usr/local/bin/entrypoint.sh
39+
CMD ["/usr/local/bin/entrypoint.sh"]

docker/bin/dev_entrypoiny.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
#!/usr/bin/env bash
1+
#!/usr/bin/env sh
22

33
while true; do sleep 1; done

docker/bin/test.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env bash
1+
#!/usr/bin/env sh
22

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

4949
#php pkg/enqueue-bundle/Tests/Functional/app/console.php config:dump-reference enqueue
50-
bin/phpunit "$@"
50+
php -d memory_limit=-1 bin/phpunit "$@"

docker/php/cli.ini

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error_reporting=E_ALL
1+
error_reporting=E_ALL&~E_DEPRECATED&~E_USER_DEPRECATED
22
display_errors=on
33
memory_limit = 2G
44
max_execution_time=0

pkg/dbal/DbalConsumerHelperTrait.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ protected function fetchMessage(array $queues, int $redeliveryDelay): ?DbalMessa
5353

5454
while (microtime(true) < $endAt) {
5555
try {
56-
$result = $select->execute()->fetch();
56+
$result = $select->execute()->fetchAssociative();
5757
if (empty($result)) {
5858
return null;
5959
}
@@ -69,7 +69,7 @@ protected function fetchMessage(array $queues, int $redeliveryDelay): ?DbalMessa
6969
->setParameter('deliveryId', $deliveryId, DbalType::GUID)
7070
->setMaxResults(1)
7171
->execute()
72-
->fetch();
72+
->fetchAssociative();
7373

7474
// the message has been removed by a 3rd party, such as truncate operation.
7575
if (false === $deliveredMessage) {

pkg/enqueue/Client/DriverFactory.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ private function findDriverInfo(Dsn $dsn, array $factories): ?array
7676
private function createRabbitMqStompDriver(ConnectionFactory $factory, Dsn $dsn, Config $config, RouteCollection $collection): RabbitMqStompDriver
7777
{
7878
$defaultManagementHost = $dsn->getHost() ?: $config->getTransportOption('host', 'localhost');
79-
$managementVast = ltrim($dsn->getPath(), '/') ?: $config->getTransportOption('vhost', '/');
79+
$managementVast = ltrim($dsn->getPath() ?? '', '/') ?: $config->getTransportOption('vhost', '/');
8080

8181
$managementClient = StompManagementClient::create(
8282
urldecode($managementVast),

pkg/enqueue/Symfony/Client/ConsumeCommand.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
9494
try {
9595
$consumer = $this->getQueueConsumer($client);
9696
} catch (NotFoundExceptionInterface $e) {
97-
throw new \LogicException(sprintf('Client "%s" is not supported.', $client), null, $e);
97+
throw new \LogicException(sprintf('Client "%s" is not supported.', $client), previous: $e);
9898
}
9999

100100
$driver = $this->getDriver($client);

pkg/enqueue/Symfony/Client/ProduceCommand.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
6767
try {
6868
$producer = $this->getProducer($client);
6969
} catch (NotFoundExceptionInterface $e) {
70-
throw new \LogicException(sprintf('Client "%s" is not supported.', $client), null, $e);
70+
throw new \LogicException(sprintf('Client "%s" is not supported.', $client), previous: $e);
7171
}
7272

7373
if ($topic) {

pkg/enqueue/Symfony/Client/RoutesCommand.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
6363
try {
6464
$this->driver = $this->getDriver($input->getOption('client'));
6565
} catch (NotFoundExceptionInterface $e) {
66-
throw new \LogicException(sprintf('Client "%s" is not supported.', $input->getOption('client')), null, $e);
66+
throw new \LogicException(sprintf('Client "%s" is not supported.', $input->getOption('client')), previous: $e);
6767
}
6868

6969
$routes = $this->driver->getRouteCollection()->all();

pkg/enqueue/Symfony/Client/SetupBrokerCommand.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
5555
try {
5656
$this->getDriver($client)->setupBroker(new ConsoleLogger($output));
5757
} catch (NotFoundExceptionInterface $e) {
58-
throw new \LogicException(sprintf('Client "%s" is not supported.', $client), null, $e);
58+
throw new \LogicException(sprintf('Client "%s" is not supported.', $client), previous: $e);
5959
}
6060

6161
$output->writeln('Broker set up');

0 commit comments

Comments
 (0)