-
Notifications
You must be signed in to change notification settings - Fork 6
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
NEW Use supported modules repo for branch-based logic #87
NEW Use supported modules repo for branch-based logic #87
Conversation
14002c3
to
a2f5fca
Compare
github_repository: 'silverstripe/installer' | ||
github_repository: 'silverstripe/fake-module' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that silverstripe/installer
was incorrect here, and all the tests for this are assuming therefore that this is effectively some random repo in the silverstripe org. I felt it's best to preserve those tests as they are and explicitly indicate that this is just a random repo.
The alternative is to rename this to silverstripe/silverstripe-installer
here but that fundamentally changes what's being tested. I think it's better that this works for any-old-random-repo rather than that it specifically works for installer.
'dev-4.10-release' | ||
'4.11.x-dev' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've removed all of the logic for -release
branches and removed most scenarios that tested against them - but I've kept this one (and just updated the expected value accordingly) so we do still have some check against what would happen with a branch with that suffix.
private function getBranchName(): string | ||
private function getInstallerBranch(): string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renamed to be clearer what this actually is - it's not the branch name in the repo, it's the name of the branch of installer that will be pulled in via composer.
if (in_array($this->repoName, NO_INSTALLER_LOCKSTEPPED_REPOS) || in_array($this->repoName, NO_INSTALLER_UNLOCKSTEPPED_REPOS)) { | ||
if (!$this->needsInstallerVersion()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change exits earlier under any scenario where we don't need installer for this repo.
Previously we had scenarios where we'd get through a bunch of this method only to hit a return ''
- now it does most of the relevant checks upfront.
This is mostly unrelated refactoring, but made the rest of it a lot easier to debug and refactor the relevant stuff.
{ | ||
if (!$this->composerJsonContent) { | ||
if (!file_exists($this->composerJsonPath)) { | ||
return null; | ||
} | ||
$this->composerJsonContent = json_decode(file_get_contents($this->composerJsonPath)); | ||
if ($this->composerJsonContent === null) { | ||
throw new RuntimeException('Could not decode composer.json - last error was: ' . json_last_error_msg()); | ||
} | ||
} | ||
return $this->composerJsonContent; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Previously we were decoding the file multiple times at different stages - now we just decode it once, whenever the first time is that we need it, and use that same decoded result every time.
hardcoded.php
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checked this by commenting out the 5.2
in consts and ran this with the 5.2.0 copy of .cow.pat.json
$installerVersions = array_diff($installerVersions, ['4', '5', '6', '7', '8', '9']); | ||
// get the minor portions of the verisons e.g. [9, 10, 11] | ||
$installerVersions = array_filter($installerVersions, fn ($v) => !ctype_digit((string) $v)); | ||
// get the minor portions of the versions e.g for ['4.9', '4.10', '4.11'] this returns [9, 10, 11] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unrelated refactoring that makes this more robust - we don't care about those specific values, we just care whether the value is a major (all digits) or not.
89dcff5
to
840b80e
Compare
action.yml
Outdated
rm ${{ github.action_path }}/composer.lock | ||
fi | ||
if [[ -d ${{ github.action_path }}/vendor ]]; then | ||
rm -r ${{ github.action_path }}/vendor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rm -r ${{ github.action_path }}/vendor | |
rm -rf ${{ github.action_path }}/vendor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't be necessary since we're not doing a --prefer-source
- but done nevertheless since it doesn't hurt anything I think.
composer.json
Outdated
@@ -0,0 +1,14 @@ | |||
{ | |||
"require-dev": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
require-dev should be below require, just cos :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That 1000000000% does not matter, but I'll make that change to humour you since I have to touch this file anyway. :p
composer.json
Outdated
"phpunit/phpunit": "^9.6" | ||
}, | ||
"require": { | ||
"silverstripe/supported-modules": "dev-pulls/main/combine-all-versions" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"silverstripe/supported-modules": "dev-pulls/main/combine-all-versions" | |
"silverstripe/supported-modules": "dev-main" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, that'll be done once the PR for that fork is merged, so we can easily rerun CI here against that PR to see it go green if changes are needed over there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
composer.json
Outdated
"repositories": { | ||
"silverstripe/supported-modules": { | ||
"type": "vcs", | ||
"url": "[email protected]:creative-commoners/supported-modules.git" | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"repositories": { | |
"silverstripe/supported-modules": { | |
"type": "vcs", | |
"url": "[email protected]:creative-commoners/supported-modules.git" | |
} | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Discussion in #87 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
840b80e
to
4b44f91
Compare
4b44f91
to
d7e9094
Compare
@GuySartorelli Remember to create a new minor branch and manually tag |
Here is a CI run built using this fork: https://github.com/GuySartorelli/silverstripe-framework/actions/runs/8932090672
Notably that produced the same matrix as on a regular run: https://github.com/silverstripe/silverstripe-framework/actions/runs/8896485327
Issue