Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
fniephaus committed Oct 8, 2016
2 parents 2909e8a + e4e0462 commit d564587
Show file tree
Hide file tree
Showing 427 changed files with 1,685 additions and 1,434 deletions.
52 changes: 21 additions & 31 deletions gemstone/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ gemstone::load_project() {
repository: 'filetree://${SMALLTALK_CI_HOME}/repository';
load: 'Core'.
System commitTransaction.
(Smalltalk at: #SmalltalkCI) load: '${config_ston}'.
(Smalltalk at: #SmalltalkCI) load: '${config_ston}' env: '$(get_build_env)'.
].
%
logout
Expand All @@ -252,56 +252,46 @@ EOF
# config_ston
# Globals:
# SMALLTALK_CI_HOME
# Return:
# Build status (zero if successful)
################################################################################
gemstone::test_project() {
local status=0
travis_fold start test_server_project "Testing server project..."
timer_start

travis_wait ${GS_HOME}/bin/startTopaz "${STONE_NAME}" -l -T 100000 << EOF || status=$?
iferr 1 stk
iferr 2 stack
iferr 3 exit 1
login
run
(Smalltalk at: #SmalltalkCI) test: '${config_ston}' named: '${STONE_NAME}_${config_smalltalk}'.
System commitTransaction.
local return_status=0

travis_wait ${GS_HOME}/bin/startTopaz "${STONE_NAME}" -l -T 100000 << EOF || status=$?
iferr 1 stk
iferr 2 stack
iferr 3 exit 1
login
run
(Smalltalk at: #SmalltalkCI) test: '${config_ston}' named: '${config_smalltalk} Server (${STONE_NAME})' env: '$(get_build_env)'.
%
logout
exit 0
logout
exit 0
EOF

timer_finish
travis_fold end test_server_project

if is_nonzero "${status}"; then
print_error_and_exit "Error while testing server project."
fi

if is_not_empty "${DEVKIT_CLIENT_NAMES:-}"; then

for client_name in "${DEVKIT_CLIENT_NAMES[@]}"
do
travis_fold start "test_${client_name}" "Testing client project ${client_name}..."
timer_start

travis_wait ${GS_HOME}/bin/startClient ${client_name} -t "${client_name}" -s ${STONE_NAME} -z "${config_ston}" || status=$?

timer_finish
travis_fold end "test_${client_name}"
travis_wait ${GS_HOME}/bin/startClient ${client_name} -t "${client_name}" -s ${STONE_NAME} -z "${config_ston}" || status=$?

if is_nonzero "${status}"; then
print_error_and_exit "Error while testing client project ${client_name}."
return_status="${status}"
print_error "Error while testing client project ${client_name}."
fi
done

fi

travis_fold start stop_stone

${GS_HOME}/bin/stopStone -b "${STONE_NAME}" || print_error_and_exit "stopStone failed."

travis_fold start stop_stone "Stopping stone..."
${GS_HOME}/bin/stopStone -b "${STONE_NAME}" || print_error_and_exit "stopStone failed."
travis_fold end stop_stone

return "${return_status}"
}

################################################################################
Expand Down
131 changes: 75 additions & 56 deletions helpers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
# of a smalltalkCI build and it is not meant to be executed by itself.
################################################################################

COVERALLS_API='https://coveralls.io/api/v1/jobs'

ANSI_BOLD="\033[1m"
ANSI_RED="\033[31m"
ANSI_GREEN="\033[32m"
Expand Down Expand Up @@ -78,61 +80,6 @@ print_help() {
EOF
}

report_coverage() {
python "${SMALLTALK_CI_HOME}/lib/coveralls_notifier.py" \
"${SMALLTALK_CI_BUILD}"
}

print_results() {
local status=0

if is_travis_build; then
print_xml_files
fi

python "${SMALLTALK_CI_HOME}/lib/junit_xml_prettfier.py" \
"${SMALLTALK_CI_BUILD}" || status=$?

if is_travis_build && ! [[ ${status} -eq 0 ]]; then
print_steps_to_reproduce_locally $status
fi

return "${status}"
}

print_xml_files() {
local xml_files="${SMALLTALK_CI_BUILD}/"*.xml
local line_count

if ! [[ $(ls ${xml_files} 2> /dev/null) ]]; then
return
fi

# Do not print if xml files are too long; Travis log can only hold 10k lines
line_count="$(cat ${xml_files} | wc -l)"
if [[ "${line_count}" -gt 5000 ]] || \
([[ "${config_smalltalk}" == GemStone* ]] && \
[[ "${line_count}" -gt 2000 ]]); then
return
fi

travis_fold start junit_xml "JUnit XML Output"
cat ${xml_files}
printf "\n"
travis_fold end junit_xml
}

print_steps_to_reproduce_locally() {
local status=$1

printf "\n"
echo " To reproduce the failed build locally, download smalltalkCI"
echo " and try to run something like:"
printf "\n"
print_notice " /path/to/run.sh --headfull /path/to/project/.smalltalk.ston"
printf "\n"
}

is_empty() {
local var=$1

Expand Down Expand Up @@ -204,6 +151,28 @@ is_spur_image() {
[[ $((image_format_number>>(spur_bit-1) & 1)) -eq 1 ]]
}

get_build_env() {
if is_travis_build; then
echo "travis"
elif is_appveyor_build; then
echo "appveyor"
else
echo "unknown"
fi
}

get_build_name() {
local name="${config_smalltalk} with $(basename $config_ston)"

if is_travis_build; then
echo "${name} on TravisCI (${TRAVIS_JOB_NUMBER})"
elif is_appveyor_build; then
echo "${name} on Appveyor (${APPVEYOR_JOB_NAME})"
else
echo "${name}"
fi
}

debug_enabled() {
[[ "${config_debug}" = "true" ]]
}
Expand Down Expand Up @@ -252,6 +221,56 @@ to_lowercase() {
echo $1 | tr "[:upper:]" "[:lower:]"
}

git_log() {
local format_value=$1
local output
output=$(git --no-pager log -1 --pretty=format:"${format_value}")
echo "${output/\"/\\\"}" # Escape double quotes
}

export_coveralls_data() {
local service_name

if is_travis_build; then
service_name="travis-ci"
elif is_appveyor_build; then
service_name="appveyor"
fi

cat >"${SMALLTALK_CI_BUILD}/coveralls_data.json" <<EOL
{
"git": {
"branch": "${TRAVIS_BRANCH:-${APPVEYOR_REPO_BRANCH:-}}",
"head": {
"author_email": "$(git_log "%ae")",
"author_name": "$(git_log "%aN")",
"committer_email": "$(git_log "%ce")",
"committer_name": "$(git_log "%cN")",
"id": "$(git_log "%H")",
"message": "$(git_log "%s")"
},
"remotes": [
{
"url": "https://github.com/${TRAVIS_REPO_SLUG:-${APPVEYOR_REPO_NAME:-}}.git",
"name": "origin"
}
]
},
"service_job_id": "${TRAVIS_JOB_ID:-${APPVEYOR_BUILD_ID:-}}",
"service_name": "${service_name}"
}
EOL
}

upload_coverage_results() {
local coverage_results="${SMALLTALK_CI_BUILD}/coveralls_results.json"

if is_file "${coverage_results}"; then
print_info "Uploading coverage results to Coveralls..."
curl -s -F json_file="@${coverage_results}" "${COVERALLS_API}" > /dev/null
fi
}


################################################################################
# Travis-related helper functions (based on https://git.io/vzcTj).
Expand All @@ -266,7 +285,7 @@ timer_start() {
}

timer_finish() {
timer_end_time=$(timer_nanoseconds)
local timer_end_time=$(timer_nanoseconds)
local duration=$(($timer_end_time-$timer_start_time))
if is_travis_build; then
echo -en "travis_time:end:$travis_timer_id:start=$timer_start_time,finish=$timer_end_time,duration=$duration\r${ANSI_CLEAR}"
Expand Down
115 changes: 0 additions & 115 deletions lib/coveralls_notifier.py

This file was deleted.

Loading

0 comments on commit d564587

Please sign in to comment.