Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Still support the latest older versions of doctrines orm 2, dbal 3 and lexer 3 #97

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
php: [8.1]
php: [8.1, 8.2, 8.3, 8.4]
db_image_name: [mysql, percona, postgres]
composer-flags: ['', '--prefer-lowest']
include:
- db_image_name: mysql
db_image_version: 8
Expand Down Expand Up @@ -51,7 +52,11 @@ jobs:
- name: Install dependencies
run: |
composer self-update
composer install --prefer-dist --optimize-autoloader --no-interaction --no-suggest
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
Expand All @@ -61,6 +66,7 @@ jobs:

- name: Check code style
run: vendor/bin/phpcs src/ tests/ -p --encoding=utf-8 --extensions=php --standard=psr2
if: ${{ matrix.composer-flags != '--prefer-lowest' }}

- name: Tear down tests
run: vendor/bin/phpunit --configuration tests/config/${{ matrix.db }}.phpunit.xml tests/Oro/Tests/Connection/TearDownTest.php
run: vendor/bin/phpunit --configuration tests/config/${{ matrix.db }}.phpunit.xml tests/Oro/Tests/Connection/TearDownTest.php
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ phpunit.xml
vendor/
composer.lock
.idea/
.phpunit.cache/
14 changes: 7 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@
],
"require": {
"php": ">=8.1",
"doctrine/lexer": "~3.0",
"doctrine/orm": "~3.0",
"doctrine/dbal": "~3.0|~4.0"
"doctrine/lexer": "^2.0|^3.0",
"doctrine/orm": "^2.19|^3.0",
"doctrine/dbal": "^3.3|^4.0"
},
"require-dev": {
"phpunit/phpunit": "~10",
"doctrine/data-fixtures": "^1.3",
"symfony/yaml": "5.*",
"symfony/cache": "5.*",
"doctrine/data-fixtures": "^1.6",
"symfony/yaml": "^5|^6|^7",
"symfony/cache": "^5|^6|^7",
"squizlabs/php_codesniffer": "3.9.*",
"doctrine/annotations": "~2.0"
"doctrine/annotations": "^1.14|^2.0"
},
"autoload": {
"psr-4": {
Expand Down
41 changes: 41 additions & 0 deletions tests/lowest-dependencies.php
Copy link
Contributor Author

@alexander-schranz alexander-schranz Jul 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This make sure that the CI not accidently not longer tests dbal 3, orm 2 or lexer 2 when being run on --prefer-lowest.

Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php

$content = file_get_contents(dirname(__DIR__) . '/composer.lock');

$dependencies = json_decode($content, true, \JSON_THROW_ON_ERROR);

$expectedDependencies = [
'doctrine/annotations' => '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;
Loading