Skip to content

Commit de749e3

Browse files
committed
minor #924 [ci] handle new 5.4 branch & make dev tests green (jrushlow)
This PR was squashed before being merged into the 1.0-dev branch. Discussion ---------- [ci] handle new 5.4 branch & make dev tests green - We don't have a `5.x` branch anymore on `symfony/symfony` - let's use the `dev` version specified in `versions.json` in place of the `5.x` branch. - `SYMFONY_REQUIRE` env param in CI overrides the stability version specified for the run, resulting in a mixed set of versioned packages for each test. e.g. `symfony/http === v5.3.0` && `symfony/twig-bridge === v5.4.x-dev` even though `SYMFONY_SKELETON_STABILITY=dev` is set. - some symfony components now use `psr/log` `^1 || ^2 || ^3` but `doctrine/migrations` still uses `^1`. For migrations tests, because `doctrine/orm` is required after the skeleton has been built, there is a version conflict w/ the locked, `psr/log:2.0` and `doctrine/migrations`. Calling `psr/log:^1.1.4` resolves this issue and allows the tests to run. _contains ``@legacy`` tags for internal use:_ - Remove `psr/log:^1.1.4` as extraDependency in `MakeMigrationsTest` once doctrine/migrations#1184 is merged, tagged, and released. Commits ------- e6b691f [ci] handle new 5.4 branch & make dev tests green
2 parents f093d90 + e6b691f commit de749e3

File tree

3 files changed

+37
-7
lines changed

3 files changed

+37
-7
lines changed

.github/workflows/ci.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ on:
1111
env:
1212
PHPUNIT_FLAGS: "-v"
1313
SYMFONY_PHPUNIT_DIR: "$HOME/symfony-bridge/.phpunit"
14-
SYMFONY_REQUIRE: ">=4.0"
1514

1615
jobs:
1716
coding-standards:

src/Test/MakerTestEnvironment.php

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -460,18 +460,17 @@ private function getTargetSkeletonVersion(): string
460460

461461
switch ($stability) {
462462
case 'stable-dev':
463-
$httpClient = HttpClient::create();
464-
$response = $httpClient->request('GET', 'https://symfony.com/versions.json');
465-
$data = $response->toArray();
466-
467-
$version = $data['latest'];
463+
$version = ($this->getSymfonyVersions())['latest'];
468464
$parts = explode('.', $version);
469465

470466
$this->targetSkeletonVersion = sprintf('%s.%s.x-dev', $parts[0], $parts[1]);
471467

472468
break;
473469
case 'dev':
474-
$this->targetSkeletonVersion = '5.x-dev';
470+
$version = ($this->getSymfonyVersions())['dev'];
471+
$parts = explode('.', $version);
472+
473+
$this->targetSkeletonVersion = sprintf('%s.%s.x-dev', $parts[0], $parts[1]);
475474

476475
break;
477476
default:
@@ -481,4 +480,12 @@ private function getTargetSkeletonVersion(): string
481480

482481
return $this->targetSkeletonVersion;
483482
}
483+
484+
private function getSymfonyVersions(): array
485+
{
486+
$httpClient = HttpClient::create();
487+
$response = $httpClient->request('GET', 'https://symfony.com/versions.json');
488+
489+
return $response->toArray();
490+
}
484491
}

tests/Maker/MakeMigrationTest.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ public function getTestDetails()
2929
// only requires doctrine/dbal. But we're testing with the ORM,
3030
// so let's install it
3131
->addExtraDependencies('doctrine/orm:@stable')
32+
/*
33+
* @legacy doctrine/migrations does not support psr/log >=2
34+
* some symfony components use psr/log ^1 || ^2 || ^3
35+
* once doctrine/migrations supports psr log >= 2, this line can be removed.
36+
*/
37+
->addExtraDependencies('psr/log:^1.1.4')
3238
->assert(function (string $output, string $directory) {
3339
$this->assertStringContainsString('Success', $output);
3440

@@ -54,6 +60,12 @@ public function getTestDetails()
5460
// sync the database, so no changes are needed
5561
->configureDatabase()
5662
->addExtraDependencies('doctrine/orm:@stable')
63+
/*
64+
* @legacy doctrine/migrations does not support psr/log >=2
65+
* some symfony components use psr/log ^1 || ^2 || ^3
66+
* once doctrine/migrations supports psr log >= 2, this line can be removed.
67+
*/
68+
->addExtraDependencies('psr/log:^1.1.4')
5769
->assert(function (string $output, string $directory) {
5870
$this->assertStringNotContainsString('Success', $output);
5971

@@ -71,6 +83,12 @@ public function getTestDetails()
7183
->configureDatabase(false)
7284
->addRequiredPackageVersion('doctrine/doctrine-migrations-bundle', '>=3')
7385
->addExtraDependencies('doctrine/orm:@stable')
86+
/*
87+
* @legacy doctrine/migrations does not support psr/log >=2
88+
* some symfony components use psr/log ^1 || ^2 || ^3
89+
* once doctrine/migrations supports psr log >= 2, this line can be removed.
90+
*/
91+
->addExtraDependencies('psr/log:^1.1.4')
7492
// generate a migration first
7593
->addPreMakeCommand('php bin/console make:migration')
7694
->assert(function (string $output, string $directory) {
@@ -90,6 +108,12 @@ public function getTestDetails()
90108
->configureDatabase(false)
91109
->addRequiredPackageVersion('doctrine/doctrine-migrations-bundle', '>=3')
92110
->addExtraDependencies('doctrine/orm:@stable')
111+
/*
112+
* @legacy doctrine/migrations does not support psr/log >=2
113+
* some symfony components use psr/log ^1 || ^2 || ^3
114+
* once doctrine/migrations supports psr log >= 2, this line can be removed.
115+
*/
116+
->addExtraDependencies('psr/log:^1.1.4')
93117
// generate a migration first
94118
->addPreMakeCommand('php bin/console make:migration')
95119
->assert(function (string $output, string $directory) {

0 commit comments

Comments
 (0)