diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1f35bf4c..c2a2ee58 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -24,6 +24,7 @@ jobs: - Squeak64-5.2 - Squeak64-5.1 - Squeak64-trunk + - Squeak64-18242 - Pharo64-stable - Pharo64-alpha - Pharo64-9.0 diff --git a/helpers.sh b/helpers.sh index 1e728674..4ba20771 100644 --- a/helpers.sh +++ b/helpers.sh @@ -193,7 +193,30 @@ is_sudo_enabled() { $(sudo -n true > /dev/null 2>&1) } +is_tagged_build() { + if [[ "${config_smalltalk}" =~ ^(Squeak(32|64))?-([[:digit:]]+)$ ]]; then + source "${SMALLTALK_CI_HOME}/squeak/version_tags.sh" + export SCIII_SMALLTALK_VERSION="${BASH_REMATCH[-1]}" + export SCIII_LATEST_RELEASE="${BASH_REMATCH[1]}-$(squeak::latest_release_before ${SCIII_SMALLTALK_VERSION})" + return 0 + fi + return 1 +} + is_trunk_build() { + if is_tagged_build; then + case "${config_smalltalk}" in + Squeak*) + if config_smalltalk="${SCIII_LATEST_RELEASE}" is_trunk_build; then + return 0 + else + return 1 + fi + ;; + esac + return 1 + fi + case "${config_smalltalk}" in *"trunk"|*"Trunk"|*"latest"|*"Latest") return 0 diff --git a/squeak/prepare.st b/squeak/prepare.st index 9447864e..cc110213 100644 --- a/squeak/prepare.st +++ b/squeak/prepare.st @@ -1,4 +1,4 @@ -| monitor | +| monitor trunk_version | FileStream startUp: true. monitor := [ [ FileStream stdout nextPutAll: '.'. @@ -37,19 +37,32 @@ Installer gemsource "==============================================================================" "Update Squeak image" -Smalltalk at: #MCMcmUpdater ifPresent: [ :updater | - [[ (updater respondsTo: #doUpdate) - ifTrue: [ updater doUpdate ] - ifFalse: [ - (updater respondsTo: #updateFromDefaultRepository) - ifTrue: [ updater updateFromDefaultRepository ] - ifFalse: [ ((updater respondsTo: #default) and: [ - updater default respondsTo: #doUpdate: ]) - ifTrue: [ updater default doUpdate: false ] ] ] ] - on: Warning do: [ :ex | ex resume: true ]] - on: Error do: [ :ex | - FileStream stdout nextPutAll: ex asString. - Smalltalk snapshot: true andQuit: true ]]. +[ [ (SmalltalkCI getEnv: 'SCIII_SMALLTALK_VERSION') ifNotNil: [ :version | + trunk_version = version asNumber. + Installer new primMerge: 'MonticelloConfigurations-ct.167.mcz' from: MCRepository inbox; flag: #todo "ct: preview"]. +(Smalltalk classNamed: #MCMcmUpdater) ifNotNil: [ :updater | + trunk_version + ifNotNil: [ + updater defaultUpdateURL: MCHttpRepository trunkUrlString. + updater default doUpdate: false upToUpdate: trunk_version ] + ifNil: [ (updater respondsTo: #doUpdate) + ifTrue: [ updater doUpdate ] + ifFalse: [ + (updater respondsTo: #updateFromDefaultRepository) + ifTrue: [ updater updateFromDefaultRepository ] + ifFalse: [ ((updater respondsTo: #default) and: [ + updater default respondsTo: #doUpdate: ]) + ifTrue: [ updater default doUpdate: false ] ] ] ] ]. +trunk_version ifNotNil: [ + self + assert: SystemVersion current highestUpdate >= trunk_version + descriptionBlock: [ 'Should be Trunk version <1p> or higher now but is <2p>' + expandMacrosWith: SystemVersion current highestUpdate + with: trunk_version ] ] ] + on: Warning do: [ :ex | ex resume: true ] ] + on: Error do: [ :ex | + FileStream stdout nextPutAll: ex asString. + Smalltalk snapshot: true andQuit: true ]. monitor terminate. monitor := nil. diff --git a/squeak/run.sh b/squeak/run.sh index 43e7b700..094dc2b0 100755 --- a/squeak/run.sh +++ b/squeak/run.sh @@ -120,8 +120,8 @@ squeak::prepare_image() { local status=0 fold_start prepare_image "Preparing ${config_smalltalk} image for CI..." - cp "${SMALLTALK_CI_HOME}/squeak/prepare.st" \ - "${SMALLTALK_CI_BUILD}/prepare.st" + is_tagged_build # parse SCIII_SMALLTALK_VERSION + sed "s/(SmalltalkCI getEnv: 'SCIII_SMALLTALK_VERSION')/${SCIII_SMALLTALK_VERSION:-nil}/" "${SMALLTALK_CI_HOME}/squeak/prepare.st" > "${SMALLTALK_CI_BUILD}/prepare.st" # SmalltalkCI will be installed later into the image squeak::run_script "prepare.st" || status=$? fold_end prepare_image @@ -351,16 +351,18 @@ EOL ################################################################################ run_build() { if ! image_is_user_provided; then + ! is_tagged_build # try to parse $SCIII_LATEST_RELEASE + download_version="${SCIII_LATEST_RELEASE:-${config_smalltalk}}" if is_trunk_build; then - squeak::download_trunk_image + config_smalltalk=${download_version} squeak::download_trunk_image else - squeak::download_image "${config_smalltalk}" + squeak::download_image ${download_version} fi fi if ! vm_is_user_provided; then squeak::prepare_vm fi - if is_trunk_build || image_is_user_provided; then + if is_tagged_build || is_trunk_build || image_is_user_provided; then squeak::prepare_image fi if ston_includes_loading; then diff --git a/squeak/version_tags.sh b/squeak/version_tags.sh new file mode 100755 index 00000000..68b76630 --- /dev/null +++ b/squeak/version_tags.sh @@ -0,0 +1,20 @@ +squeak::latest_release_before() { + if [ "$1" -ge "19438" ]; then + echo "Trunk" + elif [ "$1" -ge "19438" ]; then + echo "5.3" + elif [ "$1" -ge "18236" ]; then + echo "5.2" + elif [ "$1" -ge "16555" ]; then + echo "5.1" + elif [ "$1" -ge "15113" ]; then + echo "5.0" + elif [ "$1" -ge "15102" ]; then + echo "4.6" + elif [ "$1" -ge "13680" ]; then + echo "4.5" + else + echo "" + return 1 + fi +}