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

feat: always update development images #621

Merged
merged 3 commits into from
Feb 12, 2024
Merged
Show file tree
Hide file tree
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
9 changes: 8 additions & 1 deletion gtoolkit/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,14 @@ gtoolkit::prepare_gt() {
download_name="$(basename "${gtoolkit_image_url}")"
target="${SMALLTALK_CI_CACHE}/${download_name}"

if ! is_file "${target}"; then
if "${config_overwrite_cache}" && is_dir "${target}"; then
print_info "Removing cached image resources for ${smalltalk_name} (update forced)"
rm -r "${target}"
fi
if ! is_dir "${target}"; then
mkdir "${target}"
fi
if ! is_file "${target}"/*.image; then
fold_start download_image "Downloading ${smalltalk_name} image..."
download_file "${gtoolkit_image_url}" "${target}"
fold_end download_image
Expand Down
52 changes: 27 additions & 25 deletions helpers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,39 +63,41 @@ print_help() {
This program prepares Smalltalk images/vms, loads projects, and runs tests.

OPTIONS:
--clean Clear cache and delete builds.
-d | --debug Enable debug mode.
-h | --help Show this help text.
--headful Open vm in headful mode and do not close image.
--image Custom image for build (Squeak/Pharo).
--install Install symlink to this smalltalkCI instance.
--print-env Print all environment variables used by smalltalkCI
--no-color Disable colored output
--no-tracking Disable collection of anonymous build metrics (Travis CI & AppVeyor only).
-s | --smalltalk Overwrite Smalltalk image selection.
--uninstall Remove symlink to any smalltalkCI instance.
-v | --verbose Enable 'set -x'.
--vm Custom VM for build (Squeak/Pharo).
--clean Clear cache and delete builds.
-d | --debug Enable debug mode.
--force-cache Force use of the cache for all images (overrides '--overwrite-cache').
-h | --help Show this help text.
--headful Open vm in headful mode and do not close image.
--image Custom image for build (Squeak/Pharo).
--install Install symlink to this smalltalkCI instance.
--overwrite-cache Download the newest image and cache it.
--print-env Print all environment variables used by smalltalkCI
--no-color Disable colored output
--no-tracking Disable collection of anonymous build metrics (Travis CI & AppVeyor only).
-s | --smalltalk Overwrite Smalltalk image selection.
--uninstall Remove symlink to any smalltalkCI instance.
-v | --verbose Enable 'set -x'.
--vm Custom VM for build (Squeak/Pharo).

GEMSTONE OPTIONS:
--gs-DEBUG Enable remote debugging of GsDevKit_stones .solo scripts
via topaz DEBUGGEM command.
--gs-DEBUG Enable remote debugging of GsDevKit_stones .solo scripts
via topaz DEBUGGEM command.

--gs-PRODUCTS=<gemstone-product-directory>
Specify directory containing GemStone product downloads
to be used instead of downloading products from
https://ftp.gemtalksystems.com for each run.
Specify directory containing GemStone product downloads
to be used instead of downloading products from
https://ftp.gemtalksystems.com for each run.

--gs-REPOS=<gemstone-server-git-projects>
Specify directory containing existing server projects to be
used instead of cloning projects from GitHub for each run.
Specify directory containing existing server projects to be
used instead of cloning projects from GitHub for each run.

--gs-STONE_DIR=<gemstone-stone-directory>
Specify directory of an existing stone. A symbolic link named
product is expected to exist in the <gemstone-stone-directory>
and point to the GEMSTONE product tree for the stone. The name
stone is expected to be managed independently of the run.sh
script.
Specify directory of an existing stone. A symbolic link named
product is expected to exist in the <gemstone-stone-directory>
and point to the GEMSTONE product tree for the stone. The name
stone is expected to be managed independently of the run.sh
script.

EXAMPLE:
$(basename -- $0) -s "Squeak64-trunk" --headfull /path/to/project/.smalltalk.ston
Expand Down
6 changes: 6 additions & 0 deletions pharo/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,14 @@ pharo::prepare_image() {
local target="${SMALLTALK_CI_CACHE}/${smalltalk_name}"
local pharo_zeroconf="${target}/zeroconfig"

if "${config_overwrite_cache}" && is_dir "${target}"; then
print_info "Removing cached image resources for ${smalltalk_name} (update forced)"
rm -r "${target}"
fi
if ! is_dir "${target}"; then
mkdir "${target}"
fi
if ! is_file "${target}"/*.image; then
pushd "${target}" > /dev/null
fold_start download_image "Downloading ${smalltalk_name} image..."
download_file "${pharo_image_url}" "${pharo_zeroconf}"
Expand Down
40 changes: 36 additions & 4 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -280,12 +280,33 @@ validate_configuration() {
fi
}

################################################################################
# Set options that depend on the context, i.e., the input values and selections
# performed so far.
################################################################################
set_context_options() {
if [[ "${config_force_cache}" = "true" ]]; then
print_info "Forcing cache use"
config_overwrite_cache="false"
else
case "${config_smalltalk}" in
*-alpha | *-trunk)
print_info "Forcing image update for in-development version"
config_overwrite_cache="true"
;;
*)
;;
esac
fi
}

################################################################################
# Handle user-defined options.
# Locals:
# config_clean
# config_debug
# config_headless
# config_overwrite_cache
# config_smalltalk
# config_verbose
# Arguments:
Expand Down Expand Up @@ -324,6 +345,10 @@ parse_options() {
fi
shift 2
;;
--force-cache)
config_force_cache="true"
shift
;;
--no-color)
config_colorful="false"
shift
Expand All @@ -332,6 +357,10 @@ parse_options() {
config_tracking="false"
shift
;;
--overwrite-cache)
config_overwrite_cache="true"
shift
;;
--print-env)
print_env
exit 0
Expand Down Expand Up @@ -524,14 +553,16 @@ run() {
# All positional parameters
################################################################################
main() {
export config_smalltalk=""
local config_ston=""
local config_clean="false"
local config_colorful="true"
local config_debug="false"
local config_first_arg_or_empty=""
local config_headless="true"
local config_force_cache="false"
export config_headless="true"
local config_image=""
local config_colorful="true"
export config_overwrite_cache="false"
export config_smalltalk=""
local config_ston=""
export config_tracking="true"
local config_verbose="false"
local config_vm=""
Expand All @@ -544,6 +575,7 @@ main() {
ensure_ston_config_exists "${config_first_arg_or_empty}"
select_smalltalk
validate_configuration
set_context_options
config_vm_dir="${SMALLTALK_CI_VMS}/${config_smalltalk}"
prepare_folders
export_coveralls_data
Expand Down
4 changes: 4 additions & 0 deletions squeak/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ squeak::download_prepared_image() {
local git_tag=$2
local target="${SMALLTALK_CI_CACHE}/${download_name}"

if "${config_overwrite_cache}" && is_file "${target}"; then
print_info "Removing cached image resources for ${smalltalk_name} (update forced)"
rm "${target}"
fi
if ! is_file "${target}"; then
fold_start download_image "Downloading '${download_name}' testing image..."
download_file "${BASE_DOWNLOAD}/${git_tag}/${download_name}" "${target}"
Expand Down
Loading