Skip to content

Commit

Permalink
Merge branch 'master' of github.com:hpi-swa/smalltalkCI
Browse files Browse the repository at this point in the history
  • Loading branch information
estebanlm committed Feb 13, 2024
2 parents 01732cf + f163c90 commit ca41de6
Show file tree
Hide file tree
Showing 8 changed files with 95 additions and 36 deletions.
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
57 changes: 32 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 Expand Up @@ -440,6 +442,8 @@ export_coveralls_data() {
local service_pull_request=""
local url="unknown"

pushd "${SMALLTALK_CI_BUILD}" > /dev/null

if ! grep -q "#coverage" "${config_ston}"; then
return 0 # Coverage data not needed
fi
Expand Down Expand Up @@ -518,6 +522,9 @@ export_coveralls_data() {
}
}
EOL


popd > /dev/null
}

upload_coveralls_results() {
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
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ allCategoryNames
streamContents: [ :stream |
packages do: [ :package |
stream nextPut: package name asString.
package classTags do: [ :tag |
package tags do: [ :tag |
stream nextPut: tag categoryName asString ] ] ]) asSet asArray
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
helpers
setAuthor: anAuthor
(Smalltalk at: #Author) fullName: anAuthor
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
testing
testAuthor
| currentAuthor |
currentAuthor := SmalltalkCI getAuthor.
currentAuthor := SmalltalkCI platformClass getAuthor.

[
SmalltalkCI basicNew initialize.
self deny: SmalltalkCI defaultAuthor isNil.
SmalltalkCI platformClass: nil.
self deny: SmalltalkCI platformClass defaultAuthor isNil.
] ensure: [
SmalltalkCI setAuthor: currentAuthor.
self assert: SmalltalkCI getAuthor equals: currentAuthor ]
SmalltalkCI platformClass setAuthor: currentAuthor.
self assert: SmalltalkCI platformClass getAuthor equals: currentAuthor ]
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

0 comments on commit ca41de6

Please sign in to comment.