Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX Use latest compatible version of installer #116

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
6 changes: 4 additions & 2 deletions job_creator.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ public function getInstallerVersion(
}
}
// hardcoded installer version for repo version
foreach (array_keys(INSTALLER_TO_REPO_MINOR_VERSIONS) as $installerVersion) {
$keys = array_keys(INSTALLER_TO_REPO_MINOR_VERSIONS);
$keys = array_reverse($keys);
foreach ($keys as $installerVersion) {
foreach (INSTALLER_TO_REPO_MINOR_VERSIONS[$installerVersion] as $_repo => $_repoVersions) {
$repoVersions = is_array($_repoVersions) ? $_repoVersions : [$_repoVersions];
foreach ($repoVersions as $repoVersion) {
Expand Down Expand Up @@ -375,7 +377,7 @@ private function getListOfPhpVersionsByBranchName(): array
$json = $this->getComposerJsonContent();
if ($json) {
$php = $json->require->php ?? null;
$php = str_replace('^', '', $php);
$php = str_replace('^', '', $php ?? '');
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixes deprecation notice in php 8.3 - Deprecated: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in path/to/gha-generate-matrix/job_creator.php on line 378

$cmsMajors = array_keys(MetaData::PHP_VERSIONS_FOR_CMS_RELEASES);
$cmsMajors = array_filter($cmsMajors, fn($v) => !str_contains($v, '.'));
$cmsMajors = array_reverse($cmsMajors);
Expand Down
99 changes: 98 additions & 1 deletion tests/JobCreatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ public function provideGetInstallerVersion(): array
'html5-1' => ['myaccount/silverstripe-html5', '2', $nextMinorCms4],
'html5-2' => ['myaccount/silverstripe-html5', '2.2', '4.10.x-dev'],
'html5-3' => ['myaccount/silverstripe-html5', '2.3', '4.10.x-dev'],
'html5-4' => ['myaccount/silverstripe-html5', '2.4', '4.11.x-dev'],
'html5-4' => ['myaccount/silverstripe-html5', '2.4', '4.13.x-dev'],
'html5-5' => ['myaccount/silverstripe-html5', 'burger', $currentMinorCms4],
// force installer unlockedstepped repo
'serve1' => ['myaccount/silverstripe-serve', '2', $nextMinorCms4],
Expand Down Expand Up @@ -1144,6 +1144,103 @@ public function provideCreateJson(): array
],
]
],
// test for graphql 5.2 which is used in both installer 5.3 and installer 5.2
// it should use installer 5.3.x-dev
[
implode("\n", [
$this->getGenericYml(),
<<<EOT
github_repository: 'myaccount/silverstripe-graphql'
github_my_ref: '5.2'
parent_branch: ''
EOT
]),
false,
false,
false,
[
[
'installer_version' => '5.3.x-dev',
'php' => '8.1',
'db' => DB_MYSQL_57,
'composer_require_extra' => '',
'composer_args' => '--prefer-lowest',
'name_suffix' => '',
'phpunit' => 'true',
'phpunit_suite' => 'all',
'phplinting' => 'false',
'phpcoverage' => 'false',
'endtoend' => 'false',
'endtoend_suite' => 'root',
'endtoend_config' => '',
'endtoend_tags' => '',
'js' => 'false',
'doclinting' => 'false',
'needs_full_setup' => 'true',
'name' => '8.1 prf-low mysql57 phpunit all',
],
[
'installer_version' => '5.3.x-dev',
'php' => '8.2',
'db' => DB_MARIADB,
'composer_require_extra' => '',
'composer_args' => '',
'name_suffix' => '',
'phpunit' => 'true',
'phpunit_suite' => 'all',
'phplinting' => 'false',
'phpcoverage' => 'false',
'endtoend' => 'false',
'endtoend_suite' => 'root',
'endtoend_config' => '',
'endtoend_tags' => '',
'js' => 'false',
'doclinting' => 'false',
'needs_full_setup' => 'true',
'name' => '8.2 mariadb phpunit all',
],
[
'installer_version' => '5.3.x-dev',
'php' => '8.3',
'db' => DB_MYSQL_80,
'composer_require_extra' => '',
'composer_args' => '',
'name_suffix' => '',
'phpunit' => 'true',
'phpunit_suite' => 'all',
'phplinting' => 'false',
'phpcoverage' => 'false',
'endtoend' => 'false',
'endtoend_suite' => 'root',
'endtoend_config' => '',
'endtoend_tags' => '',
'js' => 'false',
'doclinting' => 'false',
'needs_full_setup' => 'true',
'name' => '8.3 mysql80 phpunit all',
],
[
'installer_version' => '5.3.x-dev',
'php' => '8.3',
'db' => DB_MYSQL_84,
'composer_require_extra' => '',
'composer_args' => '',
'name_suffix' => '',
'phpunit' => 'true',
'phpunit_suite' => 'all',
'phplinting' => 'false',
'phpcoverage' => 'false',
'endtoend' => 'false',
'endtoend_suite' => 'root',
'endtoend_config' => '',
'endtoend_tags' => '',
'js' => 'false',
'doclinting' => 'false',
'needs_full_setup' => 'true',
'name' => '8.3 mysql84 phpunit all',
],
]
],
];
}

Expand Down
Loading