Remove consolidation/robo dependency and refactor packages builds (#19060)

| Q               | A
|-----------------|-----
| Branch?         | 2.3
| Bug fix?        | no
| New feature?    | no
| BC breaks?      | no
| Deprecations? | no<!-- don't forget to update the UPGRADE-*.md file
-->
| Related tickets | https://github.com/Sylius/Sylius/pull/18903,
https://github.com/Sylius/Sylius/issues/18760
| License         | MIT

This PR backports the robo removal already done on the `symfony-8`
branch (#18903) to `2.3`, as it makes sense to have it on `2.3` already

<!--
 - Bug fixes must be submitted against the 2.2 branch
 - Features and deprecations must be submitted against the 2.3 branch
 - Make sure that the correct base branch is set

To be sure you are not breaking any Backward Compatibilities, check the
documentation:

https://docs.sylius.com/en/latest/book/organization/backward-compatibility-promise.html
-->


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Chores**
* Refactored CI/CD workflows to dynamically discover and test packages
instead of using a task runner approach.
* Simplified package test execution with per-package working directories
and conditional test execution.
* Removed external task runner dependency to streamline the build
pipeline.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
Kamil Grygierzec 2026-06-17 12:39:06 +02:00 committed by GitHub
commit bc650c0606
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 109 additions and 167 deletions

1
.gitattributes vendored
View file

@ -34,7 +34,6 @@ phpstan.neon.dist export-ignore
phpstan-baseline.neon export-ignore
phpunit.xml.dist export-ignore
rector.php export-ignore
RoboFile.php export-ignore
symfony.lock export-ignore
webpack.config.js export-ignore
yaml-standards.yaml export-ignore

View file

@ -22,3 +22,4 @@ jobs:
uses: ./.github/workflows/ci_packages-unstable.yaml
with:
type: minimal
ignore-failure: true

View file

@ -18,27 +18,45 @@ permissions:
contents: read
jobs:
test_unstable:
get-packages:
runs-on: ubuntu-latest
name: "PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }} (Unstable Dependencies)"
timeout-minutes: 20
name: "Get packages"
outputs:
packages: ${{ steps.packages.outputs.packages }}
steps:
- uses: actions/checkout@v4
- name: "Get packages"
id: packages
run: |
PACKAGES=$(find src/Sylius -mindepth 3 -maxdepth 3 -type f -name composer.json -exec dirname '{}' \; | sed -e 's/src\/Sylius\///g' | sort | jq --raw-input . | jq --slurp -c .)
echo "packages=$PACKAGES" >> $GITHUB_OUTPUT
test_unstable:
needs: get-packages
runs-on: ubuntu-latest
name: "PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }} (Unstable) - ${{ matrix.package }}"
timeout-minutes: 10
continue-on-error: ${{ inputs.ignore-failure }}
strategy:
fail-fast: false
matrix:
include:
-
php: "8.3"
symfony: "^7.4@beta"
php:
- "8.4"
symfony:
- "~8.0.0"
package: ${{ fromJson(needs.get-packages.outputs.packages) }}
env:
COMPOSER_ROOT_VERSION: "dev-main"
SYMFONY_VERSION: "${{ matrix.symfony }}"
UNSTABLE: "yes"
defaults:
run:
working-directory: "src/Sylius/${{ matrix.package }}"
steps:
-
uses: actions/checkout@v4
- uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
@ -51,6 +69,8 @@ jobs:
composer global config --no-plugins allow-plugins.symfony/flex true
composer global require --no-progress --no-scripts --no-plugins "symfony/flex:^2.4"
composer config extra.symfony.require "${{ matrix.symfony }}"
composer config minimum-stability dev
composer config prefer-stable true
- name: Get Composer cache directory
id: composer-cache
@ -60,13 +80,35 @@ jobs:
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: "${{ github.run_id }}-${{ runner.os }}-${{ hashFiles('composer.json') }}-symfony-${{ matrix.symfony }}-"
key: "unstable-${{ runner.os }}-php${{ matrix.php }}-sf${{ matrix.symfony }}-${{ matrix.package }}-${{ hashFiles(format('src/Sylius/{0}/composer.json', matrix.package)) }}"
restore-keys: |
"${{ github.run_id }}-${{ runner.os }}-${{ hashFiles('composer.json') }}-symfony-${{ matrix.symfony }}-"
unstable-${{ runner.os }}-php${{ matrix.php }}-sf${{ matrix.symfony }}-${{ matrix.package }}-
- name: Install dependencies
run: composer install --no-interaction --no-scripts
run: composer update --no-interaction --no-scripts --prefer-dist
- name: "Run pipeline"
continue-on-error: ${{ inputs.ignore-failure }}
run: find src/Sylius -mindepth 3 -maxdepth 3 -type f -name composer.json -exec dirname '{}' \; | sed -e 's/src\/Sylius\///g' | sort | jq --raw-input . | jq --slurp . | jq -c . | xargs -0 vendor/bin/robo ci:packages
- name: Validate composer.json
run: composer validate --ansi --strict
- name: Create test assets
if: contains(fromJson('["Bundle/AdminBundle","Bundle/ApiBundle","Bundle/CoreBundle"]'), matrix.package)
run: |
for dir in tests/Application test; do
if [ -d "$dir" ]; then
mkdir -p "$dir/public/build/admin" "$dir/public/build/shop"
echo '{}' > "$dir/public/build/admin/manifest.json"
echo '{}' > "$dir/public/build/shop/manifest.json"
fi
done
- name: Create test database schema
if: matrix.package == 'Bundle/ApiBundle'
run: tests/Application/bin/console doctrine:schema:update --force
- name: Run PHPUnit
run: |
if [ -f phpunit.xml ] || [ -f phpunit.xml.dist ]; then
vendor/bin/phpunit --colors=always
else
echo "No phpunit.xml found, skipping tests"
fi

View file

@ -22,7 +22,7 @@ jobs:
runs-on: ubuntu-latest
name: "Get matrix"
outputs:
matrix: ${{ steps.matrix.outputs.prop }}
matrix: ${{ steps.matrix.outputs.result }}
steps:
- name: "Checkout (With Branch)"
if: "${{ inputs.branch != '' }}"
@ -34,18 +34,28 @@ jobs:
if: "${{ inputs.branch == '' }}"
uses: actions/checkout@v4
- name: "Get matrix"
- name: "Build matrix"
id: matrix
uses: notiz-dev/github-action-json-property@release
with:
path: '.github/workflows/matrix.json'
prop_path: '${{ inputs.type }}.packages'
run: |
PACKAGES=$(find src/Sylius -mindepth 3 -maxdepth 3 -type f -name composer.json -exec dirname '{}' \; | sed -e 's/src\/Sylius\///g' | sort | jq --raw-input . | jq --slurp -c .)
MATRIX_CONFIG=$(cat .github/workflows/matrix.json | jq -c '.${{ inputs.type }}.packages')
# Build configs array from either "include" format or "php"/"symfony" array format
if echo "$MATRIX_CONFIG" | jq -e '.include' > /dev/null 2>&1; then
CONFIGS=$(echo "$MATRIX_CONFIG" | jq -c '.include')
else
CONFIGS=$(echo "$MATRIX_CONFIG" | jq -c '[.php[] as $p | .symfony[] as $s | {php: $p, symfony: $s}]')
fi
RESULT=$(jq -nc --argjson packages "$PACKAGES" --argjson configs "$CONFIGS" \
'{include: [($configs[] | . as $config | $packages[] | {php: $config.php, symfony: $config.symfony, package: .})]}')
echo "result=$RESULT" >> $GITHUB_OUTPUT
test:
needs: get-matrix
runs-on: ubuntu-latest
name: "PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}"
timeout-minutes: 20
name: "PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }} - ${{ matrix.package }}"
timeout-minutes: 10
strategy:
fail-fast: false
@ -53,8 +63,10 @@ jobs:
env:
COMPOSER_ROOT_VERSION: "dev-main"
SYMFONY_VERSION: "${{ matrix.symfony }}"
UNSTABLE: "no"
defaults:
run:
working-directory: "src/Sylius/${{ matrix.package }}"
steps:
- name: "Checkout (With Branch)"
@ -74,7 +86,6 @@ jobs:
coverage: none
- name: Restrict Symfony version
if: matrix.symfony != ''
run: |
composer global config --no-plugins allow-plugins.symfony/flex true
composer global require --no-progress --no-scripts --no-plugins "symfony/flex:^2.4"
@ -88,14 +99,35 @@ jobs:
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: "${{ github.run_id }}-${{ runner.os }}-${{ hashFiles('composer.json') }}-symfony-${{ matrix.symfony }}-"
key: "packages-${{ runner.os }}-php${{ matrix.php }}-sf${{ matrix.symfony }}-${{ matrix.package }}-${{ hashFiles(format('src/Sylius/{0}/composer.json', matrix.package)) }}"
restore-keys: |
"${{ github.run_id }}-${{ runner.os }}-${{ hashFiles('composer.json') }}-symfony-${{ matrix.symfony }}-"
packages-${{ runner.os }}-php${{ matrix.php }}-sf${{ matrix.symfony }}-${{ matrix.package }}-
- name: Install dependencies
run: composer install --no-interaction --no-scripts
run: composer update --no-interaction --no-scripts --prefer-dist
- name: "Run pipeline"
- name: Validate composer.json
run: composer validate --ansi --strict
- name: Create test assets
if: contains(fromJson('["Bundle/AdminBundle","Bundle/ApiBundle","Bundle/CoreBundle"]'), matrix.package)
run: |
PACKAGES=$(find src/Sylius -mindepth 3 -maxdepth 3 -type f -name composer.json -exec dirname '{}' \; | sed -e 's/src\/Sylius\///g' | sort | jq --raw-input . | jq --slurp . | jq -c .)
vendor/bin/robo ci:packages "$PACKAGES"
for dir in tests/Application test; do
if [ -d "$dir" ]; then
mkdir -p "$dir/public/build/admin" "$dir/public/build/shop"
echo '{}' > "$dir/public/build/admin/manifest.json"
echo '{}' > "$dir/public/build/shop/manifest.json"
fi
done
- name: Create test database schema
if: matrix.package == 'Bundle/ApiBundle'
run: tests/Application/bin/console doctrine:schema:update --force
- name: Run PHPUnit
run: |
if [ -f phpunit.xml ] || [ -f phpunit.xml.dist ]; then
vendor/bin/phpunit --colors=always
else
echo "No phpunit.xml found, skipping tests"
fi

View file

@ -1,131 +0,0 @@
<?php
/*
* This file is part of the Sylius package.
*
* (c) Sylius Sp. z o.o.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
use Robo\Exception\TaskException;
use Robo\Result;
use Robo\Symfony\ConsoleIO;
use Robo\Tasks;
class RoboFile extends Tasks
{
private const ROOT_DIR = __DIR__;
private const SUCCESS = 'success';
private const FAILED = 'failed';
private const YES = 'yes';
public function ciPackages(ConsoleIO $io, string $packagesJson): ?Result
{
$packages = json_decode($packagesJson, true);
$result = [];
$failed = false;
foreach ($packages as $package) {
$this->startGroup($package);
try {
$processResult = $this->processPackagePipeline($package);
$result[$package] = $processResult->wasSuccessful() ? self::SUCCESS : self::FAILED;
} catch (TaskException) {
$result[$package] = self::FAILED;
}
$this->endGroup();
}
foreach ($result as $packageName => $value) {
printf('%s %s%s', $value === self::SUCCESS ? '✅' : '❌', $packageName, \PHP_EOL);
$failed = $failed || $value === self::FAILED;
}
exit($failed ? 1 : 0);
}
/**
* @throws TaskException
*/
private function processPackagePipeline(string $package): Result
{
$symfonyVersion = getenv('SYMFONY_VERSION');
$unstable = getenv('UNSTABLE');
$packagePath = sprintf('%s/src/Sylius/%s', self::ROOT_DIR, $package);
$composerJsonPath = sprintf('%s/composer.json', $packagePath);
if (false === $symfonyVersion) {
throw new \RuntimeException('SYMFONY_VERSION environment variable is not set.');
}
if (!file_exists($composerJsonPath)) {
throw new \RuntimeException('composer.json file does not exist.');
}
$task = $this->taskExecStack()
->dir($packagePath)
->stopOnFail()
->exec(sprintf('composer config extra.symfony.require "%s"', $symfonyVersion))
;
if (self::YES === $unstable) {
$task->exec('composer config minimum-stability dev');
$task->exec('composer config prefer-stable true');
}
$task
->exec('composer update --no-scripts --no-interaction')
->exec('composer validate --ansi --strict')
;
if (in_array($package, ['Bundle/AdminBundle', 'Bundle/ApiBundle', 'Bundle/CoreBundle'])) {
$this->createTestAssets(sprintf('%s/tests/Application', $packagePath));
$this->createTestAssets(sprintf('%s/test', $packagePath)); // Remove after all test apps have been moved
}
if ('Bundle/ApiBundle' === $package) {
$task->exec('tests/Application/bin/console doctrine:schema:update --force');
}
if (file_exists(sprintf('%s/phpunit.xml', $packagePath)) || file_exists(sprintf('%s/phpunit.xml.dist', $packagePath))) {
$task->exec('vendor/bin/phpunit --colors=always');
}
return $task->run();
}
private function createTestAssets(string $testAppDirectory): void
{
$adminBuildDir = sprintf('%s/public/build/admin', $testAppDirectory);
$shopBuildDir = sprintf('%s/public/build/shop', $testAppDirectory);
if (!file_exists($adminBuildDir)) {
mkdir($adminBuildDir, 0777, true);
file_put_contents(sprintf('%s/manifest.json', $adminBuildDir), '{}');
}
if (!file_exists($shopBuildDir)) {
mkdir($shopBuildDir, 0777, true);
file_put_contents(sprintf('%s/manifest.json', $shopBuildDir), '{}');
}
}
private function startGroup(string $groupName): void
{
printf("::group::%s\n", $groupName);
}
private function endGroup(): void
{
echo "\n::endgroup::\n\n";
}
}

View file

@ -190,7 +190,6 @@
"require-dev": {
"behat/behat": "^3.22",
"behat/mink-selenium2-driver": "^1.7",
"consolidation/robo": "^4.0 || ^5.0",
"dbrekelmans/bdi": "^1.3",
"dmore/behat-chrome-extension": "^1.4",
"dmore/chrome-mink-driver": "^2.9",