Skip to content

Commit

Permalink
bump: all (#164)
Browse files Browse the repository at this point in the history
* bump: PHPQA 1.98.1

* bump: PHPUnit 11.x

* bump: Backstop, Cypress browsers
  • Loading branch information
dkarlovi authored Sep 13, 2024
1 parent 1ef4cef commit 052154f
Show file tree
Hide file tree
Showing 12 changed files with 54 additions and 42 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
6 changes: 5 additions & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion resources/Lighthouse/common.mk
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion resources/PHP/common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion resources/PHP/common/phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 5 additions & 1 deletion resources/Pimcore/library/phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion resources/Visual/common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
32 changes: 16 additions & 16 deletions tests/functional/MakefileTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand Down Expand Up @@ -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";
Expand Down Expand Up @@ -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'),
};
Expand All @@ -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);
}
}

Expand All @@ -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) {
Expand All @@ -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));
}

/**
Expand Down Expand Up @@ -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 ?? []),
);

Expand Down Expand Up @@ -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()) : '';
}
}
6 changes: 3 additions & 3 deletions tests/functional/Node/CommonTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
));
}
Expand Down
18 changes: 9 additions & 9 deletions tests/functional/PHP/PhpTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 [
Expand Down Expand Up @@ -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()
Expand All @@ -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()
Expand Down
8 changes: 4 additions & 4 deletions tests/functional/YASSG/CompatTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,17 +118,17 @@ 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()
);
}

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()
);
Expand Down

0 comments on commit 052154f

Please sign in to comment.