Skip to content

Commit

Permalink
TASK: Tweak composer scripts
Browse files Browse the repository at this point in the history
* Move PHPCS configuration to `phpcs.xml.dist`
* Reenable `PSR1.Files.SideEffects` PHPCS sniff (that was excluded with a864ced but that seems no longer to be necessary)
* Add scripts `test:behavioral:sync` and `test:behavioral:stop-on-failure:sync`
  • Loading branch information
bwaidelich committed Mar 15, 2024
1 parent 7d7a44b commit 48d989b
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 15 deletions.
14 changes: 10 additions & 4 deletions .composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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;",
Expand Down Expand Up @@ -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",
Expand All @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 4 additions & 6 deletions Readme.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
14 changes: 10 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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;",
Expand All @@ -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",
Expand All @@ -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",
Expand Down
15 changes: 15 additions & 0 deletions phpcs.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" ?>
<ruleset name="PSR12">
<description>The PSR12 coding standard – without line length limitation</description>

<file>./Neos.ContentGraph.DoctrineDbalAdapter/src</file>
<file>./Neos.ContentGraph.PostgreSQLAdapter/src</file>
<file>./Neos.ContentRepository.BehavioralTests/Classes</file>
<file>./Neos.ContentRepository.TestSuite/Classes</file>
<file>./Neos.ContentRepository.Core/Classes</file>
<file>./Neos.Neos/Classes</file>

<rule ref="PSR12">
<exclude name="Generic.Files.LineLength.TooLong" />
</rule>
</ruleset>

0 comments on commit 48d989b

Please sign in to comment.