From c938bc869a0b8334a2af2a66c021163870b270aa Mon Sep 17 00:00:00 2001 From: Alexander Schranz Date: Fri, 5 Jul 2024 15:21:34 +0200 Subject: [PATCH] Add CI run for test lowest installed deps --- .github/workflows/ci.yml | 4 ++++ .gitignore | 1 + tests/lowest-dependencies.php | 41 +++++++++++++++++++++++++++++++++++ 3 files changed, 46 insertions(+) create mode 100644 tests/lowest-dependencies.php diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 33775b4ec9c..8930a638e70 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -54,6 +54,10 @@ jobs: composer self-update composer update --prefer-dist --optimize-autoloader --no-interaction --no-suggest ${{ matrix.composer-flags }} + - name: Check lowest dependencies + run: php tests/lowest-dependencies.php + if: ${{ matrix.composer-flags == '--prefer-lowest' }} + - name: Run setup tests run: vendor/bin/phpunit --configuration tests/config/${{ matrix.db }}.phpunit.xml tests/Oro/Tests/Connection/SetupTest.php diff --git a/.gitignore b/.gitignore index 912ac3bf71a..d7fc5b95ae2 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ phpunit.xml vendor/ composer.lock .idea/ +.phpunit.cache/ diff --git a/tests/lowest-dependencies.php b/tests/lowest-dependencies.php new file mode 100644 index 00000000000..df838c4f9c5 --- /dev/null +++ b/tests/lowest-dependencies.php @@ -0,0 +1,41 @@ + '1.14.0', + 'doctrine/lexer' => '2.0.0', + 'doctrine/dbal' => '3.3.6', + 'doctrine/orm' => '2.19.0', +]; + +foreach ($expectedDependencies as $expectedDependency => $expectedVersion) { + $dependency = null; + foreach ([...$dependencies['packages'], ...$dependencies['packages-dev']] as $package) { + if ($package['name'] === $expectedDependency) { + $dependency = $package; + break; + } + } + + if (null === $dependency) { + throw new RuntimeException('Missing dependency: ' . $expectedDependency); + } + + $dependencyVersion = $dependency['version']; + + if ($dependencyVersion !== $expectedVersion) { + throw new RuntimeException( + sprintf( + "Invalid version for %s. Expected: %s. Found: %s", + $expectedDependency, + $expectedVersion, + $dependencyVersion + ) + ); + } +} + +echo 'All dependencies are correct.' . \PHP_EOL;