diff --git a/.gitignore b/.gitignore index 165765a..ae80c64 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ .phpunit.result.cache +.cow.pat.json diff --git a/consts.php b/consts.php index 5921150..fd5c339 100644 --- a/consts.php +++ b/consts.php @@ -107,12 +107,131 @@ ], ]; +// use hardcoded.php to bulk update update this after creating a .cow.pat.json +// for multiple versions, use an array e.g. silverstripe-mymodule => ['2.3', '2.4'] const INSTALLER_TO_REPO_MINOR_VERSIONS = [ '4.10' => [ - 'silverstripe-html5' => '2.3', + 'comment-notifications' => '2.2', + 'cwp' => '2.9', + 'cwp-agencyextensions' => '2.6', + 'cwp-core' => '2.9', + 'cwp-pdfexport' => '1.3', + 'cwp-search' => '1.6', + 'cwp-starter-theme' => '3.2', + 'cwp-watea-theme' => '3.1', + 'silverstripe-advancedworkflow' => '5.6', + 'silverstripe-akismet' => '4.2', + 'silverstripe-auditor' => '2.4', + 'silverstripe-blog' => '3.9', + 'silverstripe-ckan-registry' => '1.4', + 'silverstripe-comments' => '3.7', + 'silverstripe-composer-update-checker' => '2.1', + 'silverstripe-config' => '1.3', + 'silverstripe-content-widget' => '2.3', + 'silverstripe-contentreview' => '4.4', + 'silverstripe-crontask' => '2.4', + 'silverstripe-documentconverter' => '2.2', + 'silverstripe-elemental' => '4.8', 'silverstripe-elemental-bannerblock' => '2.4', + 'silverstripe-elemental-fileblock' => '2.3', + 'silverstripe-elemental-userforms' => '3.1', + 'silverstripe-environmentcheck' => '2.4', + 'silverstripe-externallinks' => '2.2', + 'silverstripe-fluent' => '4.6', + 'silverstripe-fulltextsearch' => '3.9', + 'silverstripe-graphql' => '3.7', + 'silverstripe-gridfieldqueuedexport' => '2.6', + 'silverstripe-html5' => ['2.2', '2.3'], + 'silverstripe-hybridsessions' => '2.4', + 'silverstripe-iframe' => '2.2', + 'silverstripe-ldap' => '1.3', + 'silverstripe-login-forms' => '4.6', + 'silverstripe-maintenance' => '2.4', + 'silverstripe-mfa' => '4.5', + 'silverstripe-mimevalidator' => '2.3', + 'silverstripe-multivaluefield' => '5.2', + 'silverstripe-queuedjobs' => '4.9', + 'silverstripe-realme' => '4.2', + 'silverstripe-registry' => '2.4', + 'silverstripe-restfulserver' => '2.4', + 'silverstripe-security-extensions' => '4.2', + 'silverstripe-securityreport' => '2.4', + 'silverstripe-segment-field' => '2.5', 'silverstripe-session-manager' => '1.2', - 'silverstripe-userforms' => '5.12', + 'silverstripe-sharedraftcontent' => '2.6', + 'silverstripe-sitewidecontent-report' => '3.2', + 'silverstripe-spamprotection' => '3.2', + 'silverstripe-spellcheck' => '2.3', + 'silverstripe-subsites' => '2.5', + 'silverstripe-tagfield' => '2.8', + 'silverstripe-taxonomy' => '2.3', + 'silverstripe-textextraction' => '3.3', 'silverstripe-totp-authenticator' => '4.3', + 'silverstripe-userforms' => ['5.11', '5.12'], + 'silverstripe-versionfeed' => '2.2', + 'silverstripe-webauthn-authenticator' => '4.4', + 'silverstripe-widgets' => '2.2', + ], + '4.11' => [ + 'comment-notifications' => '2.3', + 'cwp' => '2.10', + 'cwp-agencyextensions' => '2.7', + 'cwp-core' => ['2.10', '2.11'], + 'cwp-pdfexport' => '1.4', + 'cwp-search' => '1.7', + 'cwp-starter-theme' => '3.2', + 'cwp-watea-theme' => '3.1', + 'silverstripe-advancedworkflow' => '5.7', + 'silverstripe-akismet' => '4.3', + 'silverstripe-auditor' => '2.5', + 'silverstripe-blog' => '3.10', + 'silverstripe-ckan-registry' => '1.5', + 'silverstripe-comments' => '3.8', + 'silverstripe-composer-update-checker' => '3.0', + 'silverstripe-config' => '1.4', + 'silverstripe-content-widget' => '2.4', + 'silverstripe-contentreview' => '4.5', + 'silverstripe-crontask' => '2.5', + 'silverstripe-documentconverter' => '2.3', + 'silverstripe-elemental' => '4.9', + 'silverstripe-elemental-bannerblock' => '2.5', + 'silverstripe-elemental-fileblock' => '2.4', + 'silverstripe-elemental-userforms' => '3.2', + 'silverstripe-environmentcheck' => '2.5', + 'silverstripe-externallinks' => '2.3', + 'silverstripe-fluent' => '4.7', + 'silverstripe-fulltextsearch' => '3.11', + 'silverstripe-graphql' => '4.0', + 'silverstripe-gridfieldqueuedexport' => '2.7', + 'silverstripe-html5' => '2.4', + 'silverstripe-hybridsessions' => '2.5', + 'silverstripe-iframe' => '2.3', + 'silverstripe-ldap' => '1.4', + 'silverstripe-login-forms' => '4.7', + 'silverstripe-maintenance' => '2.6', + 'silverstripe-mfa' => '4.6', + 'silverstripe-mimevalidator' => '2.4', + 'silverstripe-multivaluefield' => '5.3', + 'silverstripe-queuedjobs' => '4.10', + 'silverstripe-realme' => '4.3', + 'silverstripe-registry' => '2.5', + 'silverstripe-restfulserver' => '2.5', + 'silverstripe-security-extensions' => '4.3', + 'silverstripe-securityreport' => '2.5', + 'silverstripe-segment-field' => '2.6', + 'silverstripe-session-manager' => '1.3', + 'silverstripe-sharedraftcontent' => '2.7', + 'silverstripe-sitewidecontent-report' => '3.3', + 'silverstripe-spamprotection' => '3.3', + 'silverstripe-spellcheck' => '2.4', + 'silverstripe-subsites' => '2.6', + 'silverstripe-tagfield' => '2.9', + 'silverstripe-taxonomy' => '2.4', + 'silverstripe-textextraction' => '3.4', + 'silverstripe-totp-authenticator' => '4.4', + 'silverstripe-userforms' => '5.13', + 'silverstripe-versionfeed' => '2.3', + 'silverstripe-webauthn-authenticator' => '4.5', + 'silverstripe-widgets' => '2.3', ] ]; diff --git a/hardcoded.php b/hardcoded.php new file mode 100644 index 0000000..4b37290 --- /dev/null +++ b/hardcoded.php @@ -0,0 +1,52 @@ +Version, $m); + $versions[$repoName] = $m[1]; + } + foreach ((array) $node->Items as $itemName => $item) { + parseNode($itemName, $item, $versions); + } +} + +foreach (json_decode(file_get_contents($filename)) as $itemName => $item) { + parseNode($itemName, $item, $versions); +} + +ksort($versions); +foreach ($versions as $repoName => $version) { + echo " '$repoName' => '$version',\n"; +} diff --git a/job_creator.php b/job_creator.php index 840126f..2c9d559 100644 --- a/job_creator.php +++ b/job_creator.php @@ -38,9 +38,12 @@ public function getInstallerVersion(): string } // hardcoded installer version for repo version foreach (array_keys(INSTALLER_TO_REPO_MINOR_VERSIONS) as $installerVersion) { - foreach (INSTALLER_TO_REPO_MINOR_VERSIONS[$installerVersion] as $_repo => $repoVersion) { - if ($repo === $_repo && $repoVersion === $branch) { - return $installerVersion . '.x-dev'; + foreach (INSTALLER_TO_REPO_MINOR_VERSIONS[$installerVersion] as $_repo => $_repoVersions) { + $repoVersions = is_array($_repoVersions) ? $_repoVersions : [$_repoVersions]; + foreach ($repoVersions as $repoVersion) { + if ($repo === $_repo && $repoVersion === $branch) { + return $installerVersion . '.x-dev'; + } } } } diff --git a/tests/JobCreatorTest.php b/tests/JobCreatorTest.php index 0a313e0..c41ce94 100644 --- a/tests/JobCreatorTest.php +++ b/tests/JobCreatorTest.php @@ -130,6 +130,12 @@ public function provideGetInstallerVersion(): array ['myaccount/silverstripe-session-manager', '1', $latest], ['myaccount/silverstripe-session-manager', '1.2', '4.10.x-dev'], ['myaccount/silverstripe-session-manager', 'burger', $latest], + // hardcoded repo version using array + ['myaccount/silverstripe-html5', '2', $latest], + ['myaccount/silverstripe-html5', '2.2', '4.10.x-dev'], + ['myaccount/silverstripe-html5', '2.3', '4.10.x-dev'], + ['myaccount/silverstripe-html5', '2.4', '4.11.x-dev'], + ['myaccount/silverstripe-html5', 'burger', $latest], ]; } @@ -396,9 +402,6 @@ public function testGetPhpVersion($composerPhpConstraint, $expectedPhps): void // framework 4.10.x-dev which creates php 7.3 jobs, this is so that this unit test // keeps working as we increment the latest version of installer $repo = 'silverstripe-elemental-bannerblock'; - // use a hardcoded entry from INSTALLER_TO_REPO_MINOR_VERSIONS so that we get - // framework 4.10.x-dev which creates php 7.3 jobs, this is so that this unit test - // keeps working as we increment the latest version of installer $minorVersion = '2.4'; if (INSTALLER_TO_REPO_MINOR_VERSIONS['4.10'][$repo] != $minorVersion) { throw new Exception('Required const is missing for unit testing');