From d9a8c884ba0d98e3f609b60b52443a175c41fb51 Mon Sep 17 00:00:00 2001 From: exaby73 Date: Wed, 7 Aug 2024 09:57:33 +0530 Subject: [PATCH 01/18] feat: Update dependencies --- composer.json | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/composer.json b/composer.json index d825c55..4a1097b 100644 --- a/composer.json +++ b/composer.json @@ -11,22 +11,22 @@ } ], "require": { - "php": ">=8.0", - "laudis/neo4j-php-client": "^3.0.5", + "php": ">=8.1", + "laudis/neo4j-php-client": "^3.1", "twig/twig": "^3.0", "ext-json": "*", - "symfony/dependency-injection": "^5.4 || ^6.0", - "symfony/config": "^5.4 || ^6.0" + "symfony/dependency-injection": "^5.4 || ^6.0 || ^7.0", + "symfony/config": "^5.4 || ^6.0 || ^7.0" }, "require-dev": { "matthiasnoback/symfony-dependency-injection-test": "^4.3", "phpunit/phpunit": "^9.5", "psalm/plugin-symfony": "^5.0", - "symfony/console": "^5.4 || ^6.0", - "symfony/framework-bundle": "^5.4 || ^6.0", - "symfony/http-kernel": "^5.4 || ^6.0", + "symfony/console": "^5.4 || ^6.0 || ^7.0", + "symfony/framework-bundle": "^5.4 || ^6.0 || ^7.0", + "symfony/http-kernel": "^5.4 || ^6.0 || ^7.0", "symfony/test-pack": "^1.1", - "symfony/yaml": "^5.4 || ^6.0", + "symfony/yaml": "^5.4 || ^6.0 || ^7.0", "vimeo/psalm": "^5.15.0", "kubawerlos/php-cs-fixer-custom-fixers": "^3.0", "friendsofphp/php-cs-fixer": "^3.30", From 5a77ee3f9155ba5e75ea6ebb0fb72f4358520132 Mon Sep 17 00:00:00 2001 From: exaby73 Date: Wed, 7 Aug 2024 10:08:28 +0530 Subject: [PATCH 02/18] feat: Update Github actions --- .github/workflows/static-analysis.yml | 2 +- .github/workflows/tests.yml | 26 ++++++++++++++++++-------- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index dcff7f6..ca1cfde 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -16,7 +16,7 @@ jobs: - uses: php-actions/composer@v6 with: progress: yes - php_version: 8.0 + php_version: 8.1 version: 2 - name: "PHP-CS-Fixer" run: composer check-cs diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index f75f202..b7eb8be 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -14,19 +14,29 @@ jobs: strategy: max-parallel: 10 matrix: - php: [ '8.0', '8.1', '8.2'] - sf_version: [ '5.4.*', '6.0.*', '6.3.*' ] + php: [ '8.1', '8.2', '8.3'] + sf_version: [ '5.4.*', '6.4.*', '7.1.*' ] exclude: - - php: 8.0 - sf_version: 6.3.* + - php: 8.1 + sf_version: 7.1.* steps: - uses: actions/checkout@v2 - - uses: php-actions/composer@v6 + - name: Validate composer.json + run: composer validate --strict + + - name: Setup PHP ${{ matrix.php }} + uses: shivammathur/setup-php@v2 with: - progress: yes - php_version: ${{matrix.php}} - version: 2 + php-version: ${{ matrix.php }} + run: php -v + + - name: Install symfony/flex + run: composer global require --no-progress --no-scripts --no-plugins symfony/flex + + - name: Composer update on php ${{ matrix.php }} and symfony ${{ matrix.sf_version }} + run: export SYMFONY_REQUIRE=${{ matrix.sf_version }} composer update --prefer-dist --no-progress + - uses: php-actions/phpunit@v3 with: configuration: phpunit.xml.dist From fbef4de88fbfbcf2babf7867e131210c9614a7ab Mon Sep 17 00:00:00 2001 From: exaby73 Date: Wed, 7 Aug 2024 10:11:05 +0530 Subject: [PATCH 03/18] fix: Run CS --- src/ClientFactory.php | 18 +++++++++--------- src/Collector/Neo4jDataCollector.php | 2 +- src/Event/FailureEvent.php | 4 ++-- src/Event/PostRunEvent.php | 4 ++-- src/Event/PreRunEvent.php | 4 ++-- src/EventHandler.php | 2 +- src/SymfonyClient.php | 22 +++++++++++----------- src/SymfonyTransaction.php | 2 +- 8 files changed, 29 insertions(+), 29 deletions(-) diff --git a/src/ClientFactory.php b/src/ClientFactory.php index 05a2e37..972f7e1 100644 --- a/src/ClientFactory.php +++ b/src/ClientFactory.php @@ -40,14 +40,14 @@ class ClientFactory */ public function __construct( private EventHandler $eventHandler, - private array|null $driverConfig, - private array|null $sessionConfiguration, - private array|null $transactionConfiguration, + private ?array $driverConfig, + private ?array $sessionConfiguration, + private ?array $transactionConfiguration, private array $connections, - private string|null $defaultDriver, - private ClientInterface|null $client, - private StreamFactoryInterface|null $streamFactory, - private RequestFactoryInterface|null $requestFactory, + private ?string $defaultDriver, + private ?ClientInterface $client, + private ?StreamFactoryInterface $streamFactory, + private ?RequestFactoryInterface $requestFactory, ) { } @@ -134,7 +134,7 @@ private function makeTransactionConfig(): TransactionConfiguration /** * @param DriverAuthenticationArray|null $auth */ - private function createAuth(array|null $auth, string $dsn): AuthenticateInterface + private function createAuth(?array $auth, string $dsn): AuthenticateInterface { if (null === $auth) { return Authenticate::fromUrl(Uri::create($dsn)); @@ -155,7 +155,7 @@ private function createAuth(array|null $auth, string $dsn): AuthenticateInterfac /** * @param SslConfigArray|null $ssl */ - private function makeSslConfig(array|null $ssl): SslConfiguration + private function makeSslConfig(?array $ssl): SslConfiguration { if (null === $ssl) { return new SslConfiguration( diff --git a/src/Collector/Neo4jDataCollector.php b/src/Collector/Neo4jDataCollector.php index 9014743..2e3f739 100644 --- a/src/Collector/Neo4jDataCollector.php +++ b/src/Collector/Neo4jDataCollector.php @@ -27,7 +27,7 @@ public function __construct( ) { } - public function collect(Request $request, Response $response, \Throwable $exception = null): void + public function collect(Request $request, Response $response, ?\Throwable $exception = null): void { $this->data['successful_statements'] = array_map( static fn (ResultSummary $summary) => $summary->toArray(), diff --git a/src/Event/FailureEvent.php b/src/Event/FailureEvent.php index f5e1c61..2981193 100644 --- a/src/Event/FailureEvent.php +++ b/src/Event/FailureEvent.php @@ -14,7 +14,7 @@ class FailureEvent extends Event protected bool $shouldThrowException = true; - public function __construct(private string|null $alias, private Statement $statement, private Neo4jException $exception) + public function __construct(private ?string $alias, private Statement $statement, private Neo4jException $exception) { } @@ -33,7 +33,7 @@ public function shouldThrowException(): bool return $this->shouldThrowException; } - public function getAlias(): string|null + public function getAlias(): ?string { return $this->alias; } diff --git a/src/Event/PostRunEvent.php b/src/Event/PostRunEvent.php index 75e9a96..b0bf84b 100644 --- a/src/Event/PostRunEvent.php +++ b/src/Event/PostRunEvent.php @@ -12,7 +12,7 @@ class PostRunEvent extends Event public const EVENT_ID = 'neo4j.post_run'; public function __construct( - private string|null $alias, + private ?string $alias, private ResultSummary $result ) { } @@ -22,7 +22,7 @@ public function getResult(): ResultSummary return $this->result; } - public function getAlias(): string|null + public function getAlias(): ?string { return $this->alias; } diff --git a/src/Event/PreRunEvent.php b/src/Event/PreRunEvent.php index cd59239..6ab3f4d 100644 --- a/src/Event/PreRunEvent.php +++ b/src/Event/PreRunEvent.php @@ -11,7 +11,7 @@ class PreRunEvent extends Event { public const EVENT_ID = 'neo4j.pre_run'; - public function __construct(private string|null $alias, private Statement $statement) + public function __construct(private ?string $alias, private Statement $statement) { } @@ -20,7 +20,7 @@ public function getStatement(): Statement return $this->statement; } - public function getAlias(): string|null + public function getAlias(): ?string { return $this->alias; } diff --git a/src/EventHandler.php b/src/EventHandler.php index 34579c5..ce2a83c 100644 --- a/src/EventHandler.php +++ b/src/EventHandler.php @@ -36,7 +36,7 @@ public function __construct(?EventDispatcherInterface $dispatcher) * * @return SummarizedResult */ - public function handle(callable $runHandler, Statement $statement, string|null $alias): SummarizedResult + public function handle(callable $runHandler, Statement $statement, ?string $alias): SummarizedResult { if (null === $this->dispatcher) { return $runHandler($statement); diff --git a/src/SymfonyClient.php b/src/SymfonyClient.php index efceb9d..615f748 100644 --- a/src/SymfonyClient.php +++ b/src/SymfonyClient.php @@ -30,17 +30,17 @@ public function __construct( ) { } - public function run(string $statement, iterable $parameters = [], string $alias = null): ?SummarizedResult + public function run(string $statement, iterable $parameters = [], ?string $alias = null): ?SummarizedResult { return $this->runStatement(new Statement($statement, $parameters), $alias); } - public function runStatement(Statement $statement, string $alias = null): ?SummarizedResult + public function runStatement(Statement $statement, ?string $alias = null): ?SummarizedResult { return $this->handler->handle(fn (Statement $statement) => $this->client->runStatement($statement, $alias), $statement, $alias); } - public function runStatements(iterable $statements, string $alias = null): CypherList + public function runStatements(iterable $statements, ?string $alias = null): CypherList { $tbr = []; foreach ($statements as $statement) { @@ -50,7 +50,7 @@ public function runStatements(iterable $statements, string $alias = null): Cyphe return CypherList::fromIterable($tbr); } - public function beginTransaction(iterable $statements = null, string $alias = null, TransactionConfiguration $config = null): UnmanagedTransactionInterface + public function beginTransaction(?iterable $statements = null, ?string $alias = null, ?TransactionConfiguration $config = null): UnmanagedTransactionInterface { $tsx = new SymfonyTransaction($this->client->beginTransaction(null, $alias, $config), $this->handler, $alias); @@ -68,7 +68,7 @@ public function getDriver(?string $alias): DriverInterface return $this->client->getDriver($alias); } - public function writeTransaction(callable $tsxHandler, string $alias = null, TransactionConfiguration $config = null) + public function writeTransaction(callable $tsxHandler, ?string $alias = null, ?TransactionConfiguration $config = null) { $sessionConfig = SessionConfiguration::default()->withAccessMode(AccessMode::READ()); $session = $this->client->getDriver($alias)->createSession($sessionConfig); @@ -79,7 +79,7 @@ public function writeTransaction(callable $tsxHandler, string $alias = null, Tra ); } - public function readTransaction(callable $tsxHandler, string $alias = null, TransactionConfiguration $config = null) + public function readTransaction(callable $tsxHandler, ?string $alias = null, ?TransactionConfiguration $config = null) { $sessionConfig = SessionConfiguration::default()->withAccessMode(AccessMode::WRITE()); $session = $this->client->getDriver($alias)->createSession($sessionConfig); @@ -90,27 +90,27 @@ public function readTransaction(callable $tsxHandler, string $alias = null, Tran ); } - public function transaction(callable $tsxHandler, string $alias = null, TransactionConfiguration $config = null) + public function transaction(callable $tsxHandler, ?string $alias = null, ?TransactionConfiguration $config = null) { return $this->writeTransaction($tsxHandler, $alias, $config); } - public function verifyConnectivity(string $driver = null): bool + public function verifyConnectivity(?string $driver = null): bool { return $this->client->verifyConnectivity($driver); } - public function bindTransaction(string $alias = null, TransactionConfiguration $config = null): void + public function bindTransaction(?string $alias = null, ?TransactionConfiguration $config = null): void { $this->client->bindTransaction($alias, $config); } - public function commitBoundTransaction(string $alias = null, int $depth = 1): void + public function commitBoundTransaction(?string $alias = null, int $depth = 1): void { $this->client->commitBoundTransaction($alias, $depth); } - public function rollbackBoundTransaction(string $alias = null, int $depth = 1): void + public function rollbackBoundTransaction(?string $alias = null, int $depth = 1): void { $this->client->rollbackBoundTransaction($alias, $depth); } diff --git a/src/SymfonyTransaction.php b/src/SymfonyTransaction.php index fee502b..bc8a46a 100644 --- a/src/SymfonyTransaction.php +++ b/src/SymfonyTransaction.php @@ -18,7 +18,7 @@ class SymfonyTransaction implements UnmanagedTransactionInterface /** * @param UnmanagedTransactionInterface> $tsx */ - public function __construct(private UnmanagedTransactionInterface $tsx, private EventHandler $handler, private string|null $alias) + public function __construct(private UnmanagedTransactionInterface $tsx, private EventHandler $handler, private ?string $alias) { } From aee20516bc57751ffe854171c3209c552ce88642 Mon Sep 17 00:00:00 2001 From: exaby73 Date: Wed, 7 Aug 2024 10:11:48 +0530 Subject: [PATCH 04/18] fix: Run CI on pull_request --- .github/workflows/tests.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b7eb8be..6457b8f 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -4,8 +4,6 @@ on: branches: - master pull_request: - branches: - - master jobs: build: From f41bd7d4dc43d52e0eb955e2b57b057421b6d085 Mon Sep 17 00:00:00 2001 From: exaby73 Date: Wed, 7 Aug 2024 10:25:39 +0530 Subject: [PATCH 05/18] ci: run on PHP setup step --- .github/workflows/tests.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 6457b8f..40bae0a 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -27,7 +27,6 @@ jobs: uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php }} - run: php -v - name: Install symfony/flex run: composer global require --no-progress --no-scripts --no-plugins symfony/flex From 3e3c53d0fc1c352ead04f77308ff681388e5f7e2 Mon Sep 17 00:00:00 2001 From: exaby73 Date: Wed, 7 Aug 2024 10:29:28 +0530 Subject: [PATCH 06/18] ci: Use composer action --- .github/workflows/tests.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 40bae0a..ba38cab 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -28,11 +28,10 @@ jobs: with: php-version: ${{ matrix.php }} - - name: Install symfony/flex - run: composer global require --no-progress --no-scripts --no-plugins symfony/flex - - - name: Composer update on php ${{ matrix.php }} and symfony ${{ matrix.sf_version }} - run: export SYMFONY_REQUIRE=${{ matrix.sf_version }} composer update --prefer-dist --no-progress + - name: Install dependencies + uses: php-actions/composer@v6 + with: + command: export SYMFONY_REQUIRE=${{ matrix.sf_version }} composer update - uses: php-actions/phpunit@v3 with: From d0f9fd8947f8c6072fc9f11f9f0a37f07daeac9b Mon Sep 17 00:00:00 2001 From: exaby73 Date: Wed, 7 Aug 2024 10:30:53 +0530 Subject: [PATCH 07/18] ci: Move back to manual composer setup, and fix command --- .github/workflows/tests.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ba38cab..9b9371b 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -28,10 +28,11 @@ jobs: with: php-version: ${{ matrix.php }} - - name: Install dependencies - uses: php-actions/composer@v6 - with: - command: export SYMFONY_REQUIRE=${{ matrix.sf_version }} composer update + - name: Install symfony/flex + run: composer global require --no-progress --no-scripts --no-plugins symfony/flex + + - name: Composer update on php ${{ matrix.php }} and symfony ${{ matrix.sf_version }} + run: export SYMFONY_REQUIRE=${{ matrix.sf_version }} composer update - uses: php-actions/phpunit@v3 with: From 09f52172f0edc36b0b3d13a19a6ceb439a26f2fd Mon Sep 17 00:00:00 2001 From: exaby73 Date: Wed, 7 Aug 2024 10:36:11 +0530 Subject: [PATCH 08/18] ci: Use env with composer action --- .github/workflows/tests.yml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 9b9371b..614d3c1 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -4,6 +4,8 @@ on: branches: - master pull_request: + branches: + - master jobs: build: @@ -28,11 +30,12 @@ jobs: with: php-version: ${{ matrix.php }} - - name: Install symfony/flex - run: composer global require --no-progress --no-scripts --no-plugins symfony/flex - - - name: Composer update on php ${{ matrix.php }} and symfony ${{ matrix.sf_version }} - run: export SYMFONY_REQUIRE=${{ matrix.sf_version }} composer update + - name: Install dependencies + uses: php-actions/composer@v2 + with: + php_version: ${{ matrix.php }} + env: + SYMFONY_REQUIRE: ${{ matrix.sf_version }} - uses: php-actions/phpunit@v3 with: From 5b3f86571f908732f39b56184bb472bd99c2a5c3 Mon Sep 17 00:00:00 2001 From: Ghlen Nagels Date: Wed, 7 Aug 2024 11:29:07 +0530 Subject: [PATCH 09/18] temp commit --- .github/scripts/setup-symfony-env.bash | 9 +++++ .github/workflows/tests.yml | 2 +- composer.json | 14 +++---- composer.json.origin | 56 ++++++++++++++++++++++++++ 4 files changed, 73 insertions(+), 8 deletions(-) create mode 100644 .github/scripts/setup-symfony-env.bash create mode 100644 composer.json.origin diff --git a/.github/scripts/setup-symfony-env.bash b/.github/scripts/setup-symfony-env.bash new file mode 100644 index 0000000..8ea4a1a --- /dev/null +++ b/.github/scripts/setup-symfony-env.bash @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +set -ex + +cp composer.json composer.json.origin +rm composer.lock || true +rm -Rf vendor || true +sed -i 's/\^5.4 || \^6.0 || \^7.0/\^5.4/g' composer.json +composer install \ No newline at end of file diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 614d3c1..baaf873 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -22,7 +22,7 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Validate composer.json + - name: Validate composer-5.4.json run: composer validate --strict - name: Setup PHP ${{ matrix.php }} diff --git a/composer.json b/composer.json index 4a1097b..883d3b9 100644 --- a/composer.json +++ b/composer.json @@ -12,21 +12,21 @@ ], "require": { "php": ">=8.1", + "ext-json": "*", "laudis/neo4j-php-client": "^3.1", "twig/twig": "^3.0", - "ext-json": "*", - "symfony/dependency-injection": "^5.4 || ^6.0 || ^7.0", - "symfony/config": "^5.4 || ^6.0 || ^7.0" + "symfony/dependency-injection": "^5.4", + "symfony/config": "^5.4" }, "require-dev": { "matthiasnoback/symfony-dependency-injection-test": "^4.3", "phpunit/phpunit": "^9.5", "psalm/plugin-symfony": "^5.0", - "symfony/console": "^5.4 || ^6.0 || ^7.0", - "symfony/framework-bundle": "^5.4 || ^6.0 || ^7.0", - "symfony/http-kernel": "^5.4 || ^6.0 || ^7.0", + "symfony/console": "^5.4", + "symfony/framework-bundle": "^5.4", + "symfony/http-kernel": "^5.4", "symfony/test-pack": "^1.1", - "symfony/yaml": "^5.4 || ^6.0 || ^7.0", + "symfony/yaml": "^5.4", "vimeo/psalm": "^5.15.0", "kubawerlos/php-cs-fixer-custom-fixers": "^3.0", "friendsofphp/php-cs-fixer": "^3.30", diff --git a/composer.json.origin b/composer.json.origin new file mode 100644 index 0000000..be178a0 --- /dev/null +++ b/composer.json.origin @@ -0,0 +1,56 @@ +{ + "name": "neo4j/neo4j-bundle", + "description": "Symfony integration for Neo4j", + "type": "symfony-bundle", + "keywords": ["neo4j", "symfony", "bundle", "graph", "database", "cypher"], + "license": "MIT", + "authors": [ + { + "name": "Ghlen Nagels", + "email": "ghlen@nagels.tech" + } + ], + "require": { + "php": ">=8.1", + "ext-json": "*", + "laudis/neo4j-php-client": "^3.1", + "twig/twig": "^3.0", + "symfony/dependency-injection": "^5.4 || ^6.0 || ^7.0", + "symfony/config": "^5.4 || ^6.0 || ^7.0" + }, + "require-dev": { + "matthiasnoback/symfony-dependency-injection-test": "^4.3", + "phpunit/phpunit": "^9.5", + "psalm/plugin-symfony": "^5.0", + "symfony/console": "^5.4 || ^6.0 || ^7.0", + "symfony/framework-bundle": "^5.4 || ^6.0 || ^7.0", + "symfony/http-kernel": "^5.4 || ^6.0 || ^7.0", + "symfony/test-pack": "^1.1", + "symfony/yaml": "^5.4 || ^6.0 || ^7.0", + "vimeo/psalm": "^5.15.0", + "kubawerlos/php-cs-fixer-custom-fixers": "^3.0", + "friendsofphp/php-cs-fixer": "^3.30", + "psalm/plugin-phpunit": "^0.18" + }, + "autoload": { + "psr-4": { + "Neo4j\\Neo4jBundle\\": "src/" + } + }, + "autoload-dev": { + "psr-4": { + "Neo4j\\Neo4jBundle\\Tests\\": "tests/" + } + }, + "config": { + "sort-packages": true, + "allow-plugins": { + "php-http/discovery": false + } + }, + "scripts": { + "psalm": "php bin/console.php cache:warmup && vendor/bin/psalm --show-info=true", + "fix-cs": "vendor/bin/php-cs-fixer fix", + "check-cs": "vendor/bin/php-cs-fixer fix --dry-run" + } +} From 21d568d71e61d07dc10cfbbaf34ffe0a029d7022 Mon Sep 17 00:00:00 2001 From: exaby73 Date: Wed, 7 Aug 2024 12:14:17 +0530 Subject: [PATCH 10/18] feat: Add Symfony override script to CI --- .github/scripts/setup-symfony-env.bash | 36 ++++++++++++++--- .github/workflows/tests.yml | 5 ++- .gitignore | 4 +- composer.json | 3 +- composer.json.origin | 56 -------------------------- 5 files changed, 39 insertions(+), 65 deletions(-) mode change 100644 => 100755 .github/scripts/setup-symfony-env.bash delete mode 100644 composer.json.origin diff --git a/.github/scripts/setup-symfony-env.bash b/.github/scripts/setup-symfony-env.bash old mode 100644 new mode 100755 index 8ea4a1a..0125575 --- a/.github/scripts/setup-symfony-env.bash +++ b/.github/scripts/setup-symfony-env.bash @@ -2,8 +2,34 @@ set -ex -cp composer.json composer.json.origin -rm composer.lock || true -rm -Rf vendor || true -sed -i 's/\^5.4 || \^6.0 || \^7.0/\^5.4/g' composer.json -composer install \ No newline at end of file +if [ -z "$1" ]; then + echo "Please specify the Symfony version to install" + exit 1 +fi + +echo "Installing Symfony version $1" + +# This is not required for CI, but it allows to test the script locally +function cleanup { + echo "Cleaning up" + # Restore the original composer.json file + mv composer.origin.json composer.json +} + +function install-specified-symfony-version { + local symfony_version=$1 + # Save the original composer.json file + cp composer.json composer.origin.json + # Delete the lock file and vendor directory for a clean install + rm composer.lock || true + rm -Rf vendor || true + # Replace the Symfony version in composer.json + sed -i 's/\^5.4 || \^6.0 || \^7.0/'$symfony_version'/g' composer.json + # Install the specified Symfony version + composer install +} + +# Ensure cleanup is called on exit +trap cleanup EXIT + +install-specified-symfony-version $1 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index baaf873..cacb667 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -34,8 +34,9 @@ jobs: uses: php-actions/composer@v2 with: php_version: ${{ matrix.php }} - env: - SYMFONY_REQUIRE: ${{ matrix.sf_version }} + + - name: Override Symfony version + run: composer run ci-symfony-install-version ${{ matrix.sf_version }} - uses: php-actions/phpunit@v3 with: diff --git a/.gitignore b/.gitignore index 726a685..a18abad 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,6 @@ composer.lock .phpunit.result.cache .idea -.php-cs-fixer.cache \ No newline at end of file +.php-cs-fixer.cache + +composer.origin.json diff --git a/composer.json b/composer.json index 883d3b9..14c6909 100644 --- a/composer.json +++ b/composer.json @@ -51,6 +51,7 @@ "scripts": { "psalm": "php bin/console.php cache:warmup && vendor/bin/psalm --show-info=true", "fix-cs": "vendor/bin/php-cs-fixer fix", - "check-cs": "vendor/bin/php-cs-fixer fix --dry-run" + "check-cs": "vendor/bin/php-cs-fixer fix --dry-run", + "ci-symfony-install-version": "./.github/scripts/setup-symfony-env.bash" } } diff --git a/composer.json.origin b/composer.json.origin deleted file mode 100644 index be178a0..0000000 --- a/composer.json.origin +++ /dev/null @@ -1,56 +0,0 @@ -{ - "name": "neo4j/neo4j-bundle", - "description": "Symfony integration for Neo4j", - "type": "symfony-bundle", - "keywords": ["neo4j", "symfony", "bundle", "graph", "database", "cypher"], - "license": "MIT", - "authors": [ - { - "name": "Ghlen Nagels", - "email": "ghlen@nagels.tech" - } - ], - "require": { - "php": ">=8.1", - "ext-json": "*", - "laudis/neo4j-php-client": "^3.1", - "twig/twig": "^3.0", - "symfony/dependency-injection": "^5.4 || ^6.0 || ^7.0", - "symfony/config": "^5.4 || ^6.0 || ^7.0" - }, - "require-dev": { - "matthiasnoback/symfony-dependency-injection-test": "^4.3", - "phpunit/phpunit": "^9.5", - "psalm/plugin-symfony": "^5.0", - "symfony/console": "^5.4 || ^6.0 || ^7.0", - "symfony/framework-bundle": "^5.4 || ^6.0 || ^7.0", - "symfony/http-kernel": "^5.4 || ^6.0 || ^7.0", - "symfony/test-pack": "^1.1", - "symfony/yaml": "^5.4 || ^6.0 || ^7.0", - "vimeo/psalm": "^5.15.0", - "kubawerlos/php-cs-fixer-custom-fixers": "^3.0", - "friendsofphp/php-cs-fixer": "^3.30", - "psalm/plugin-phpunit": "^0.18" - }, - "autoload": { - "psr-4": { - "Neo4j\\Neo4jBundle\\": "src/" - } - }, - "autoload-dev": { - "psr-4": { - "Neo4j\\Neo4jBundle\\Tests\\": "tests/" - } - }, - "config": { - "sort-packages": true, - "allow-plugins": { - "php-http/discovery": false - } - }, - "scripts": { - "psalm": "php bin/console.php cache:warmup && vendor/bin/psalm --show-info=true", - "fix-cs": "vendor/bin/php-cs-fixer fix", - "check-cs": "vendor/bin/php-cs-fixer fix --dry-run" - } -} From 86ddaca7f61bc7b6e7675272984900db482ca0d6 Mon Sep 17 00:00:00 2001 From: exaby73 Date: Wed, 7 Aug 2024 12:15:55 +0530 Subject: [PATCH 11/18] fix: Revert composer versions --- composer.json | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/composer.json b/composer.json index 14c6909..84d3ecb 100644 --- a/composer.json +++ b/composer.json @@ -12,21 +12,21 @@ ], "require": { "php": ">=8.1", - "ext-json": "*", "laudis/neo4j-php-client": "^3.1", "twig/twig": "^3.0", - "symfony/dependency-injection": "^5.4", - "symfony/config": "^5.4" + "ext-json": "*", + "symfony/dependency-injection": "^5.4 || ^6.0 || ^7.0", + "symfony/config": "^5.4 || ^6.0 || ^7.0" }, "require-dev": { "matthiasnoback/symfony-dependency-injection-test": "^4.3", "phpunit/phpunit": "^9.5", "psalm/plugin-symfony": "^5.0", - "symfony/console": "^5.4", - "symfony/framework-bundle": "^5.4", - "symfony/http-kernel": "^5.4", + "symfony/console": "^5.4 || ^6.0 || ^7.0", + "symfony/framework-bundle": "^5.4 || ^6.0 || ^7.0", + "symfony/http-kernel": "^5.4 || ^6.0 || ^7.0", "symfony/test-pack": "^1.1", - "symfony/yaml": "^5.4", + "symfony/yaml": "^5.4 || ^6.0 || ^7.0", "vimeo/psalm": "^5.15.0", "kubawerlos/php-cs-fixer-custom-fixers": "^3.0", "friendsofphp/php-cs-fixer": "^3.30", From b9baa456b13352ec9d66d73ea4f471160b97721a Mon Sep 17 00:00:00 2001 From: exaby73 Date: Wed, 7 Aug 2024 12:17:31 +0530 Subject: [PATCH 12/18] ci: Remove composer action --- .github/workflows/tests.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index cacb667..df6c3ab 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -30,11 +30,6 @@ jobs: with: php-version: ${{ matrix.php }} - - name: Install dependencies - uses: php-actions/composer@v2 - with: - php_version: ${{ matrix.php }} - - name: Override Symfony version run: composer run ci-symfony-install-version ${{ matrix.sf_version }} From 4a95746f8896450d8950be1afc62993a196de6b7 Mon Sep 17 00:00:00 2001 From: exaby73 Date: Wed, 7 Aug 2024 12:22:33 +0530 Subject: [PATCH 13/18] fix: Composer dependency conflicts --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 84d3ecb..63870d2 100644 --- a/composer.json +++ b/composer.json @@ -19,7 +19,7 @@ "symfony/config": "^5.4 || ^6.0 || ^7.0" }, "require-dev": { - "matthiasnoback/symfony-dependency-injection-test": "^4.3", + "matthiasnoback/symfony-dependency-injection-test": "^4.3 || ^5.0", "phpunit/phpunit": "^9.5", "psalm/plugin-symfony": "^5.0", "symfony/console": "^5.4 || ^6.0 || ^7.0", From 459172140b166dd4d60f6930481db3414d7ec714 Mon Sep 17 00:00:00 2001 From: exaby73 Date: Wed, 7 Aug 2024 12:28:58 +0530 Subject: [PATCH 14/18] fix: Add caret to sed script --- .github/scripts/setup-symfony-env.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/scripts/setup-symfony-env.bash b/.github/scripts/setup-symfony-env.bash index 0125575..d2fc962 100755 --- a/.github/scripts/setup-symfony-env.bash +++ b/.github/scripts/setup-symfony-env.bash @@ -24,7 +24,7 @@ function install-specified-symfony-version { rm composer.lock || true rm -Rf vendor || true # Replace the Symfony version in composer.json - sed -i 's/\^5.4 || \^6.0 || \^7.0/'$symfony_version'/g' composer.json + sed -i 's/\^5.4 || \^6.0 || \^7.0/\^'$symfony_version'/g' composer.json # Install the specified Symfony version composer install } From 38d23186dd8075b2081d62b09f0997fc9d60422f Mon Sep 17 00:00:00 2001 From: exaby73 Date: Wed, 7 Aug 2024 12:30:37 +0530 Subject: [PATCH 15/18] fix: Remove asterisk from sf_version --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index df6c3ab..e3c83aa 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -15,7 +15,7 @@ jobs: max-parallel: 10 matrix: php: [ '8.1', '8.2', '8.3'] - sf_version: [ '5.4.*', '6.4.*', '7.1.*' ] + sf_version: [ '5.4', '6.4', '7.1' ] exclude: - php: 8.1 sf_version: 7.1.* From 4b29ac1217695d6ff7e06d12d528c3423c4d7e79 Mon Sep 17 00:00:00 2001 From: exaby73 Date: Wed, 7 Aug 2024 12:32:15 +0530 Subject: [PATCH 16/18] fix: Remove asterisk from sf_version --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index e3c83aa..c89878a 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -18,7 +18,7 @@ jobs: sf_version: [ '5.4', '6.4', '7.1' ] exclude: - php: 8.1 - sf_version: 7.1.* + sf_version: 7.1 steps: - uses: actions/checkout@v2 From 39a358b4def4f9bca92b719cd3aac347bb19593f Mon Sep 17 00:00:00 2001 From: exaby73 Date: Wed, 7 Aug 2024 13:02:50 +0530 Subject: [PATCH 17/18] chore: Remove unnecessary --- .github/scripts/setup-symfony-env.bash | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/scripts/setup-symfony-env.bash b/.github/scripts/setup-symfony-env.bash index d2fc962..ea8a54c 100755 --- a/.github/scripts/setup-symfony-env.bash +++ b/.github/scripts/setup-symfony-env.bash @@ -12,24 +12,19 @@ echo "Installing Symfony version $1" # This is not required for CI, but it allows to test the script locally function cleanup { echo "Cleaning up" - # Restore the original composer.json file mv composer.origin.json composer.json } function install-specified-symfony-version { local symfony_version=$1 - # Save the original composer.json file cp composer.json composer.origin.json - # Delete the lock file and vendor directory for a clean install rm composer.lock || true rm -Rf vendor || true - # Replace the Symfony version in composer.json sed -i 's/\^5.4 || \^6.0 || \^7.0/\^'$symfony_version'/g' composer.json - # Install the specified Symfony version composer install } -# Ensure cleanup is called on exit +# Ensure cleanup is called on exit. Handles both success and failure exits trap cleanup EXIT install-specified-symfony-version $1 From 1d137fb5aba962ebccda264277f3b2ec29d066f0 Mon Sep 17 00:00:00 2001 From: exaby73 Date: Wed, 7 Aug 2024 13:03:26 +0530 Subject: [PATCH 18/18] chore: Remove unnecessary --- .github/scripts/setup-symfony-env.bash | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/scripts/setup-symfony-env.bash b/.github/scripts/setup-symfony-env.bash index ea8a54c..0f84efe 100755 --- a/.github/scripts/setup-symfony-env.bash +++ b/.github/scripts/setup-symfony-env.bash @@ -24,7 +24,6 @@ function install-specified-symfony-version { composer install } -# Ensure cleanup is called on exit. Handles both success and failure exits trap cleanup EXIT install-specified-symfony-version $1