From 18369504ce82f576d27ce9f1fb51aca26617fe95 Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Mon, 18 Nov 2024 13:15:44 +1300 Subject: [PATCH] ENH Add MySQL 8.4 to matrix --- consts.php | 1 + job_creator.php | 38 ++++++-- tests/JobCreatorTest.php | 192 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 222 insertions(+), 9 deletions(-) diff --git a/consts.php b/consts.php index 90b7efd..ad24396 100644 --- a/consts.php +++ b/consts.php @@ -3,6 +3,7 @@ const DB_MYSQL_57 = 'mysql57'; const DB_MYSQL_57_PDO = 'mysql57pdo'; const DB_MYSQL_80 = 'mysql80'; +const DB_MYSQL_84 = 'mysql84'; const DB_PGSQL = 'pgsql'; const DB_MARIADB = 'mariadb'; diff --git a/job_creator.php b/job_creator.php index d9b3946..8db418a 100644 --- a/job_creator.php +++ b/job_creator.php @@ -311,12 +311,15 @@ private function createPhpunitJobs( ]); } else { $cmsMajor = BranchLogic::getCmsMajor($this->repoData, $this->branch, $this->getComposerJsonContent()) ?: MetaData::LOWEST_SUPPORTED_CMS_MAJOR; + $dbsAdded = []; + $db = in_array($cmsMajor, ['4', '5']) ? DB_MYSQL_57 : DB_MARIADB; $matrix['include'][] = $this->createJob(0, [ 'composer_args' => '--prefer-lowest', - 'db' => in_array($cmsMajor, ['4', '5']) ? DB_MYSQL_57 : DB_MARIADB, + 'db' => $db, 'phpunit' => true, 'phpunit_suite' => $suite, ]); + $dbsAdded[] = $db; 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 @@ -334,14 +337,25 @@ private function createPhpunitJobs( 'phpunit_suite' => $suite, ]); } else { - // phpunit tests for cms 5 are run on php 8.1, 8.2 or 8.3 and mysql 8.0 or mariadb + // phpunit tests for cms 5 are run on php 8.1, 8.2 or 8.3 and mysql 8.0, 8.4 or mariadb $phpToDB = $this->generatePhpToDBMap(); + $lastPhp = null; foreach ($phpToDB as $php => $db) { $matrix['include'][] = $this->createJob($this->getIndexByPHPVersion($php), [ 'db' => $db, 'phpunit' => true, 'phpunit_suite' => $suite, ]); + $dbsAdded[] = $db; + $lastPhp = $php; + } + $dbNotAdded = array_diff($this->getDBs(), $dbsAdded); + foreach ($dbNotAdded as $db) { + $matrix['include'][] = $this->createJob($this->getIndexByPHPVersion($lastPhp), [ + 'db' => $db, + 'phpunit' => true, + 'phpunit_suite' => $suite, + ]); } } } @@ -365,6 +379,18 @@ private function getIndexByPHPVersion(string $version): int return array_search($version, $this->getListOfPhpVersionsByBranchName()) ?? 0; } + /** + * Return a list of DBS to test against for the current CMS major + */ + private function getDBs() + { + $cmsMajor = BranchLogic::getCmsMajor($this->repoData, $this->branch, $this->getComposerJsonContent()) ?: MetaData::LOWEST_SUPPORTED_CMS_MAJOR; + if ($cmsMajor === '5') { + return [DB_MARIADB, DB_MYSQL_80, DB_MYSQL_84]; + } + return [DB_MYSQL_80, DB_MYSQL_84, DB_MARIADB]; + } + /** * Generate a map of php versions to db versions * e.g. [ '8.1' => 'mariadb', '8.2' => 'mysql80' ] @@ -373,12 +399,7 @@ private function generatePhpToDBMap(): array { $map = []; $phpVersions = $this->getListOfPhpVersionsByBranchName(); - $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]; - } + $dbs = $this->getDBs(); foreach ($phpVersions as $key => $phpVersion) { if (count($phpVersions) < 3) { $map[$phpVersion] = $dbs[$key]; @@ -387,7 +408,6 @@ private function generatePhpToDBMap(): array $map[$phpVersion] = array_key_exists($key, $dbs) ? $dbs[$key - 1] : DB_MYSQL_80; } } - return $map; } diff --git a/tests/JobCreatorTest.php b/tests/JobCreatorTest.php index 87df123..dd642d2 100644 --- a/tests/JobCreatorTest.php +++ b/tests/JobCreatorTest.php @@ -332,6 +332,26 @@ public function provideCreateJson(): array 'needs_full_setup' => 'true', 'name' => '8.3 mysql80 phpunit all', ], + [ + 'installer_version' => '5.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', + ], [ 'installer_version' => '5.x-dev', 'php' => '8.1', @@ -448,6 +468,26 @@ public function provideCreateJson(): array 'needs_full_setup' => 'true', 'name' => '8.3 mysql80 phpunit all', ], + [ + 'installer_version' => '5.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', + ], [ 'installer_version' => '5.x-dev', 'php' => '8.1', @@ -698,6 +738,26 @@ public function provideCreateJson(): array 'needs_full_setup' => 'true', 'name' => '8.3 mysql80 phpunit all', ], + [ + 'installer_version' => '5.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', + ], ] ], // general test for v6 @@ -754,6 +814,26 @@ public function provideCreateJson(): array 'needs_full_setup' => 'true', 'name' => '8.3 mysql80 phpunit all', ], + [ + 'installer_version' => '6.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', + ], ] ], // general test for v5.1 @@ -830,6 +910,26 @@ public function provideCreateJson(): array 'needs_full_setup' => 'true', 'name' => '8.2 mysql80 phpunit all', ], + [ + 'installer_version' => '5.1.x-dev', + 'php' => '8.2', + '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.2 mysql84 phpunit all', + ], ] ], // general test for v5.2 @@ -906,6 +1006,26 @@ public function provideCreateJson(): array 'needs_full_setup' => 'true', 'name' => '8.3 mysql80 phpunit all', ], + [ + 'installer_version' => '5.2.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', + ], ] ], ]; @@ -1157,6 +1277,26 @@ public function provideCreateJsonForConfig(): array 'needs_full_setup' => 'false', 'name' => '8.2 mysql80 phpunit all', ], + [ + 'installer_version' => '', + 'php' => '8.2', + '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' => 'false', + 'name' => '8.2 mysql84 phpunit all', + ], ], ], 'cms 5.x' => [ @@ -1223,6 +1363,26 @@ public function provideCreateJsonForConfig(): array 'needs_full_setup' => 'false', 'name' => '8.3 mysql80 phpunit all', ], + [ + 'installer_version' => '', + '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' => 'false', + 'name' => '8.3 mysql84 phpunit all', + ], ], ], 'cms 6.x' => [ @@ -1269,6 +1429,26 @@ public function provideCreateJsonForConfig(): array 'needs_full_setup' => 'false', 'name' => '8.3 mysql80 phpunit all', ], + [ + 'installer_version' => '', + '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' => 'false', + 'name' => '8.3 mysql84 phpunit all', + ], ], ], ]; @@ -1815,6 +1995,7 @@ public function provideComposerInstall(): array '8.1 prf-low mysql57 phpunit all', '8.2 mariadb phpunit all', '8.3 mysql80 phpunit all', + '8.3 mysql84 phpunit all', ] ], 'composerupgrade_nophpversion_framework6' => [ @@ -1825,6 +2006,7 @@ public function provideComposerInstall(): array [ '8.3 prf-low mariadb phpunit all', '8.3 mysql80 phpunit all', + '8.3 mysql84 phpunit all', ] ], 'composerupgrade_definedphpversion_framework5' => [ @@ -1836,6 +2018,7 @@ public function provideComposerInstall(): array '8.1 prf-low mysql57 phpunit all', '8.2 mariadb phpunit all', '8.3 mysql80 phpunit all', + '8.3 mysql84 phpunit all', ] ], 'composerupgrade_invalidphpversion_framework5' => [ @@ -1847,6 +2030,7 @@ public function provideComposerInstall(): array '8.1 prf-low mysql57 phpunit all', '8.2 mariadb phpunit all', '8.3 mysql80 phpunit all', + '8.3 mysql84 phpunit all', ] ], 'composerupgrade_invalidphpversion_framework6' => [ @@ -1857,6 +2041,7 @@ public function provideComposerInstall(): array [ '8.3 prf-low mariadb phpunit all', '8.3 mysql80 phpunit all', + '8.3 mysql84 phpunit all', ] ], 'composerupgrade_nophpversion_framework51' => [ @@ -1868,6 +2053,7 @@ public function provideComposerInstall(): array '8.1 prf-low mysql57 phpunit all', '8.1 mariadb phpunit all', '8.2 mysql80 phpunit all', + '8.2 mysql84 phpunit all', ] ], 'composerupgrade_definedphpversion_framework51' => [ @@ -1879,6 +2065,7 @@ public function provideComposerInstall(): array '8.1 prf-low mysql57 phpunit all', '8.1 mariadb phpunit all', '8.2 mysql80 phpunit all', + '8.2 mysql84 phpunit all', ] ], 'composerupgrade_invalidphpversion_framework51' => [ @@ -1890,6 +2077,7 @@ public function provideComposerInstall(): array '8.1 prf-low mysql57 phpunit all', '8.1 mariadb phpunit all', '8.2 mysql80 phpunit all', + '8.2 mysql84 phpunit all', ] ], 'composerupgrade_nophpversion_framework52' => [ @@ -1901,6 +2089,7 @@ public function provideComposerInstall(): array '8.1 prf-low mysql57 phpunit all', '8.2 mariadb phpunit all', '8.3 mysql80 phpunit all', + '8.3 mysql84 phpunit all', ] ], 'composerupgrade_definedphpversion_framework52' => [ @@ -1912,6 +2101,7 @@ public function provideComposerInstall(): array '8.1 prf-low mysql57 phpunit all', '8.2 mariadb phpunit all', '8.3 mysql80 phpunit all', + '8.3 mysql84 phpunit all', ] ], 'composerupgrade_invalidphpversion_framework52' => [ @@ -1923,6 +2113,7 @@ public function provideComposerInstall(): array '8.1 prf-low mysql57 phpunit all', '8.2 mariadb phpunit all', '8.3 mysql80 phpunit all', + '8.3 mysql84 phpunit all', ] ], 'composerupgrade_invalidphpversion_notmodule1' => [ @@ -1985,6 +2176,7 @@ public function testDuplicateJobsRemoved(): void '8.1 prf-low mysql57 phpunit all', '8.2 mariadb phpunit all', '8.3 mysql80 phpunit all', + '8.3 mysql84 phpunit all', '8.2 mysql57 phpunit fish', '8.3 mysql57 phpunit fish', '8.3 mysql57 endtoend root',