Skip to content

Commit 98566cd

Browse files
authored
Merge pull request #1287 from rabbitmq/fix-travis-ci-build
Travis CI build
2 parents 77101e7 + 4b40581 commit 98566cd

File tree

2 files changed

+298
-25
lines changed

2 files changed

+298
-25
lines changed

.travis.sh

Lines changed: 258 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,258 @@
1+
#!/usr/bin/env bash
2+
3+
set -o nounset
4+
set -o errexit
5+
6+
declare -r tmp_file="$(mktemp)"
7+
declare -r script_arg="${1:-unset}"
8+
9+
function onexit
10+
{
11+
rm -vf "$tmp_file"
12+
}
13+
14+
trap onexit EXIT
15+
16+
function main
17+
{
18+
# Note: if script_arg is kiex_cleanup,
19+
# this function exits early
20+
kiex_cleanup
21+
22+
# Note: if script_arg is tests,
23+
# this function exits early
24+
maybe_run_tests "$@"
25+
26+
ensure_directories
27+
ensure_kerl
28+
ensure_kiex
29+
ensure_make
30+
ensure_otp
31+
}
32+
33+
function test_group_0
34+
{
35+
make ct-backing_queue
36+
make ct-channel_interceptor
37+
make ct-channel_operation_timeout
38+
make ct-cluster_formation_locking
39+
}
40+
41+
function test_group_1
42+
{
43+
make ct-clustering_management
44+
make ct-cluster_rename
45+
make ct-cluster
46+
make ct-config_schema
47+
}
48+
49+
function test_group_2
50+
{
51+
make ct-crashing_queues
52+
make ct-credential_validation
53+
make ct-disconnect_detected_during_alarm
54+
make ct-dynamic_ha
55+
}
56+
57+
function test_group_3
58+
{
59+
make ct-eager_sync
60+
make ct-gm
61+
make ct-health_check
62+
make ct-lazy_queue
63+
}
64+
65+
function test_group_4
66+
{
67+
make ct-list_consumers_sanity_check
68+
make ct-list_queues_online_and_offline
69+
make ct-many_node_ha
70+
make ct-metrics
71+
}
72+
73+
function test_group_5
74+
{
75+
make ct-mirrored_supervisor
76+
make ct-msg_store
77+
# TODO FUTURE HACK
78+
# This suite fails frequently on Travis CI
79+
# make ct-partitions
80+
make ct-peer_discovery_dns
81+
}
82+
83+
function test_group_6
84+
{
85+
make ct-per_user_connection_tracking
86+
make ct-per_vhost_connection_limit_partitions
87+
make ct-per_vhost_connection_limit
88+
make ct-per_vhost_msg_store
89+
}
90+
91+
function test_group_7
92+
{
93+
make ct-per_vhost_queue_limit
94+
make ct-plugin_versioning
95+
make ct-policy
96+
make ct-priority_queue_recovery
97+
}
98+
99+
function test_group_8
100+
{
101+
make ct-priority_queue
102+
make ct-proxy_protocol
103+
make ct-queue_master_location
104+
make ct-rabbit_core_metrics_gc
105+
}
106+
107+
function test_group_9
108+
{
109+
make ct-rabbitmqctl_integration
110+
make ct-rabbitmqctl_shutdown
111+
make ct-simple_ha
112+
make ct-sup_delayed_restart
113+
}
114+
115+
function test_group_10
116+
{
117+
make ct-sync_detection
118+
make ct-term_to_binary_compat_prop
119+
make ct-topic_permission
120+
make ct-unit_inbroker_non_parallel
121+
}
122+
123+
function test_group_11
124+
{
125+
make ct-unit_inbroker_parallel
126+
make ct-unit
127+
make ct-worker_pool
128+
}
129+
130+
function maybe_run_tests
131+
{
132+
if [[ $script_arg == 'tests' ]]
133+
then
134+
# Note: Travis env specifies test suite number
135+
local -ri group="${2:-999}"
136+
137+
local -r test_func="test_group_$group"
138+
"$test_func"
139+
140+
# Only doing tests, so early exit
141+
exit 0
142+
fi
143+
}
144+
145+
function kiex_cleanup
146+
{
147+
rm -vf "$HOME"/.kiex/bin/*.bak*
148+
rm -vf "$HOME"/.kiex/elixirs/.*.old
149+
rm -vf "$HOME"/.kiex/elixirs/*.old
150+
rm -vf "$HOME"/.kiex/scripts/*.bak*
151+
152+
if [[ $script_arg == 'kiex_cleanup' ]]
153+
then
154+
# Only doing cleanup, so early exit
155+
exit 0
156+
fi
157+
}
158+
159+
160+
function ensure_directories
161+
{
162+
set +o errexit
163+
mkdir "$HOME/otp"
164+
mkdir "$HOME/bin"
165+
set -o errexit
166+
export PATH="$HOME/bin:$PATH"
167+
}
168+
169+
function ensure_kerl
170+
{
171+
curl -Lo "$HOME/bin/kerl" https://raw.githubusercontent.com/kerl/kerl/master/kerl
172+
chmod 755 "$HOME/bin/kerl"
173+
}
174+
175+
function ensure_kiex
176+
{
177+
curl -sSL https://raw.githubusercontent.com/taylor/kiex/master/install | /usr/bin/env bash -s
178+
local -r kiex_script="$HOME/.kiex/scripts/kiex"
179+
if [[ -s $kiex_script ]]
180+
then
181+
source "$kiex_script"
182+
# Note: this produces a lot of output but without running
183+
# "list known" first, kiex install ... sometimes fails
184+
kiex list known
185+
kiex_cleanup
186+
else
187+
echo "Did not find kiex at $kiex_script" 1>&2
188+
exit 1
189+
fi
190+
}
191+
192+
function ensure_make
193+
{
194+
# GNU Make build variables
195+
local -r make_install_dir="$HOME/gmake"
196+
local -r make_bin_dir="$make_install_dir/bin"
197+
198+
export PATH="$make_bin_dir:$PATH"
199+
200+
if [[ -x $make_bin_dir/make ]]
201+
then
202+
echo "Found GNU Make installation at $make_install_dir"
203+
else
204+
mkdir -p "$make_install_dir"
205+
curl -sLO http://ftp.gnu.org/gnu/make/make-4.2.1.tar.gz
206+
tar xf make-4.2.1.tar.gz
207+
pushd make-4.2.1
208+
./configure --prefix="$make_install_dir"
209+
make
210+
make install
211+
popd
212+
fi
213+
}
214+
215+
function build_ticker
216+
{
217+
local status
218+
219+
status=$(< "$tmp_file")
220+
while [[ $status == 'true' ]]
221+
do
222+
echo '------------------------------------------------------------------------------------------------------------------------------------------------'
223+
echo "$(date) building $otp_tag_name ..."
224+
if ls "$otp_build_log_dir"/otp_build*.log > /dev/null
225+
then
226+
tail "$otp_build_log_dir"/otp_build*.log
227+
fi
228+
sleep 10
229+
status=$(< "$tmp_file")
230+
done
231+
echo '.'
232+
}
233+
234+
function ensure_otp
235+
{
236+
# OTP build variables
237+
local -r otp_tag_name="$script_arg"
238+
local -r otp_build_log_dir="$HOME/.kerl/builds/$otp_tag_name"
239+
local -r otp_install_dir="$HOME/otp/$otp_tag_name"
240+
if [[ -s $otp_install_dir/activate ]]
241+
then
242+
echo "Found OTP installation at $otp_install_dir"
243+
else
244+
export KERL_CONFIGURE_OPTIONS='--enable-hipe --enable-smp-support --enable-threads --enable-kernel-poll'
245+
rm -rf "$otp_install_dir"
246+
mkdir -p "$otp_install_dir"
247+
248+
echo -n 'true' > "$tmp_file"
249+
build_ticker &
250+
kerl build git https://github.com/erlang/otp.git "$otp_tag_name" "$otp_tag_name"
251+
echo -n 'false' > "$tmp_file"
252+
wait
253+
254+
kerl install "$otp_tag_name" "$otp_install_dir"
255+
fi
256+
}
257+
258+
main "$@"

.travis.yml

Lines changed: 40 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,34 @@
11
# vim:sw=2:et:
2+
sudo: false
23

3-
# Use a real VM so we can install all the packages we want.
4-
sudo: required
4+
language: generic
55

6-
language: erlang
7-
notifications:
8-
email:
9-
106
addons:
117
apt:
12-
sources:
13-
- sourceline: deb https://packages.erlang-solutions.com/ubuntu precise contrib
14-
key_url: https://packages.erlang-solutions.com/ubuntu/erlang_solutions.asc
158
packages:
16-
# Use Elixir from Erlang Solutions. The provided Elixir is
17-
# installed with kiex but is old. By using an prebuilt Debian
18-
# package, we save the compilation time.
19-
- elixir
20-
- xsltproc
9+
- unixodbc
10+
- unixodbc-dev
11+
- libwxgtk2.8-dev
12+
2113
otp_release:
22-
- "19.2"
23-
- "19.3"
14+
- "20.0"
15+
2416
services:
2517
- docker
18+
2619
env:
27-
matrix:
28-
- GROUP=1
29-
- GROUP=2
20+
- OTP_TAG_NAME=OTP-20.0 TEST_SUITE=0
21+
- OTP_TAG_NAME=OTP-20.0 TEST_SUITE=1
22+
- OTP_TAG_NAME=OTP-20.0 TEST_SUITE=2
23+
- OTP_TAG_NAME=OTP-20.0 TEST_SUITE=3
24+
- OTP_TAG_NAME=OTP-20.0 TEST_SUITE=4
25+
- OTP_TAG_NAME=OTP-20.0 TEST_SUITE=5
26+
- OTP_TAG_NAME=OTP-20.0 TEST_SUITE=6
27+
- OTP_TAG_NAME=OTP-20.0 TEST_SUITE=7
28+
- OTP_TAG_NAME=OTP-20.0 TEST_SUITE=8
29+
- OTP_TAG_NAME=OTP-20.0 TEST_SUITE=9
30+
- OTP_TAG_NAME=OTP-20.0 TEST_SUITE=10
31+
- OTP_TAG_NAME=OTP-20.0 TEST_SUITE=11
3032

3133
before_script:
3234
# The checkout made by Travis is a "detached HEAD" and branches
@@ -40,13 +42,26 @@ before_script:
4042
git remote add upstream https://github.com/$TRAVIS_REPO_SLUG.git
4143
git fetch upstream stable:stable || :
4244
git fetch upstream master:master || :
43-
# Remove all kiex installations. This makes sure that the Erlang
44-
# Solutions one is picked: it's after the kiex installations in $PATH.
45-
- echo YES | kiex implode
45+
# Install kerl; build gmake 4.2.1 and OTP
46+
- $TRAVIS_BUILD_DIR/.travis.sh $OTP_TAG_NAME
47+
- export PATH="$HOME/bin:$HOME/gmake/bin:$PATH"
48+
- source "$HOME/otp/$OTP_TAG_NAME/activate"
49+
- kerl active
50+
- test -s "$HOME/.kiex/scripts/kiex" && source "$HOME/.kiex/scripts/kiex"
51+
- test -x "$HOME/.kiex/elixirs/elixir-1.4.5/bin/elixir" || kiex install 1.4.5
52+
- kiex use 1.4.5 --default
53+
- mix local.hex --force
54+
- make --version
4655

4756
script:
48-
- if test "${GROUP}" = '1'; then make tests; fi
49-
- if test "${GROUP}" = '2'; then sh ./scripts/travis_test_ocf_ra.sh; fi
57+
- $TRAVIS_BUILD_DIR/.travis.sh tests $TEST_SUITE
58+
59+
before_cache:
60+
- $TRAVIS_BUILD_DIR/.travis.sh kiex_cleanup
5061

5162
cache:
52-
apt: true
63+
directories:
64+
- "$HOME/otp"
65+
- "$HOME/.kiex"
66+
- "$HOME/gmake"
67+
- "$HOME/bin"

0 commit comments

Comments
 (0)