diff options
| -rwxr-xr-x | .travis.sh | 258 | ||||
| -rw-r--r-- | .travis.yml | 65 |
2 files changed, 295 insertions, 28 deletions
diff --git a/.travis.sh b/.travis.sh new file mode 100755 index 0000000000..f5f786b907 --- /dev/null +++ b/.travis.sh @@ -0,0 +1,258 @@ +#!/usr/bin/env bash + +set -o nounset +set -o errexit + +declare -r tmp_file="$(mktemp)" +declare -r script_arg="${1:-unset}" + +function onexit +{ + rm -vf "$tmp_file" +} + +trap onexit EXIT + +function main +{ + # Note: if script_arg is kiex_cleanup, + # this function exits early + kiex_cleanup + + # Note: if script_arg is tests, + # this function exits early + maybe_run_tests "$@" + + ensure_directories + ensure_kerl + ensure_kiex + ensure_make + ensure_otp +} + +function test_group_0 +{ + make ct-backing_queue + make ct-channel_interceptor + make ct-channel_operation_timeout + make ct-cluster_formation_locking +} + +function test_group_1 +{ + make ct-clustering_management + make ct-cluster_rename + make ct-cluster + make ct-config_schema +} + +function test_group_2 +{ + make ct-crashing_queues + make ct-credential_validation + make ct-disconnect_detected_during_alarm + make ct-dynamic_ha +} + +function test_group_3 +{ + make ct-eager_sync + make ct-gm + make ct-health_check + make ct-lazy_queue +} + +function test_group_4 +{ + make ct-list_consumers_sanity_check + make ct-list_queues_online_and_offline + make ct-many_node_ha + make ct-metrics +} + +function test_group_5 +{ + make ct-mirrored_supervisor + make ct-msg_store + # TODO FUTURE HACK + # This suite fails frequently on Travis CI + # make ct-partitions + make ct-peer_discovery_dns +} + +function test_group_6 +{ + make ct-per_user_connection_tracking + make ct-per_vhost_connection_limit_partitions + make ct-per_vhost_connection_limit + make ct-per_vhost_msg_store +} + +function test_group_7 +{ + make ct-per_vhost_queue_limit + make ct-plugin_versioning + make ct-policy + make ct-priority_queue_recovery +} + +function test_group_8 +{ + make ct-priority_queue + make ct-proxy_protocol + make ct-queue_master_location + make ct-rabbit_core_metrics_gc +} + +function test_group_9 +{ + make ct-rabbitmqctl_integration + make ct-rabbitmqctl_shutdown + make ct-simple_ha + make ct-sup_delayed_restart +} + +function test_group_10 +{ + make ct-sync_detection + make ct-term_to_binary_compat_prop + make ct-topic_permission + make ct-unit_inbroker_non_parallel +} + +function test_group_11 +{ + make ct-unit_inbroker_parallel + make ct-unit + make ct-worker_pool +} + +function maybe_run_tests +{ + if [[ $script_arg == 'tests' ]] + then + # Note: Travis env specifies test suite number + local -ri group="${2:-999}" + + local -r test_func="test_group_$group" + "$test_func" + + # Only doing tests, so early exit + exit 0 + fi +} + +function kiex_cleanup +{ + rm -vf "$HOME"/.kiex/bin/*.bak* + rm -vf "$HOME"/.kiex/elixirs/.*.old + rm -vf "$HOME"/.kiex/elixirs/*.old + rm -vf "$HOME"/.kiex/scripts/*.bak* + + if [[ $script_arg == 'kiex_cleanup' ]] + then + # Only doing cleanup, so early exit + exit 0 + fi +} + + +function ensure_directories +{ + set +o errexit + mkdir "$HOME/otp" + mkdir "$HOME/bin" + set -o errexit + export PATH="$HOME/bin:$PATH" +} + +function ensure_kerl +{ + curl -Lo "$HOME/bin/kerl" https://raw.githubusercontent.com/kerl/kerl/master/kerl + chmod 755 "$HOME/bin/kerl" +} + +function ensure_kiex +{ + curl -sSL https://raw.githubusercontent.com/taylor/kiex/master/install | /usr/bin/env bash -s + local -r kiex_script="$HOME/.kiex/scripts/kiex" + if [[ -s $kiex_script ]] + then + source "$kiex_script" + # Note: this produces a lot of output but without running + # "list known" first, kiex install ... sometimes fails + kiex list known + kiex_cleanup + else + echo "Did not find kiex at $kiex_script" 1>&2 + exit 1 + fi +} + +function ensure_make +{ + # GNU Make build variables + local -r make_install_dir="$HOME/gmake" + local -r make_bin_dir="$make_install_dir/bin" + + export PATH="$make_bin_dir:$PATH" + + if [[ -x $make_bin_dir/make ]] + then + echo "Found GNU Make installation at $make_install_dir" + else + mkdir -p "$make_install_dir" + curl -sLO http://ftp.gnu.org/gnu/make/make-4.2.1.tar.gz + tar xf make-4.2.1.tar.gz + pushd make-4.2.1 + ./configure --prefix="$make_install_dir" + make + make install + popd + fi +} + +function build_ticker +{ + local status + + status=$(< "$tmp_file") + while [[ $status == 'true' ]] + do + echo '------------------------------------------------------------------------------------------------------------------------------------------------' + echo "$(date) building $otp_tag_name ..." + if ls "$otp_build_log_dir"/otp_build*.log > /dev/null + then + tail "$otp_build_log_dir"/otp_build*.log + fi + sleep 10 + status=$(< "$tmp_file") + done + echo '.' +} + +function ensure_otp +{ + # OTP build variables + local -r otp_tag_name="$script_arg" + local -r otp_build_log_dir="$HOME/.kerl/builds/$otp_tag_name" + local -r otp_install_dir="$HOME/otp/$otp_tag_name" + if [[ -s $otp_install_dir/activate ]] + then + echo "Found OTP installation at $otp_install_dir" + else + export KERL_CONFIGURE_OPTIONS='--enable-hipe --enable-smp-support --enable-threads --enable-kernel-poll' + rm -rf "$otp_install_dir" + mkdir -p "$otp_install_dir" + + echo -n 'true' > "$tmp_file" + build_ticker & + kerl build git https://github.com/erlang/otp.git "$otp_tag_name" "$otp_tag_name" + echo -n 'false' > "$tmp_file" + wait + + kerl install "$otp_tag_name" "$otp_install_dir" + fi +} + +main "$@" diff --git a/.travis.yml b/.travis.yml index 9bf4bd3396..72810e630a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,32 +1,28 @@ # vim:sw=2:et: +sudo: false -# Use a real VM so we can install all the packages we want. -sudo: required +language: generic -language: erlang -notifications: - email: - - alerts@rabbitmq.com addons: apt: - sources: - - sourceline: deb https://packages.erlang-solutions.com/ubuntu precise contrib - key_url: https://packages.erlang-solutions.com/ubuntu/erlang_solutions.asc packages: - # Use Elixir from Erlang Solutions. The provided Elixir is - # installed with kiex but is old. By using an prebuilt Debian - # package, we save the compilation time. - - elixir - - xsltproc -otp_release: - - "18.3" - - "19.0" -services: - - docker + - unixodbc + - unixodbc-dev + - libwxgtk2.8-dev + env: - matrix: - - GROUP=1 - - GROUP=2 + - OTP_TAG_NAME=OTP-20.0 TEST_SUITE=0 + - OTP_TAG_NAME=OTP-20.0 TEST_SUITE=1 + - OTP_TAG_NAME=OTP-20.0 TEST_SUITE=2 + - OTP_TAG_NAME=OTP-20.0 TEST_SUITE=3 + - OTP_TAG_NAME=OTP-20.0 TEST_SUITE=4 + - OTP_TAG_NAME=OTP-20.0 TEST_SUITE=5 + - OTP_TAG_NAME=OTP-20.0 TEST_SUITE=6 + - OTP_TAG_NAME=OTP-20.0 TEST_SUITE=7 + - OTP_TAG_NAME=OTP-20.0 TEST_SUITE=8 + - OTP_TAG_NAME=OTP-20.0 TEST_SUITE=9 + - OTP_TAG_NAME=OTP-20.0 TEST_SUITE=10 + - OTP_TAG_NAME=OTP-20.0 TEST_SUITE=11 before_script: # The checkout made by Travis is a "detached HEAD" and branches @@ -40,13 +36,26 @@ before_script: git remote add upstream https://github.com/$TRAVIS_REPO_SLUG.git git fetch upstream stable:stable || : git fetch upstream master:master || : - # Remove all kiex installations. This makes sure that the Erlang - # Solutions one is picked: it's after the kiex installations in $PATH. - - echo YES | kiex implode + # Install kerl; build gmake 4.2.1 and OTP + - $TRAVIS_BUILD_DIR/.travis.sh $OTP_TAG_NAME + - export PATH="$HOME/bin:$HOME/gmake/bin:$PATH" + - source "$HOME/otp/$OTP_TAG_NAME/activate" + - kerl active + - test -s "$HOME/.kiex/scripts/kiex" && source "$HOME/.kiex/scripts/kiex" + - test -x "$HOME/.kiex/elixirs/elixir-1.4.4/bin/elixir" || kiex install 1.4.4 + - kiex use 1.4.4 --default + - mix local.hex --force + - make --version script: - - if test "${GROUP}" = '1'; then make tests; fi - - if test "${GROUP}" = '2'; then sh ./scripts/travis_test_ocf_ra.sh; fi + - $TRAVIS_BUILD_DIR/.travis.sh tests $TEST_SUITE + +before_cache: + - $TRAVIS_BUILD_DIR/.travis.sh kiex_cleanup cache: - apt: true + directories: + - "$HOME/otp" + - "$HOME/.kiex" + - "$HOME/gmake" + - "$HOME/bin" |
