From 052154f1e7ff622f202f926208bde5fbaf1a86a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dalibor=20Karlovi=C4=87?= Date: Fri, 13 Sep 2024 16:20:29 +0200 Subject: [PATCH] bump: all (#164) * bump: PHPQA 1.98.1 * bump: PHPUnit 11.x * bump: Backstop, Cypress browsers --- .github/workflows/build.yaml | 2 +- composer.json | 6 ++-- phpunit.xml.dist | 6 +++- resources/Lighthouse/common.mk | 2 +- resources/PHP/common.mk | 2 +- resources/PHP/common/phpunit.xml.dist | 6 +++- resources/Pimcore/library/phpunit.xml.dist | 6 +++- resources/Visual/common.mk | 2 +- tests/functional/MakefileTestCase.php | 32 +++++++++++----------- tests/functional/Node/CommonTest.php | 6 ++-- tests/functional/PHP/PhpTrait.php | 18 ++++++------ tests/functional/YASSG/CompatTest.php | 8 +++--- 12 files changed, 54 insertions(+), 42 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 4c81ba3..06a522b 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -11,7 +11,7 @@ jobs: PHP_VERSION: ${{ matrix.php }} strategy: matrix: - php: [ "8.1", "8.2", "8.3" ] + php: [ "8.2", "8.3" ] steps: - name: Repo checkout diff --git a/composer.json b/composer.json index 1298cbb..9c04f78 100644 --- a/composer.json +++ b/composer.json @@ -3,9 +3,9 @@ "description": "Sigwin's default per-project infra", "license": "MIT", "require-dev": { - "phpunit/phpunit": "^10.4", - "symfony/filesystem": "^6.0 || ^7.0", - "symfony/process": "^6.0 || ^7.0" + "phpunit/phpunit": "^11.3", + "symfony/filesystem": "^6.4 || ^7.0", + "symfony/process": "^6.4 || ^7.0" }, "autoload-dev": { "psr-4": { diff --git a/phpunit.xml.dist b/phpunit.xml.dist index ce7fb0d..eef2771 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -4,10 +4,14 @@ beStrictAboutChangesToGlobalState="true" beStrictAboutCoverageMetadata="true" beStrictAboutOutputDuringTests="true" - beStrictAboutTodoAnnotatedTests="true" bootstrap="./vendor/autoload.php" cacheDirectory="var/phpqa/phpunit" colors="true" + displayDetailsOnPhpunitDeprecations="true" + displayDetailsOnTestsThatTriggerDeprecations="true" + displayDetailsOnTestsThatTriggerErrors="true" + displayDetailsOnTestsThatTriggerNotices="true" + displayDetailsOnTestsThatTriggerWarnings="true" executionOrder="random" failOnEmptyTestSuite="true" failOnRisky="true" diff --git a/resources/Lighthouse/common.mk b/resources/Lighthouse/common.mk index 7b30af3..94edc33 100644 --- a/resources/Lighthouse/common.mk +++ b/resources/Lighthouse/common.mk @@ -1,4 +1,4 @@ -LIGHTHOUSE_DOCKER_IMAGE ?= cypress/browsers:node-20.13.1-chrome-125.0.6422.60-1-ff-126.0-edge-125.0.2535.51-1 +LIGHTHOUSE_DOCKER_IMAGE ?= cypress/browsers:node-20.17.0-chrome-128.0.6613.119-1-ff-130.0-edge-128.0.2739.63-1 LIGHTHOUSE_DOCKER_COMMAND ?= docker run --init --interactive ${DOCKER_TTY} --rm --env HOME=/tmp ${DOCKER_USER} --volume "${DOCKER_CWD}:/public" --workdir "/public" ${LIGHTHOUSE_DOCKER_IMAGE} analyze/lighthouse: ## Analyze built files using Lighthouse diff --git a/resources/PHP/common.mk b/resources/PHP/common.mk index 67dda91..5700487 100644 --- a/resources/PHP/common.mk +++ b/resources/PHP/common.mk @@ -10,7 +10,7 @@ PHP_VERSION=8.3 endif ifndef PHPQA_DOCKER_IMAGE -PHPQA_DOCKER_IMAGE=jakzal/phpqa:1.97.3-php${PHP_VERSION}-alpine +PHPQA_DOCKER_IMAGE=jakzal/phpqa:1.98.1-php${PHP_VERSION}-alpine endif ifndef PHPQA_DOCKER_COMMAND diff --git a/resources/PHP/common/phpunit.xml.dist b/resources/PHP/common/phpunit.xml.dist index 59fccf0..39ca347 100644 --- a/resources/PHP/common/phpunit.xml.dist +++ b/resources/PHP/common/phpunit.xml.dist @@ -4,10 +4,14 @@ beStrictAboutChangesToGlobalState="true" beStrictAboutCoverageMetadata="true" beStrictAboutOutputDuringTests="true" - beStrictAboutTodoAnnotatedTests="true" bootstrap="./vendor/autoload.php" cacheDirectory="var/phpqa/phpunit" colors="true" + displayDetailsOnPhpunitDeprecations="true" + displayDetailsOnTestsThatTriggerDeprecations="true" + displayDetailsOnTestsThatTriggerErrors="true" + displayDetailsOnTestsThatTriggerNotices="true" + displayDetailsOnTestsThatTriggerWarnings="true" enforceTimeLimit="true" executionOrder="random" failOnEmptyTestSuite="true" diff --git a/resources/Pimcore/library/phpunit.xml.dist b/resources/Pimcore/library/phpunit.xml.dist index f61096e..cb4de26 100644 --- a/resources/Pimcore/library/phpunit.xml.dist +++ b/resources/Pimcore/library/phpunit.xml.dist @@ -4,10 +4,14 @@ beStrictAboutChangesToGlobalState="true" beStrictAboutCoverageMetadata="true" beStrictAboutOutputDuringTests="true" - beStrictAboutTodoAnnotatedTests="true" bootstrap="./vendor/autoload.php" cacheDirectory="var/phpqa/phpunit" colors="true" + displayDetailsOnPhpunitDeprecations="true" + displayDetailsOnTestsThatTriggerDeprecations="true" + displayDetailsOnTestsThatTriggerErrors="true" + displayDetailsOnTestsThatTriggerNotices="true" + displayDetailsOnTestsThatTriggerWarnings="true" enforceTimeLimit="true" executionOrder="random" failOnEmptyTestSuite="true" diff --git a/resources/Visual/common.mk b/resources/Visual/common.mk index e38d00e..a02f12e 100644 --- a/resources/Visual/common.mk +++ b/resources/Visual/common.mk @@ -3,7 +3,7 @@ $(error BASE_URL must be defined before loading Visual/common.mk) endif PROJECT_ROOT = ${DOCKER_CWD} -BACKSTOP_DOCKER_IMAGE ?= backstopjs/backstopjs:6.3.23 +BACKSTOP_DOCKER_IMAGE ?= backstopjs/backstopjs:6.3.25 BACKSTOP_DOCKER_COMMAND ?= docker run --init --interactive ${TTY} --shm-size 256MB --cap-add=SYS_ADMIN --rm --env PROJECT_ROOT=${PROJECT_ROOT} --env BASE_URL=${BASE_URL} ${DOCKER_USER} --tmpfs /tmp --volume "${PROJECT_ROOT}:${PROJECT_ROOT}" --workdir "${PROJECT_ROOT}" ${BACKSTOP_DOCKER_IMAGE} --config backstop.config.js visual/test: ${BACKSTOP_DOCKER_COMMAND} test diff --git a/tests/functional/MakefileTestCase.php b/tests/functional/MakefileTestCase.php index 2f754a9..f5a9b8a 100644 --- a/tests/functional/MakefileTestCase.php +++ b/tests/functional/MakefileTestCase.php @@ -98,7 +98,7 @@ public function testHelpIsTheDefaultCommand(): void public function testMakefileHasInit(): void { - $expected = array_map(static fn (string $path): string => sprintf('if [ -d "$ROOT/resources/%1$s" ]; then cp -a $ROOT/resources/%1$s/. .; fi', $path), $this->getExpectedInitPaths()); + $expected = array_map(static fn (string $path): string => \sprintf('if [ -d "$ROOT/resources/%1$s" ]; then cp -a $ROOT/resources/%1$s/. .; fi', $path), $this->getExpectedInitPaths()); $expected = array_merge(...array_map(static fn ($value) => [$value, 'if [ -f .gitattributes.dist ]; then mv .gitattributes.dist .gitattributes; fi'], $expected)); $actual = self::dryRun('init'); @@ -138,7 +138,7 @@ protected function generateHelpList(array $commands): string $help = []; sort($commands); foreach ($commands as $command) { - $help[] = sprintf('%1$s[45m%2$s%1$s[0m %3$s', "\e", mb_str_pad($command, 20), $this->helpOverride[$command] ?? $this->help[$command] ?? ''); + $help[] = \sprintf('%1$s[45m%2$s%1$s[0m %3$s', "\e", mb_str_pad($command, 20), $this->helpOverride[$command] ?? $this->help[$command] ?? ''); } return implode("\n", $help)."\n"; @@ -168,7 +168,7 @@ protected static function generateHelpExecutionPath(array $files = [], array $ad return $item; } - return str_replace('$ROOT/resources', '$ROOT\\resources', str_replace('\\', '/', self::normalize($item))); + return str_replace('$ROOT/resources', '$ROOT\resources', str_replace('\\', '/', self::normalize($item))); }, $files, array_keys($files))).' | Sort-Object {$_.Matches[0].Groups["name"]} | ForEach-Object{"{0, -20}" -f $_.Matches[0].Groups["name"] | Write-Host -NoNewline -BackgroundColor Magenta -ForegroundColor White; " {0}" -f $_.Matches[0].Groups["help"] | Write-Host -ForegroundColor White}', default => throw new \LogicException('Unknown OS family'), }; @@ -185,16 +185,16 @@ protected static function generatePermissionsExecutionPath(array $dirs): array { $commands = []; foreach ($dirs as $dir) { - $commands[] = sprintf('mkdir -p %1$s', $dir); + $commands[] = \sprintf('mkdir -p %1$s', $dir); if (\PHP_OS_FAMILY === 'Linux') { - $commands[] = sprintf('setfacl -dRm m:rwX %1$s', $dir); - $commands[] = sprintf('setfacl -Rm m:rwX %1$s', $dir); - $commands[] = sprintf('setfacl -dRm u:`whoami`:rwX %1$s', $dir); - $commands[] = sprintf('setfacl -Rm u:`whoami`:rwX %1$s', $dir); - $commands[] = sprintf('setfacl -dRm u:999:rwX %1$s', $dir); - $commands[] = sprintf('setfacl -Rm u:999:rwX %1$s', $dir); - $commands[] = sprintf('setfacl -dRm u:root:rwX %1$s', $dir); - $commands[] = sprintf('setfacl -Rm u:root:rwX %1$s', $dir); + $commands[] = \sprintf('setfacl -dRm m:rwX %1$s', $dir); + $commands[] = \sprintf('setfacl -Rm m:rwX %1$s', $dir); + $commands[] = \sprintf('setfacl -dRm u:`whoami`:rwX %1$s', $dir); + $commands[] = \sprintf('setfacl -Rm u:`whoami`:rwX %1$s', $dir); + $commands[] = \sprintf('setfacl -dRm u:999:rwX %1$s', $dir); + $commands[] = \sprintf('setfacl -Rm u:999:rwX %1$s', $dir); + $commands[] = \sprintf('setfacl -dRm u:root:rwX %1$s', $dir); + $commands[] = \sprintf('setfacl -Rm u:root:rwX %1$s', $dir); } } @@ -214,7 +214,7 @@ public static function provideMakefileCommandsWorkCases(): iterable foreach ($envs as $env) { $expected = static::getExpectedHelpCommandsExecutionPath($env); foreach ($commands as $command) { - self::assertArrayHasKey($command, $expected, sprintf('No expected execution path defined for command "%1$s"', $command)); + self::assertArrayHasKey($command, $expected, \sprintf('No expected execution path defined for command "%1$s"', $command)); } foreach ($expected as $command => $path) { @@ -233,7 +233,7 @@ protected static function getMakefilePath(): string } $name = mb_substr($name, 0, -4); - return sprintf('resources%2$s%1$s%2$s%3$s.mk', $dir, \DIRECTORY_SEPARATOR, mb_strtolower($name)); + return \sprintf('resources%2$s%1$s%2$s%3$s.mk', $dir, \DIRECTORY_SEPARATOR, mb_strtolower($name)); } /** @@ -293,7 +293,7 @@ protected static function execute( 'PHP_VERSION' => '', 'GITHUB_ACTIONS' => '', 'COMPOSE_PROJECT_NAME' => 'infra', - 'PIMCORE_KERNEL_CLASS' => 'App\\Kernel', + 'PIMCORE_KERNEL_CLASS' => 'App\Kernel', ], $env ?? []), ); @@ -372,6 +372,6 @@ protected static function normalize(string $output): string protected static function generateDockerComposeExecutionUser(): string { - return \PHP_OS_FAMILY !== 'Windows' ? sprintf('--user "%1$s:%2$s"', getmyuid(), getmygid()) : ''; + return \PHP_OS_FAMILY !== 'Windows' ? \sprintf('--user "%1$s:%2$s"', getmyuid(), getmygid()) : ''; } } diff --git a/tests/functional/Node/CommonTest.php b/tests/functional/Node/CommonTest.php index 7c95946..73ade47 100644 --- a/tests/functional/Node/CommonTest.php +++ b/tests/functional/Node/CommonTest.php @@ -50,11 +50,11 @@ protected function getExpectedInitPaths(): array private static function generateNodeExecutionPath(string $command, string $nodeVersion, string $dockerImage, string $env): string { - return self::normalize(sprintf( + return self::normalize(\sprintf( 'docker run --init --interactive --rm %4$s%2$s --volume "$ROOT:/project" --volume "$HOME/.npm:/home/node/.npm" --workdir /project %3$s %1$s', - sprintf($command, $nodeVersion), + \sprintf($command, $nodeVersion), self::generateDockerComposeExecutionUser(), - sprintf($dockerImage, $nodeVersion), + \sprintf($dockerImage, $nodeVersion), $env )); } diff --git a/tests/functional/PHP/PhpTrait.php b/tests/functional/PHP/PhpTrait.php index 583c3af..25eb5ba 100644 --- a/tests/functional/PHP/PhpTrait.php +++ b/tests/functional/PHP/PhpTrait.php @@ -69,7 +69,7 @@ private static function paths(?array $env): array { // defaults which are also defined in the Makefile $phpVersion = $env['PHP_VERSION'] ?? '8.3'; - $phpqaDockerImage = $env['PHPQA_DOCKER_IMAGE'] ?? 'jakzal/phpqa:1.97.3-php%1$s-alpine'; + $phpqaDockerImage = $env['PHPQA_DOCKER_IMAGE'] ?? 'jakzal/phpqa:1.98.1-php%1$s-alpine'; $dockerEnv = $env['DOCKER_ENV'] ?? ' '; return [ @@ -201,33 +201,33 @@ private static function paths(?array $env): array private static function generatePhpqaExecutionPath(string $command, string $phpVersion, string $dockerImage, string $env): string { - return self::normalize(sprintf( + return self::normalize(\sprintf( 'docker run --init --interactive --rm %4$s--env "COMPOSER_CACHE_DIR=/composer/cache" %2$s --volume "$ROOT/var/phpqa:/cache" --volume "$ROOT:/project" --volume "$HOME/.composer:/composer" --workdir /project %3$s %1$s', - sprintf($command, $phpVersion), + \sprintf($command, $phpVersion), self::generateDockerComposeExecutionUser(), - sprintf($dockerImage, $phpVersion), + \sprintf($dockerImage, $phpVersion), $env )); } private static function generateDockerBuildxExecutionPath(string $env): string { - return sprintf('VERSION=latest docker buildx bake --load --file docker-compose.yaml --set *.args.BASE_URL=http://example.com/ --file .infra/docker-buildx/docker-buildx.%1$s.hcl', $env); + return \sprintf('VERSION=latest docker buildx bake --load --file docker-compose.yaml --set *.args.BASE_URL=http://example.com/ --file .infra/docker-buildx/docker-buildx.%1$s.hcl', $env); } private static function generateDockerComposeAppExecutionPath(string $command, string $env = 'env'): string { - return sprintf('VERSION=latest docker compose --file docker-compose.yaml --file .infra/docker-compose/docker-compose.%2$s.yaml %1$s', $command, $env); + return \sprintf('VERSION=latest docker compose --file docker-compose.yaml --file .infra/docker-compose/docker-compose.%2$s.yaml %1$s', $command, $env); } private static function generateDockerComposeTestExecutionPath(string $command): string { - return sprintf('COMPOSE_PROJECT_NAME=infra docker compose --file tests/runtime/docker-compose.yaml %1$s', $command); + return \sprintf('COMPOSE_PROJECT_NAME=infra docker compose --file tests/runtime/docker-compose.yaml %1$s', $command); } private static function generateDockerComposeAppExecExecutionPath(string $command, string $env = 'env'): string { - return self::generateDockerComposeAppExecutionPath(sprintf( + return self::generateDockerComposeAppExecutionPath(\sprintf( 'exec %2$s app %1$s', $command, self::generateDockerComposeExecutionUser() @@ -236,7 +236,7 @@ private static function generateDockerComposeAppExecExecutionPath(string $comman private static function generateDockerComposeTestExecExecutionPath(string $command): string { - return self::generateDockerComposeTestExecutionPath(sprintf( + return self::generateDockerComposeTestExecutionPath(\sprintf( 'exec %2$s --env PIMCORE_KERNEL_CLASS=App\Kernel app %1$s', $command, self::generateDockerComposeExecutionUser() diff --git a/tests/functional/YASSG/CompatTest.php b/tests/functional/YASSG/CompatTest.php index 4fb315c..b030a43 100644 --- a/tests/functional/YASSG/CompatTest.php +++ b/tests/functional/YASSG/CompatTest.php @@ -118,8 +118,8 @@ public function testDevComposeWorks(): void private static function generateDockerBackstopExecutionPath(string $command): string { - return sprintf( - 'docker run --init --interactive --shm-size 256MB --cap-add=SYS_ADMIN --rm --env PROJECT_ROOT=$ROOT --env BASE_URL=file://localhost$ROOT/public %2$s --tmpfs /tmp --volume "$ROOT:$ROOT" --workdir "$ROOT" backstopjs/backstopjs:6.3.23 --config backstop.config.js %1$s', + return \sprintf( + 'docker run --init --interactive --shm-size 256MB --cap-add=SYS_ADMIN --rm --env PROJECT_ROOT=$ROOT --env BASE_URL=file://localhost$ROOT/public %2$s --tmpfs /tmp --volume "$ROOT:$ROOT" --workdir "$ROOT" backstopjs/backstopjs:6.3.25 --config backstop.config.js %1$s', $command, self::generateDockerComposeExecutionUser() ); @@ -127,8 +127,8 @@ private static function generateDockerBackstopExecutionPath(string $command): st private static function generateDockerLighthouseExecutionPath(string $command): string { - return sprintf( - 'docker run --init --interactive --rm --env HOME=/tmp %2$s --volume "$ROOT:/public" --workdir "/public" cypress/browsers:node-20.13.1-chrome-125.0.6422.60-1-ff-126.0-edge-125.0.2535.51-1 %1$s', + return \sprintf( + 'docker run --init --interactive --rm --env HOME=/tmp %2$s --volume "$ROOT:/public" --workdir "/public" cypress/browsers:node-20.17.0-chrome-128.0.6613.119-1-ff-130.0-edge-128.0.2739.63-1 %1$s', $command, self::generateDockerComposeExecutionUser() );