From b0444a7589b8abc0ff3d7ebcd6610117dbb2a3b9 Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Wed, 28 Aug 2024 15:49:49 +1200 Subject: [PATCH] ENH Drop MySQL 5.7 for CMS 6 --- job_creator.php | 15 +++++++++++---- tests/JobCreatorTest.php | 26 +++++++++++++------------- 2 files changed, 24 insertions(+), 17 deletions(-) diff --git a/job_creator.php b/job_creator.php index 613504f..8e7678d 100644 --- a/job_creator.php +++ b/job_creator.php @@ -132,13 +132,15 @@ public function getInstallerVersion( public function createJob(int $phpIndex, array $opts): array { + $cmsMajor = BranchLogic::getCmsMajor($this->repoData, $this->branch, $this->getComposerJsonContent()) ?: MetaData::LOWEST_SUPPORTED_CMS_MAJOR; + $db = in_array($cmsMajor, ['4', '5']) ? DB_MYSQL_57 : DB_MYSQL_80; $default = [ # ensure there's a default value for all possible return keys # this allows us to use `if [[ "${{ matrix.key }}" == "true" ]]; then` in gha-ci/ci.yml 'installer_version' => $this->installerVersion, 'php' => $this->getPhpVersion($phpIndex), 'parent_branch' => $this->parentBranch, - 'db' => DB_MYSQL_57, + 'db' => $db, 'composer_require_extra' => '', 'composer_args' => '', 'composer_install' => false, @@ -303,13 +305,13 @@ private function createPhpunitJobs( 'phpunit_suite' => $suite, ]); } else { + $cmsMajor = BranchLogic::getCmsMajor($this->repoData, $this->branch, $this->getComposerJsonContent()) ?: MetaData::LOWEST_SUPPORTED_CMS_MAJOR; $matrix['include'][] = $this->createJob(0, [ 'composer_args' => '--prefer-lowest', - 'db' => DB_MYSQL_57, + 'db' => in_array($cmsMajor, ['4', '5']) ? DB_MYSQL_57 : DB_MARIADB, 'phpunit' => true, 'phpunit_suite' => $suite, ]); - $cmsMajor = BranchLogic::getCmsMajor($this->repoData, $this->branch, $this->getComposerJsonContent()) ?: MetaData::LOWEST_SUPPORTED_CMS_MAJOR; if ($cmsMajor === '4') { if (!$this->doRunPhpCoverage($run)) { // this same mysql pdo test is also created for the phpcoverage job, so only add it here if @@ -366,7 +368,12 @@ private function generatePhpToDBMap(): array { $map = []; $phpVersions = $this->getListOfPhpVersionsByBranchName(); - $dbs = [DB_MARIADB, DB_MYSQL_80]; + $cmsMajor = BranchLogic::getCmsMajor($this->repoData, $this->branch, $this->getComposerJsonContent()) ?: MetaData::LOWEST_SUPPORTED_CMS_MAJOR; + if ($cmsMajor === '5') { + $dbs = [DB_MARIADB, DB_MYSQL_80]; + } else { + $dbs = [DB_MYSQL_80, DB_MARIADB]; + } foreach ($phpVersions as $key => $phpVersion) { if (count($phpVersions) < 3) { $map[$phpVersion] = $dbs[$key]; diff --git a/tests/JobCreatorTest.php b/tests/JobCreatorTest.php index c65726a..bed43f4 100644 --- a/tests/JobCreatorTest.php +++ b/tests/JobCreatorTest.php @@ -717,7 +717,7 @@ public function provideCreateJson(): array [ 'installer_version' => '6.x-dev', 'php' => '8.3', - 'db' => DB_MYSQL_57, + 'db' => DB_MARIADB, 'composer_require_extra' => '', 'composer_args' => '--prefer-lowest', 'name_suffix' => '', @@ -732,12 +732,12 @@ public function provideCreateJson(): array 'js' => 'false', 'doclinting' => 'false', 'needs_full_setup' => 'true', - 'name' => '8.3 prf-low mysql57 phpunit all', + 'name' => '8.3 prf-low mariadb phpunit all', ], [ 'installer_version' => '6.x-dev', 'php' => '8.3', - 'db' => DB_MARIADB, + 'db' => DB_MYSQL_80, 'composer_require_extra' => '', 'composer_args' => '', 'name_suffix' => '', @@ -752,7 +752,7 @@ public function provideCreateJson(): array 'js' => 'false', 'doclinting' => 'false', 'needs_full_setup' => 'true', - 'name' => '8.3 mariadb phpunit all', + 'name' => '8.3 mysql80 phpunit all', ], ] ], @@ -1166,7 +1166,7 @@ public function provideCreateJsonForConfig(): array [ 'installer_version' => '', 'php' => '8.3', - 'db' => DB_MYSQL_57, + 'db' => DB_MARIADB, 'composer_require_extra' => '', 'composer_args' => '--prefer-lowest', 'name_suffix' => '', @@ -1181,12 +1181,12 @@ public function provideCreateJsonForConfig(): array 'js' => 'false', 'doclinting' => 'false', 'needs_full_setup' => 'false', - 'name' => '8.3 prf-low mysql57 phpunit all', + 'name' => '8.3 prf-low mariadb phpunit all', ], [ 'installer_version' => '', 'php' => '8.3', - 'db' => DB_MARIADB, + 'db' => DB_MYSQL_80, 'composer_require_extra' => '', 'composer_args' => '', 'name_suffix' => '', @@ -1201,7 +1201,7 @@ public function provideCreateJsonForConfig(): array 'js' => 'false', 'doclinting' => 'false', 'needs_full_setup' => 'false', - 'name' => '8.3 mariadb phpunit all', + 'name' => '8.3 mysql80 phpunit all', ], ], ], @@ -1708,7 +1708,7 @@ public function provideComposerInstall(): array '6.x-dev', 'silverstripe-vendormodule', [ - '8.3 mysql57 phpunit all' + '8.3 mysql80 phpunit all' ] ], 'composerinstall_definedphpversion_framework5' => [ @@ -1757,8 +1757,8 @@ public function provideComposerInstall(): array '6.x-dev', 'silverstripe-vendormodule', [ - '8.3 prf-low mysql57 phpunit all', - '8.3 mariadb phpunit all', + '8.3 prf-low mariadb phpunit all', + '8.3 mysql80 phpunit all', ] ], 'composerupgrade_definedphpversion_framework5' => [ @@ -1789,8 +1789,8 @@ public function provideComposerInstall(): array '6.x-dev', 'silverstripe-theme', [ - '8.3 prf-low mysql57 phpunit all', - '8.3 mariadb phpunit all', + '8.3 prf-low mariadb phpunit all', + '8.3 mysql80 phpunit all', ] ], 'composerupgrade_nophpversion_framework51' => [