Skip to content
Closed
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
2 changes: 1 addition & 1 deletion .github/.release-please-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"release-type": "php",
"packages": {
".": {
"package-name": "spiral/roadrunner-cli",
"package-name": "roadrunner/cli",
"changelog-path": "/CHANGELOG.md"
}
},
Expand Down
2 changes: 1 addition & 1 deletion .github/version.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "2.7.2"
".": "2.8.0"
}
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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))
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion bin/rr
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
29 changes: 21 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
@@ -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": [
Expand All @@ -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",
Expand All @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion src/Command/VersionFilterOption.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 4 additions & 1 deletion src/Configuration/Section/Amqp.php
Original file line number Diff line number Diff line change
Expand Up @@ -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/',
],
],
];
}
Expand Down
45 changes: 45 additions & 0 deletions src/Environment/RoadRunnerVersion.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php

/**
* This file is part of RoadRunner package.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

declare(strict_types=1);

namespace Spiral\RoadRunner\Console\Environment;

use Composer\InstalledVersions;

final class RoadRunnerVersion
{
public const PACKAGE_NAME = 'spiral/roadrunner';

/**
* Used when the spiral/roadrunner metapackage is not installed.
*/
public const DEFAULT_CONSTRAINT = '3.*';

/**
* Returns the RoadRunner binary version constraint matching the installed
* spiral/roadrunner metapackage, e.g. "3.*" or "2025.*".
*
* Not delegated to {@see \Spiral\RoadRunner\Version::constraint()}: without the metapackage
* it falls back to the roadrunner/worker version, whose major is unrelated to the binary's.
*/
public static function constraint(): string
{
if (!InstalledVersions::isInstalled(self::PACKAGE_NAME)) {
return self::DEFAULT_CONSTRAINT;
}

$version = \ltrim((string) InstalledVersions::getPrettyVersion(self::PACKAGE_NAME), 'v');
[$major] = \explode('.', $version);

return \str_contains($version, '.') && \is_numeric($major)
? $major . '.*'
: self::DEFAULT_CONSTRAINT;
}
}
13 changes: 9 additions & 4 deletions src/Repository/ReleasesCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,16 @@ private function constraints(array $constraints): array
);
}

/**
* The release name is normalized by composer/semver ("3.0.0-RC1", "3.0.0-beta2"),
* so version_compare() orders pre-releases below the stable release.
*
* RoadRunner went 1.x → 2.x → calendar 2023.x–2025.x → 3.x, so a plain version_compare()
* would rank 2025.1.15 above 3.0.0. Calendar releases are rewritten as "2.<year>.…" 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());
}
}
4 changes: 2 additions & 2 deletions src/VersionsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -92,7 +92,7 @@ private function compatibilityToString(ReleaseInterface $release, InputInterface
$template = '<fg=red> ✖ </> (reason: <comment>%s</comment>)';

// Validate version
if (! $release->satisfies(Version::constraint())) {
if (! $release->satisfies(RoadRunnerVersion::constraint())) {
return \sprintf($template, 'incompatible version');
}

Expand Down
4 changes: 2 additions & 2 deletions tests/Unit/Command/VersionFilterOptionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down
12 changes: 10 additions & 2 deletions tests/Unit/Repository/ReleasesCollectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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');
Expand All @@ -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');
Expand Down
11 changes: 2 additions & 9 deletions tests/Unit/VersionsCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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']),
Expand Down Expand Up @@ -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);
}

/**
Expand Down