diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c29d8430c..163ebce91 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 @@ -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 @@ -37,19 +37,18 @@ 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 - name: Get Composer Cache Directory id: composer-cache - run: | - echo "::set-output name=dir::$(composer config cache-files-dir)" + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - - uses: actions/cache@v2 + - uses: actions/cache@v4 with: path: ${{ steps.composer-cache.outputs.dir }} key: composer-cs-check-${{ hashFiles('**/composer.json') }} @@ -58,7 +57,7 @@ jobs: - uses: shivammathur/setup-php@v2 with: - php-version: '7.4' + php-version: '8.2' coverage: none extensions: mongodb, redis, :xdebug ini-values: memory_limit=2048M @@ -77,30 +76,20 @@ jobs: strategy: fail-fast: false matrix: - php: ['7.4', '8.0', '8.1', '8.2'] - symfony_version: ['5.4.*', '6.2.*', '6.3.*'] - dependencies: ['--prefer-lowest', '--prefer-dist'] - exclude: - - php: '7.4' - symfony_version: '6.2.*' - - php: '7.4' - symfony_version: '6.3.*' - - php: '8.0' - symfony_version: '6.2.*' - - php: '8.0' - symfony_version: '6.3.*' + php: ['8.1', '8.2'] # same as in the container + symfony_version: ['5.4.*', '6.4.*',] + dependencies: ['--prefer-lowest', '--prefer-stable'] 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)" + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - - 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') }} @@ -127,30 +116,20 @@ jobs: strategy: fail-fast: false matrix: - php: ['7.4', '8.0', '8.1', '8.2'] # same as in the container - symfony_version: ['5.4.*', '6.2.*', '6.3.*'] - dependencies: ['--prefer-lowest', '--prefer-dist'] - exclude: - - php: '7.4' - symfony_version: '6.2.*' - - php: '7.4' - symfony_version: '6.3.*' - - php: '8.0' - symfony_version: '6.2.*' - - php: '8.0' - symfony_version: '6.3.*' + php: ['8.1', '8.2'] # same as in the container + symfony_version: ['5.4.*', '6.4.*',] + dependencies: ['--prefer-lowest', '--prefer-stable'] 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)" + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - - 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') }} @@ -181,3 +160,6 @@ jobs: - run: bin/test.sh --exclude-group=gearman if: ${{ matrix.php == '8.1' && matrix.php != '8.2' }} + + - run: docker-compose logs localstack + if: ${{ always() }} diff --git a/bin/dev b/bin/dev index a50b7ad66..79fbfc457 100755 --- a/bin/dev +++ b/bin/dev @@ -6,7 +6,7 @@ set -e while getopts "bustefdp" OPTION; do case $OPTION in b) - docker-compose pull -q && docker-compose build + docker-compose pull --progress quiet && docker-compose build ;; u) docker-compose up diff --git a/composer.json b/composer.json index 5c0108e27..acf7851d0 100644 --- a/composer.json +++ b/composer.json @@ -9,7 +9,7 @@ "phpstan": "bin/phpstan analyse --memory-limit=512M -c phpstan.neon" }, "require": { - "php": "^7.4|^8.0", + "php": "^8.1", "ext-amqp": "^1.9.3|^2.0.0", "ext-gearman": "^2.0", @@ -72,7 +72,8 @@ "kwn/php-rdkafka-stubs": "^2.0.3", "friendsofphp/php-cs-fixer": "^3.4", "dms/phpunit-arraysubset-asserts": "^0.2.1", - "phpspec/prophecy-phpunit": "^2.0" + "phpspec/prophecy-phpunit": "^2.0", + "symfony/http-foundation": "^5.4|^6.0" }, "autoload": { "psr-4": { @@ -137,4 +138,3 @@ } } } - diff --git a/docker-compose.yml b/docker-compose.yml index c5fa5545b..968c09889 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -129,11 +129,12 @@ services: localstack: image: 'localstack/localstack:0.8.10' ports: - - '4576:4576' - - '4575:4575' + - "4567-4597:4567-4597" environment: + DEFAULT_REGION: 'us-east-1' HOSTNAME_EXTERNAL: 'localstack' SERVICES: 'sqs,sns' + DEBUG: 'true' influxdb: image: 'influxdb:latest' diff --git a/docker/bin/test.sh b/docker/bin/test.sh index 2070584bb..9833f98d2 100755 --- a/docker/bin/test.sh +++ b/docker/bin/test.sh @@ -39,12 +39,12 @@ waitForService gearmand 4730 50 waitForService kafka 9092 50 waitForService mongo 27017 50 waitForService thruway 9090 50 -waitForService localstack 4576 50 +waitForService localstack 4576 70 php docker/bin/refresh-mysql-database.php || exit 1 php docker/bin/refresh-postgres-database.php || exit 1 php pkg/job-queue/Tests/Functional/app/console doctrine:database:create --if-not-exists || exit 1 -php pkg/job-queue/Tests/Functional/app/console doctrine:schema:update --force || exit 1 +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 "$@" diff --git a/pkg/amqp-ext/Tests/Functional/AmqpCommonUseCasesTest.php b/pkg/amqp-ext/Tests/Functional/AmqpCommonUseCasesTest.php index a90b1d306..0a74f1e2b 100644 --- a/pkg/amqp-ext/Tests/Functional/AmqpCommonUseCasesTest.php +++ b/pkg/amqp-ext/Tests/Functional/AmqpCommonUseCasesTest.php @@ -158,10 +158,11 @@ public function testConsumerReceiveMessageFromTopicDirectly() $this->amqpContext->declareTopic($topic); $consumer = $this->amqpContext->createConsumer($topic); - //guard + // guard $this->assertNull($consumer->receive(1000)); $message = $this->amqpContext->createMessage(__METHOD__); + $message->setDeliveryTag(1); $producer = $this->amqpContext->createProducer(); $producer->send($topic, $message); @@ -181,10 +182,11 @@ public function testConsumerReceiveMessageWithZeroTimeout() $this->amqpContext->declareTopic($topic); $consumer = $this->amqpContext->createConsumer($topic); - //guard + // guard $this->assertNull($consumer->receive(1000)); $message = $this->amqpContext->createMessage(__METHOD__); + $message->setDeliveryTag(1); $producer = $this->amqpContext->createProducer(); $producer->send($topic, $message); diff --git a/pkg/enqueue-bundle/Profiler/MessageQueueCollector.php b/pkg/enqueue-bundle/Profiler/MessageQueueCollector.php index 7fc6699c5..3c484a7d1 100644 --- a/pkg/enqueue-bundle/Profiler/MessageQueueCollector.php +++ b/pkg/enqueue-bundle/Profiler/MessageQueueCollector.php @@ -4,11 +4,10 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; -use Throwable; class MessageQueueCollector extends AbstractMessageQueueCollector { - public function collect(Request $request, Response $response, Throwable $exception = null) + public function collect(Request $request, Response $response, ?\Throwable $exception = null): void { $this->collectInternal($request, $response); } diff --git a/pkg/enqueue/Doctrine/DoctrineSchemaCompilerPass.php b/pkg/enqueue/Doctrine/DoctrineSchemaCompilerPass.php index 25016a761..0eb378470 100644 --- a/pkg/enqueue/Doctrine/DoctrineSchemaCompilerPass.php +++ b/pkg/enqueue/Doctrine/DoctrineSchemaCompilerPass.php @@ -11,7 +11,7 @@ class DoctrineSchemaCompilerPass implements CompilerPassInterface { - public function process(ContainerBuilder $container) + public function process(ContainerBuilder $container): void { if (false === $container->hasDefinition('doctrine')) { return; diff --git a/pkg/enqueue/Symfony/Client/ConsumeCommand.php b/pkg/enqueue/Symfony/Client/ConsumeCommand.php index 39af6d592..cdf8a8c9c 100644 --- a/pkg/enqueue/Symfony/Client/ConsumeCommand.php +++ b/pkg/enqueue/Symfony/Client/ConsumeCommand.php @@ -20,7 +20,7 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; -#[AsCommand('enqueue:consume')] +#[AsCommand(self::COMMAND_NAME)] class ConsumeCommand extends Command { use ChooseLoggerCommandTrait; @@ -28,7 +28,7 @@ class ConsumeCommand extends Command use QueueConsumerOptionsCommandTrait; use SetupBrokerExtensionCommandTrait; - protected static $defaultName = 'enqueue:consume'; + private const COMMAND_NAME = 'enqueue:consume'; /** * @var ContainerInterface @@ -68,7 +68,7 @@ public function __construct( $this->driverIdPattern = $driverIdPattern; $this->processorIdPattern = $processorIdPatter; - parent::__construct(self::$defaultName); + parent::__construct(self::COMMAND_NAME); } protected function configure(): void diff --git a/pkg/enqueue/Symfony/Client/ProduceCommand.php b/pkg/enqueue/Symfony/Client/ProduceCommand.php index 6064f82e1..e5215cd6f 100644 --- a/pkg/enqueue/Symfony/Client/ProduceCommand.php +++ b/pkg/enqueue/Symfony/Client/ProduceCommand.php @@ -13,10 +13,10 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; -#[AsCommand('enqueue:produce')] +#[AsCommand(self::COMMAND_NAME)] class ProduceCommand extends Command { - protected static $defaultName = 'enqueue:produce'; + private const COMMAND_NAME = 'enqueue:produce'; /** * @var ContainerInterface @@ -39,7 +39,7 @@ public function __construct(ContainerInterface $container, string $defaultClient $this->defaultClient = $defaultClient; $this->producerIdPattern = $producerIdPattern; - parent::__construct(static::$defaultName); + parent::__construct(self::COMMAND_NAME); } protected function configure(): void diff --git a/pkg/enqueue/Symfony/Client/RoutesCommand.php b/pkg/enqueue/Symfony/Client/RoutesCommand.php index 59a4a4d98..542633933 100644 --- a/pkg/enqueue/Symfony/Client/RoutesCommand.php +++ b/pkg/enqueue/Symfony/Client/RoutesCommand.php @@ -14,11 +14,10 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; -#[AsCommand('enqueue:routes')] +#[AsCommand(self::COMMAND_NAME)] class RoutesCommand extends Command { - protected static $defaultName = 'enqueue:routes'; - + private const COMMAND_NAME = 'enqueue:routes'; /** * @var ContainerInterface */ @@ -45,7 +44,7 @@ public function __construct(ContainerInterface $container, string $defaultClient $this->defaultClient = $defaultClient; $this->driverIdPatter = $driverIdPatter; - parent::__construct(static::$defaultName); + parent::__construct(self::COMMAND_NAME); } protected function configure(): void diff --git a/pkg/enqueue/Symfony/Client/SetupBrokerCommand.php b/pkg/enqueue/Symfony/Client/SetupBrokerCommand.php index 68aebb582..b23420715 100644 --- a/pkg/enqueue/Symfony/Client/SetupBrokerCommand.php +++ b/pkg/enqueue/Symfony/Client/SetupBrokerCommand.php @@ -12,10 +12,10 @@ use Symfony\Component\Console\Logger\ConsoleLogger; use Symfony\Component\Console\Output\OutputInterface; -#[AsCommand('enqueue:setup-broker')] +#[AsCommand(self::COMMAND_NAME)] class SetupBrokerCommand extends Command { - protected static $defaultName = 'enqueue:setup-broker'; + private const COMMAND_NAME = 'enqueue:setup-broker'; /** * @var ContainerInterface @@ -38,7 +38,7 @@ public function __construct(ContainerInterface $container, string $defaultClient $this->defaultClient = $defaultClient; $this->driverIdPattern = $driverIdPattern; - parent::__construct(static::$defaultName); + parent::__construct(self::COMMAND_NAME); } protected function configure(): void diff --git a/pkg/enqueue/Symfony/Consumption/ConfigurableConsumeCommand.php b/pkg/enqueue/Symfony/Consumption/ConfigurableConsumeCommand.php index 234eb0497..3dc648799 100644 --- a/pkg/enqueue/Symfony/Consumption/ConfigurableConsumeCommand.php +++ b/pkg/enqueue/Symfony/Consumption/ConfigurableConsumeCommand.php @@ -15,14 +15,14 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; -#[AsCommand('enqueue:transport:consume')] +#[AsCommand(self::COMMAND_NAME)] class ConfigurableConsumeCommand extends Command { use ChooseLoggerCommandTrait; use LimitsExtensionsCommandTrait; use QueueConsumerOptionsCommandTrait; - protected static $defaultName = 'enqueue:transport:consume'; + private const COMMAND_NAME = 'enqueue:transport:consume'; /** * @var ContainerInterface @@ -55,7 +55,7 @@ public function __construct( $this->queueConsumerIdPattern = $queueConsumerIdPattern; $this->processorRegistryIdPattern = $processorRegistryIdPattern; - parent::__construct(static::$defaultName); + parent::__construct(self::COMMAND_NAME); } protected function configure(): void diff --git a/pkg/enqueue/Symfony/Consumption/ConsumeCommand.php b/pkg/enqueue/Symfony/Consumption/ConsumeCommand.php index 870cc5f60..008982ff3 100644 --- a/pkg/enqueue/Symfony/Consumption/ConsumeCommand.php +++ b/pkg/enqueue/Symfony/Consumption/ConsumeCommand.php @@ -13,14 +13,14 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; -#[AsCommand('enqueue:transport:consume')] +#[AsCommand(self::COMMAND_NAME)] class ConsumeCommand extends Command { use ChooseLoggerCommandTrait; use LimitsExtensionsCommandTrait; use QueueConsumerOptionsCommandTrait; - protected static $defaultName = 'enqueue:transport:consume'; + private const COMMAND_NAME = 'enqueue:transport:consume'; /** * @var ContainerInterface @@ -43,7 +43,7 @@ public function __construct(ContainerInterface $container, string $defaultTransp $this->defaultTransport = $defaultTransport; $this->queueConsumerIdPattern = $queueConsumerIdPattern; - parent::__construct(static::$defaultName); + parent::__construct(self::COMMAND_NAME); } protected function configure(): void