Skip to content
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

ENH Increment the version of installer for --prefer-lowest builds #130

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,37 @@ jobs:
cat __update_attempt.txt
# Using exit code 2 as it's the same code that composer uses when it fails
exit 2
elif [[ "${{ matrix.composer_args }}" =~ --prefer-lowest ]]; then
# --prefer-lowest builds start with the lowest version of silverstripe/intaller for non-core modules
# These will not install if there are core requirements in the modules composer.json that require
# a newer version of a core requirement
# Increment the version of installer up until something installs
echo "Could not run composer update with version of silverstripe/installer, attempting a later version"
[[ "${{ matrix.installer_version }}" =~ ^([1-9])\.0\.x\-dev$ ]]
MAJOR=${BASH_REMATCH[1]}
SUCCESSFULLY_REQUIRED='false'
# Previously we attemped <major>.0.x-dev, try up to <major>.4.x-dev which should be the highest minor
for MI in 1 2 3 4; do
if [[ $SUCCESSFULLY_REQUIRED == 'false' ]]; then
VERSION="$MAJOR.$MI.x-dev"
echo "Attempting to require silverstripe/installer $VERSION"
composer require silverstripe/installer:$VERSION 2> __require_attempt.txt || :
if ! [[ $(cat __require_attempt.txt) =~ Problem ]]; then
SUCCESSFULLY_REQUIRED='true'
echo "Succesfully required silverstripe/installer $VERSION"
rm __require_attempt.txt
cat composer.json
else
echo "Failed to require silverstripe/installer $VERSION"
fi
fi
done
if [[ $SUCCESSFULLY_REQUIRED == 'false' ]]; then
cat composer.json
cat __require_attempt.txt
exit 2
fi
rm __update_attempt.txt
elif [[ "${{ matrix.installer_version }}" =~ ^([1-9])\.([0-9]+)\.x\-dev$ ]]; then
# gha-generate-matrix will not always provide a compatibile version of silverstripe/installer due to
# limitations of knowing what versions of silverstripe/installer the pushed code is compatible with
Expand Down
Loading