Skip to content

Commit b710e07

Browse files
Merge pull request #112 from creative-commoners/pulls/1/mysql84
ENH Add MySQL 8.4 to matrix
2 parents 8bcfe4f + 1836950 commit b710e07

File tree

3 files changed

+222
-9
lines changed

3 files changed

+222
-9
lines changed

consts.php

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
const DB_MYSQL_57 = 'mysql57';
44
const DB_MYSQL_57_PDO = 'mysql57pdo';
55
const DB_MYSQL_80 = 'mysql80';
6+
const DB_MYSQL_84 = 'mysql84';
67
const DB_PGSQL = 'pgsql';
78
const DB_MARIADB = 'mariadb';
89

job_creator.php

+29-9
Original file line numberDiff line numberDiff line change
@@ -311,12 +311,15 @@ private function createPhpunitJobs(
311311
]);
312312
} else {
313313
$cmsMajor = BranchLogic::getCmsMajor($this->repoData, $this->branch, $this->getComposerJsonContent()) ?: MetaData::LOWEST_SUPPORTED_CMS_MAJOR;
314+
$dbsAdded = [];
315+
$db = in_array($cmsMajor, ['4', '5']) ? DB_MYSQL_57 : DB_MARIADB;
314316
$matrix['include'][] = $this->createJob(0, [
315317
'composer_args' => '--prefer-lowest',
316-
'db' => in_array($cmsMajor, ['4', '5']) ? DB_MYSQL_57 : DB_MARIADB,
318+
'db' => $db,
317319
'phpunit' => true,
318320
'phpunit_suite' => $suite,
319321
]);
322+
$dbsAdded[] = $db;
320323
if ($cmsMajor === '4') {
321324
if (!$this->doRunPhpCoverage($run)) {
322325
// 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(
334337
'phpunit_suite' => $suite,
335338
]);
336339
} else {
337-
// phpunit tests for cms 5 are run on php 8.1, 8.2 or 8.3 and mysql 8.0 or mariadb
340+
// phpunit tests for cms 5 are run on php 8.1, 8.2 or 8.3 and mysql 8.0, 8.4 or mariadb
338341
$phpToDB = $this->generatePhpToDBMap();
342+
$lastPhp = null;
339343
foreach ($phpToDB as $php => $db) {
340344
$matrix['include'][] = $this->createJob($this->getIndexByPHPVersion($php), [
341345
'db' => $db,
342346
'phpunit' => true,
343347
'phpunit_suite' => $suite,
344348
]);
349+
$dbsAdded[] = $db;
350+
$lastPhp = $php;
351+
}
352+
$dbNotAdded = array_diff($this->getDBs(), $dbsAdded);
353+
foreach ($dbNotAdded as $db) {
354+
$matrix['include'][] = $this->createJob($this->getIndexByPHPVersion($lastPhp), [
355+
'db' => $db,
356+
'phpunit' => true,
357+
'phpunit_suite' => $suite,
358+
]);
345359
}
346360
}
347361
}
@@ -365,6 +379,18 @@ private function getIndexByPHPVersion(string $version): int
365379
return array_search($version, $this->getListOfPhpVersionsByBranchName()) ?? 0;
366380
}
367381

382+
/**
383+
* Return a list of DBS to test against for the current CMS major
384+
*/
385+
private function getDBs()
386+
{
387+
$cmsMajor = BranchLogic::getCmsMajor($this->repoData, $this->branch, $this->getComposerJsonContent()) ?: MetaData::LOWEST_SUPPORTED_CMS_MAJOR;
388+
if ($cmsMajor === '5') {
389+
return [DB_MARIADB, DB_MYSQL_80, DB_MYSQL_84];
390+
}
391+
return [DB_MYSQL_80, DB_MYSQL_84, DB_MARIADB];
392+
}
393+
368394
/**
369395
* Generate a map of php versions to db versions
370396
* e.g. [ '8.1' => 'mariadb', '8.2' => 'mysql80' ]
@@ -373,12 +399,7 @@ private function generatePhpToDBMap(): array
373399
{
374400
$map = [];
375401
$phpVersions = $this->getListOfPhpVersionsByBranchName();
376-
$cmsMajor = BranchLogic::getCmsMajor($this->repoData, $this->branch, $this->getComposerJsonContent()) ?: MetaData::LOWEST_SUPPORTED_CMS_MAJOR;
377-
if ($cmsMajor === '5') {
378-
$dbs = [DB_MARIADB, DB_MYSQL_80];
379-
} else {
380-
$dbs = [DB_MYSQL_80, DB_MARIADB];
381-
}
402+
$dbs = $this->getDBs();
382403
foreach ($phpVersions as $key => $phpVersion) {
383404
if (count($phpVersions) < 3) {
384405
$map[$phpVersion] = $dbs[$key];
@@ -387,7 +408,6 @@ private function generatePhpToDBMap(): array
387408
$map[$phpVersion] = array_key_exists($key, $dbs) ? $dbs[$key - 1] : DB_MYSQL_80;
388409
}
389410
}
390-
391411
return $map;
392412
}
393413

0 commit comments

Comments
 (0)