From 48d989bd8bc10c347bf8572ad42b83d68225461f Mon Sep 17 00:00:00 2001 From: Bastian Waidelich Date: Fri, 15 Mar 2024 17:29:48 +0100 Subject: [PATCH] TASK: Tweak composer scripts * Move PHPCS configuration to `phpcs.xml.dist` * Reenable `PSR1.Files.SideEffects` PHPCS sniff (that was excluded with a864ced0eb0fd94e35a252efc9bdf923b021652f but that seems no longer to be necessary) * Add scripts `test:behavioral:sync` and `test:behavioral:stop-on-failure:sync` --- .composer.json | 14 ++++++++++---- .github/workflows/build.yml | 2 +- Readme.rst | 10 ++++------ composer.json | 14 ++++++++++---- phpcs.xml.dist | 15 +++++++++++++++ 5 files changed, 40 insertions(+), 15 deletions(-) create mode 100644 phpcs.xml.dist diff --git a/.composer.json b/.composer.json index 2d4b9ef0c20..6e8dfaf86ac 100644 --- a/.composer.json +++ b/.composer.json @@ -13,10 +13,8 @@ "provide": { }, "scripts": { - "lint:phpcs-psr12": "../../bin/phpcs --colors --standard=PSR12 ./Neos.ContentGraph.DoctrineDbalAdapter/src ./Neos.ContentGraph.PostgreSQLAdapter/src ./Neos.ContentRepository.BehavioralTests/Classes ./Neos.ContentRepository.TestSuite/Classes ./Neos.ContentRepository.Core/Classes ./Neos.Neos/Classes", - "lint:phpcs": [ - "@lint:phpcs-psr12 --exclude=Generic.Files.LineLength,PSR1.Files.SideEffects" - ], + "lint:phpcs": "../../bin/phpcs --colors", + "lint:phpcs:fix": "../../bin/phpcbf --colors", "lint:phpstan": "../../bin/phpstan analyse", "lint:phpstan-generate-baseline": "../../bin/phpstan analyse --generate-baseline", "lint:distributionintegrity": "[ -d 'Neos.ContentRepository' ] && { echo 'Package Neos.ContentRepository should not exist.' 1>&2; exit 1; } || exit 0;", @@ -47,6 +45,10 @@ "../../flow doctrine:migrate --quiet; ../../flow cr:setup", "@test:behat-cli -c Neos.Neos/Tests/Behavior/behat.yml" ], + "test:behavioral:sync": [ + "@putenv CATCHUPTRIGGER_ENABLE_SYNCHRONOUS_OPTION=1", + "@test:behavioral" + ], "test:behavioral:stop-on-failure": [ "@test:behat-cli -vvv --stop-on-failure -c Neos.ContentRepository.BehavioralTests/Tests/Behavior/behat.yml.dist", "@test:behat-cli -vvv --stop-on-failure -c Neos.ContentGraph.DoctrineDbalAdapter/Tests/Behavior/behat.yml.dist", @@ -56,6 +58,10 @@ "../../flow doctrine:migrate --quiet; ../../flow cr:setup", "@test:behat-cli -vvv --stop-on-failure -c Neos.Neos/Tests/Behavior/behat.yml" ], + "test:behavioral:stop-on-failure:sync": [ + "@putenv CATCHUPTRIGGER_ENABLE_SYNCHRONOUS_OPTION=1", + "@test:behavioral:stop-on-failure" + ], "test": [ "@test:unit", "@test:functional", diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1e8a30d1fc9..9774cd47fe3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -249,7 +249,7 @@ jobs: # DEBUG MODE: ALTERNATIVELY, comment in the following lines to dump the DB. # do not exit the script if the tests break; as we want to upload the database dumps afterwards. set +e - CATCHUPTRIGGER_ENABLE_SYNCHRONOUS_OPTION=1 composer test:behavioral:stop-on-failure + composer test:behavioral:stop-on-failure:sync retVal=$? # automatically search for race conditions diff --git a/Readme.rst b/Readme.rst index c77201c60e1..4e114e2462d 100644 --- a/Readme.rst +++ b/Readme.rst @@ -185,14 +185,15 @@ we use the right versions etc). .. code-block:: bash - bin/behat -c Packages/Neos/Neos.ContentRepository.BehavioralTests/Tests/Behavior/behat.yml.dist + cd Packages/Neos + composer test:behavioral Running all tests can take a long time, depending on the hardware. -To speed up the process, Behat tests can be executed in a "synchronous" mode by setting the `CATCHUPTRIGGER_ENABLE_SYNCHRONOUS_OPTION` environment variable: +To speed up the process, Behat tests can be executed in a "synchronous" mode: .. code-block:: bash - CATCHUPTRIGGER_ENABLE_SYNCHRONOUS_OPTION=1 bin/behat -c Packages/Neos/Neos.ContentRepository.BehavioralTests/Tests/Behavior/behat.yml.dist + composer test:behavioral:sync Alternatively, if you want to reproduce errors as they happen inside the CI system, but you develop on Mac OS, you might want to run the Behat tests in a Docker container (= a linux environment) @@ -211,7 +212,4 @@ described below also makes it easy to run the race-condition-detector: ../../../../../bin/behat -c behat.yml.dist - # To run tests in speed mode, run CATCHUPTRIGGER_ENABLE_SYNCHRONOUS_OPTION=1 - CATCHUPTRIGGER_ENABLE_SYNCHRONOUS_OPTION=1 ../../../../../bin/behat -c behat.yml.dist - FLOW_CONTEXT=Testing/Behat ../../../../../flow raceConditionTracker:analyzeTrace diff --git a/composer.json b/composer.json index b1dc6ed5afa..7ed066af48d 100644 --- a/composer.json +++ b/composer.json @@ -98,10 +98,8 @@ "neos/contentrepositoryregistry-storageclient": "self.version" }, "scripts": { - "lint:phpcs-psr12": "../../bin/phpcs --colors --standard=PSR12 ./Neos.ContentGraph.DoctrineDbalAdapter/src ./Neos.ContentGraph.PostgreSQLAdapter/src ./Neos.ContentRepository.BehavioralTests/Classes ./Neos.ContentRepository.TestSuite/Classes ./Neos.ContentRepository.Core/Classes ./Neos.Neos/Classes", - "lint:phpcs": [ - "@lint:phpcs-psr12 --exclude=Generic.Files.LineLength,PSR1.Files.SideEffects" - ], + "lint:phpcs": "../../bin/phpcs --colors", + "lint:phpcs:fix": "../../bin/phpcbf --colors", "lint:phpstan": "../../bin/phpstan analyse", "lint:phpstan-generate-baseline": "../../bin/phpstan analyse --generate-baseline", "lint:distributionintegrity": "[ -d 'Neos.ContentRepository' ] && { echo 'Package Neos.ContentRepository should not exist.' 1>&2; exit 1; } || exit 0;", @@ -127,6 +125,10 @@ "../../flow doctrine:migrate --quiet; ../../flow cr:setup", "@test:behat-cli -c Neos.Neos/Tests/Behavior/behat.yml" ], + "test:behavioral:sync": [ + "@putenv CATCHUPTRIGGER_ENABLE_SYNCHRONOUS_OPTION=1", + "@test:behavioral" + ], "test:behavioral:stop-on-failure": [ "@test:behat-cli -vvv --stop-on-failure -c Neos.ContentRepository.BehavioralTests/Tests/Behavior/behat.yml.dist", "@test:behat-cli -vvv --stop-on-failure -c Neos.ContentGraph.DoctrineDbalAdapter/Tests/Behavior/behat.yml.dist", @@ -136,6 +138,10 @@ "../../flow doctrine:migrate --quiet; ../../flow cr:setup", "@test:behat-cli -vvv --stop-on-failure -c Neos.Neos/Tests/Behavior/behat.yml" ], + "test:behavioral:stop-on-failure:sync": [ + "@putenv CATCHUPTRIGGER_ENABLE_SYNCHRONOUS_OPTION=1", + "@test:behavioral:stop-on-failure" + ], "test:parallel": [ "FLOW_CONTEXT=Testing/Behat ../../bin/paratest --debug -v --functional --group parallel --processes 2 --colors --stop-on-failure -c ../../Build/BuildEssentials/PhpUnit/FunctionalTests.xml Neos.ContentRepository.BehavioralTests/Tests/Functional/Feature/WorkspacePublication/WorkspaceWritingDuringPublication.php", "FLOW_CONTEXT=Testing/Behat ../../bin/paratest --debug -v --functional --group parallel --processes 2 --colors --stop-on-failure -c ../../Build/BuildEssentials/PhpUnit/FunctionalTests.xml Neos.ContentRepository.BehavioralTests/Tests/Functional/Feature/WorkspacePublication/WorkspaceWritingDuringPublication.php", diff --git a/phpcs.xml.dist b/phpcs.xml.dist new file mode 100644 index 00000000000..fc906b93b76 --- /dev/null +++ b/phpcs.xml.dist @@ -0,0 +1,15 @@ + + + The PSR12 coding standard – without line length limitation + + ./Neos.ContentGraph.DoctrineDbalAdapter/src + ./Neos.ContentGraph.PostgreSQLAdapter/src + ./Neos.ContentRepository.BehavioralTests/Classes + ./Neos.ContentRepository.TestSuite/Classes + ./Neos.ContentRepository.Core/Classes + ./Neos.Neos/Classes + + + + +