From 75a848d61b138d9ec62a14a22fe76408423c757e Mon Sep 17 00:00:00 2001 From: Aleksei Gagarin Date: Sat, 10 Oct 2026 17:19:12 +0400 Subject: [PATCH 1/2] feat: support RoadRunner v3 (#48) --- .github/.release-please-config.json | 2 +- README.md | 10 ++--- bin/rr | 2 +- composer.json | 29 ++++++++---- src/Command/VersionFilterOption.php | 2 +- src/Configuration/Section/Amqp.php | 5 ++- src/Environment/RoadRunnerVersion.php | 45 +++++++++++++++++++ src/Repository/ReleasesCollection.php | 13 ++++-- src/VersionsCommand.php | 4 +- .../Unit/Command/VersionFilterOptionTest.php | 4 +- .../Repository/ReleasesCollectionTest.php | 12 ++++- tests/Unit/VersionsCommandTest.php | 11 +---- 12 files changed, 103 insertions(+), 36 deletions(-) create mode 100644 src/Environment/RoadRunnerVersion.php diff --git a/.github/.release-please-config.json b/.github/.release-please-config.json index d691f2b..cdc91c9 100644 --- a/.github/.release-please-config.json +++ b/.github/.release-please-config.json @@ -3,7 +3,7 @@ "release-type": "php", "packages": { ".": { - "package-name": "spiral/roadrunner-cli", + "package-name": "roadrunner/cli", "changelog-path": "/CHANGELOG.md" } }, diff --git a/README.md b/README.md index 3f2f1b2..855c5a5 100644 --- a/README.md +++ b/README.md @@ -27,13 +27,13 @@ This package provides the `rr` console command for PHP projects that run on [Roa ### Installation ```bash -composer require spiral/roadrunner-cli +composer require roadrunner/cli ``` -[![PHP](https://img.shields.io/packagist/php-v/spiral/roadrunner-cli.svg?style=flat-square&logo=php)](https://packagist.org/packages/spiral/roadrunner-cli) -[![Latest Version on Packagist](https://img.shields.io/packagist/v/spiral/roadrunner-cli.svg?style=flat-square&logo=packagist)](https://packagist.org/packages/spiral/roadrunner-cli) -[![License](https://img.shields.io/packagist/l/spiral/roadrunner-cli.svg?style=flat-square)](LICENSE) -[![Total Downloads](https://img.shields.io/packagist/dt/spiral/roadrunner-cli.svg?style=flat-square)](https://packagist.org/packages/spiral/roadrunner-cli/stats) +[![PHP](https://img.shields.io/packagist/php-v/roadrunner/cli.svg?style=flat-square&logo=php)](https://packagist.org/packages/roadrunner/cli) +[![Latest Version on Packagist](https://img.shields.io/packagist/v/roadrunner/cli.svg?style=flat-square&logo=packagist)](https://packagist.org/packages/roadrunner/cli) +[![License](https://img.shields.io/packagist/l/roadrunner/cli.svg?style=flat-square)](LICENSE) +[![Total Downloads](https://img.shields.io/packagist/dt/roadrunner/cli.svg?style=flat-square)](https://packagist.org/packages/roadrunner/cli/stats) ### Getting the RoadRunner binary diff --git a/bin/rr b/bin/rr index a7c786f..a1441e4 100644 --- a/bin/rr +++ b/bin/rr @@ -68,7 +68,7 @@ require RR_COMPOSER_INSTALL; $app = new \Symfony\Component\Console\Application('RoadRunner CLI', Version::current()); -if (method_exists($app, 'addCommand')) { +if (\method_exists($app, 'addCommand')) { $app->addCommand(new GetBinaryCommand()); $app->addCommand(new VersionsCommand()); $app->addCommand(new DownloadProtocBinaryCommand()); diff --git a/composer.json b/composer.json index 00093be..e2de837 100644 --- a/composer.json +++ b/composer.json @@ -1,25 +1,34 @@ { - "name": "spiral/roadrunner-cli", + "name": "roadrunner/cli", "type": "library", - "description": "RoadRunner: Command Line Interface", + "description": "RoadRunner command-line tool: downloads the RoadRunner binary and generates its configuration", + "keywords": [ + "roadrunner", + "cli", + "console", + "installer", + "binary", + "download" + ], "license": "MIT", "authors": [ { - "name": "Anton Titov (wolfy-j)", - "email": "wolfy-j@spiralscout.com" + "name": "Anton Titov", + "homepage": "https://github.com/wolfy-j" }, { "name": "RoadRunner Community", - "homepage": "https://github.com/spiral/roadrunner/graphs/contributors" + "homepage": "https://github.com/roadrunner-server/roadrunner/graphs/contributors" } ], "bin": [ "bin/rr" ], - "homepage": "https://roadrunner.dev", + "homepage": "https://roadrunner.dev/", "support": { - "docs": "https://docs.roadrunner.dev", + "docs": "https://docs.roadrunner.dev/docs/general/install", "issues": "https://github.com/roadrunner-server/roadrunner/issues", + "source": "https://github.com/roadrunner-php/cli", "chat": "https://discord.gg/V6EK4he" }, "funding": [ @@ -31,8 +40,9 @@ "require": { "php": ">=8.2", "ext-json": "*", + "composer-runtime-api": "^2.0", "composer/semver": "^3.4", - "spiral/roadrunner-worker": "^2 || ^3", + "roadrunner/worker": "^3.8", "spiral/tokenizer": "^2.13 || ^3.15", "symfony/console": "^5.3 || ^6.0 || ^7.0 || ^8.0", "symfony/http-client": "^4.4.51 || ^5.4.49 || ^6.4.17 || ^7.2 || ^8.0", @@ -45,6 +55,9 @@ "testo/testo": "^0.10.55", "vimeo/psalm": "^6 || ^7" }, + "replace": { + "spiral/roadrunner-cli": "self.version" + }, "autoload": { "psr-4": { "Spiral\\RoadRunner\\Console\\": "src" diff --git a/src/Command/VersionFilterOption.php b/src/Command/VersionFilterOption.php index 19a5eb9..1143fa8 100644 --- a/src/Command/VersionFilterOption.php +++ b/src/Command/VersionFilterOption.php @@ -11,10 +11,10 @@ namespace Spiral\RoadRunner\Console\Command; +use Spiral\RoadRunner\Console\Environment\RoadRunnerVersion; use Spiral\RoadRunner\Console\Repository\ReleaseInterface; use Spiral\RoadRunner\Console\Repository\ReleasesCollection; use Spiral\RoadRunner\Console\Repository\RepositoryInterface; -use Spiral\RoadRunner\Version as RoadRunnerVersion; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Style\StyleInterface; diff --git a/src/Configuration/Section/Amqp.php b/src/Configuration/Section/Amqp.php index 7d12c67..d0304ca 100644 --- a/src/Configuration/Section/Amqp.php +++ b/src/Configuration/Section/Amqp.php @@ -19,7 +19,10 @@ public function render(): array { return [ self::NAME => [ - 'addr' => 'amqp://guest:guest@127.0.0.1:5672/', + // Jobs pipelines refer to this connection name via `config.connection` + 'default' => [ + 'addr' => 'amqp://guest:guest@127.0.0.1:5672/', + ], ], ]; } diff --git a/src/Environment/RoadRunnerVersion.php b/src/Environment/RoadRunnerVersion.php new file mode 100644 index 0000000..4a3eb46 --- /dev/null +++ b/src/Environment/RoadRunnerVersion.php @@ -0,0 +1,45 @@ +.…" to sort + * them after every 2.x and before every 3.x release. + */ private function comparisonVersionString(ReleaseInterface $release): string { - $stability = $release->getStability(); - $weight = Stability::toInt($stability); - - return \str_replace('-' . $stability, '.' . $weight . '.', $release->getVersion()); + return (string) \preg_replace('/^(20\d{2}\.)/', '2.$1', $release->getName()); } } diff --git a/src/VersionsCommand.php b/src/VersionsCommand.php index 59bf2ca..b9cb21b 100644 --- a/src/VersionsCommand.php +++ b/src/VersionsCommand.php @@ -15,9 +15,9 @@ use Spiral\RoadRunner\Console\Command\OperatingSystemOption; use Spiral\RoadRunner\Console\Command\StabilityOption; use Spiral\RoadRunner\Console\Command\VersionFilterOption; +use Spiral\RoadRunner\Console\Environment\RoadRunnerVersion; use Spiral\RoadRunner\Console\Environment\Stability; use Spiral\RoadRunner\Console\Repository\ReleaseInterface; -use Spiral\RoadRunner\Version; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\StyleInterface; @@ -92,7 +92,7 @@ private function compatibilityToString(ReleaseInterface $release, InputInterface $template = ' ✖ (reason: %s)'; // Validate version - if (! $release->satisfies(Version::constraint())) { + if (! $release->satisfies(RoadRunnerVersion::constraint())) { return \sprintf($template, 'incompatible version'); } diff --git a/tests/Unit/Command/VersionFilterOptionTest.php b/tests/Unit/Command/VersionFilterOptionTest.php index df174ab..1a0b115 100644 --- a/tests/Unit/Command/VersionFilterOptionTest.php +++ b/tests/Unit/Command/VersionFilterOptionTest.php @@ -5,10 +5,10 @@ namespace Spiral\RoadRunner\Console\Tests\Unit\Command; use Spiral\RoadRunner\Console\Command\VersionFilterOption; +use Spiral\RoadRunner\Console\Environment\RoadRunnerVersion; use Spiral\RoadRunner\Console\Tests\Unit\Stub\InMemoryRepository; use Spiral\RoadRunner\Console\Tests\Unit\Stub\OptionHost; use Spiral\RoadRunner\Console\Tests\Unit\Stub\Releases; -use Spiral\RoadRunner\Version; use Testo\Assert; use Testo\Expect; use Testo\Test; @@ -22,7 +22,7 @@ public function defaultsToInstalledRoadRunnerConstraint(): void $option = new VersionFilterOption($host->command); $input = $host->input(); - Assert::same($option->get($input, $host->io($input)), Version::constraint()); + Assert::same($option->get($input, $host->io($input)), RoadRunnerVersion::constraint()); } public function findReturnsMatchingReleasesNewestFirst(): void diff --git a/tests/Unit/Repository/ReleasesCollectionTest.php b/tests/Unit/Repository/ReleasesCollectionTest.php index fcccc46..cca4acb 100644 --- a/tests/Unit/Repository/ReleasesCollectionTest.php +++ b/tests/Unit/Repository/ReleasesCollectionTest.php @@ -9,7 +9,6 @@ use Spiral\RoadRunner\Console\Tests\Unit\Stub\Releases; use Testo\Assert; use Testo\Data\DataSet; -use Testo\Skip; use Testo\Test; #[Test] @@ -73,7 +72,6 @@ public function sortByVersionPutsReleaseCandidateBelowFinalRelease(): void ); } - #[Skip('Bug: sortByVersion() replaces "-beta"/"-alpha"/"-RC" with a numeric weight, so v2024.1.0-beta.1 compares as 2024.1.0.2.1 and sorts above v2024.1.0')] public function sortByVersionPutsPreReleasesBelowFinalRelease(): void { $releases = Releases::collection('v2024.1.0-alpha.1', 'v2024.1.0', 'v2024.1.0-beta.1', 'v2024.1.0-rc.1'); @@ -84,6 +82,16 @@ public function sortByVersionPutsPreReleasesBelowFinalRelease(): void ); } + public function sortByVersionPutsCalendarReleasesBetweenV2AndV3(): void + { + $releases = Releases::collection('v2025.1.15', 'v2.12.3', 'v3.0.0', 'v2023.3.0', 'v3.0.0-rc.1'); + + Assert::same( + Releases::versions($releases->sortByVersion()), + ['v3.0.0', 'v3.0.0-rc.1', 'v2025.1.15', 'v2023.3.0', 'v2.12.3'], + ); + } + public function stableKeepsOnlyStableReleases(): void { $releases = Releases::collection('v2024.1.0-rc.1', 'v2024.1.0', 'v2024.1.0-beta.1'); diff --git a/tests/Unit/VersionsCommandTest.php b/tests/Unit/VersionsCommandTest.php index 55e52a4..ada0f33 100644 --- a/tests/Unit/VersionsCommandTest.php +++ b/tests/Unit/VersionsCommandTest.php @@ -4,15 +4,14 @@ namespace Spiral\RoadRunner\Console\Tests\Unit; +use Spiral\RoadRunner\Console\Environment\RoadRunnerVersion; use Spiral\RoadRunner\Console\Repository\ReleaseInterface; use Spiral\RoadRunner\Console\Repository\RepositoryInterface; use Spiral\RoadRunner\Console\Tests\Unit\Stub\InMemoryRepository; use Spiral\RoadRunner\Console\Tests\Unit\Stub\Releases; use Spiral\RoadRunner\Console\VersionsCommand; -use Spiral\RoadRunner\Version; use Symfony\Component\Console\Tester\CommandTester; use Testo\Assert; -use Testo\Core\Exception\SkipTest; use Testo\Test; #[Test] @@ -59,10 +58,6 @@ public function explainsMissingAssembly(): void public function marksIncompatibleVersions(): void { - if (Version::constraint() === '*') { - throw new SkipTest('Every version is compatible when RoadRunner is installed from a branch'); - } - $display = self::run( ['--os' => 'linux', '--arch' => 'amd64'], Releases::release('v1.9.0', ['roadrunner-1.9.0-linux-amd64.tar.gz']), @@ -91,9 +86,7 @@ public function filtersByStabilityAndVersion(): void */ private static function compatibleMajor(): string { - $constraint = Version::constraint(); - - return $constraint === '*' ? '2024' : \substr($constraint, 0, -2); + return \substr(RoadRunnerVersion::constraint(), 0, -2); } /** From d9b93b7324c223cf0f8660009d4144ce06764270 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 10 Oct 2026 13:19:35 +0000 Subject: [PATCH 2/2] chore(2.x): release 2.8.0 --- .github/version.json | 2 +- CHANGELOG.md | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 CHANGELOG.md diff --git a/.github/version.json b/.github/version.json index 889b49d..8388fe1 100644 --- a/.github/version.json +++ b/.github/version.json @@ -1,3 +1,3 @@ { - ".": "2.7.2" + ".": "2.8.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..a3c2546 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,21 @@ +# Changelog + +## [2.8.0](https://github.com/roadrunner-php/cli/compare/v2.7.2...v2.8.0) (2026-10-10) + + +### Features + +* migrate tests to Testo, require PHP 8.2 ([#56](https://github.com/roadrunner-php/cli/issues/56)) ([71c3f7e](https://github.com/roadrunner-php/cli/commit/71c3f7e8d9d004986ada55a1623800395abcdc9a)) +* read the GitHub API URL from RR_GITHUB_API_URL ([#65](https://github.com/roadrunner-php/cli/issues/65)) ([eff8b50](https://github.com/roadrunner-php/cli/commit/eff8b5012ead11898d067135a6e5f8eff201d1c6)) +* support RoadRunner v3 ([#48](https://github.com/roadrunner-php/cli/issues/48)) ([75a848d](https://github.com/roadrunner-php/cli/commit/75a848d61b138d9ec62a14a22fe76408423c757e)) + + +### Documentation + +* refresh the README ([#53](https://github.com/roadrunner-php/cli/issues/53)) ([623354c](https://github.com/roadrunner-php/cli/commit/623354c2fc7c1230d7d58de087d95e5ff337b94b)) + + +### Code Refactoring + +* add #[\Override] and drop the psalm baseline ([#64](https://github.com/roadrunner-php/cli/issues/64)) ([d8a5b3f](https://github.com/roadrunner-php/cli/commit/d8a5b3fa802cacec4d7f64bfab269f4343226c30)) +* resolve the Psalm baseline in code ([d8a5b3f](https://github.com/roadrunner-php/cli/commit/d8a5b3fa802cacec4d7f64bfab269f4343226c30))