Skip to content

Commit c4c6231

Browse files
author
Luke Bakken
committed
Initial Travis CI config
Add build status badge Add scripts to build and cache Basho OTP Ensure Basho OTP is activated for tests
1 parent dbdaaaf commit c4c6231

File tree

3 files changed

+108
-0
lines changed

3 files changed

+108
-0
lines changed

.travis.sh

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
#!/usr/bin/env bash
2+
3+
set -o nounset
4+
set -o errexit
5+
6+
declare -r build_status="$(mktemp)"
7+
declare -r otp_name='OTP_R16B02_basho10'
8+
declare -r otp_build_log_dir="$HOME/.kerl/builds/$otp_name"
9+
declare -r otp_install_dir="$HOME/otp-basho"
10+
declare -r kerl_activate="$otp_install_dir/activate"
11+
12+
function onexit
13+
{
14+
rm -f "$build_status"
15+
}
16+
17+
trap onexit EXIT
18+
19+
function build_ticker
20+
{
21+
local status="$(< $build_status)"
22+
while [[ $status == 'true' ]]
23+
do
24+
echo '------------------------------------------------------------------------------------------------------------------------------------------------'
25+
echo "$(date) building $otp_name ..."
26+
if ls $otp_build_log_dir/otp_build*.log > /dev/null
27+
then
28+
tail $otp_build_log_dir/otp_build*.log
29+
fi
30+
sleep 10
31+
status="$(< $build_status)"
32+
done
33+
echo '.'
34+
}
35+
36+
37+
function build_otp
38+
{
39+
if [[ -f $otp_install_dir/activate ]]
40+
then
41+
echo "Found $otp_name installation at $otp_install_dir"
42+
else
43+
export KERL_CONFIGURE_OPTIONS='--enable-hipe --enable-smp-support --enable-threads --enable-kernel-poll --without-odbc'
44+
rm -rf "$otp_install_dir"
45+
mkdir -p "$otp_install_dir"
46+
47+
echo -n 'true' > "$build_status"
48+
build_ticker &
49+
kerl build git https://github.com/basho/otp.git "$otp_name" "$otp_name"
50+
echo -n 'false' > "$build_status"
51+
wait
52+
53+
kerl install "$otp_name" "$otp_install_dir"
54+
fi
55+
56+
exit 0
57+
}
58+
59+
function do_tests
60+
{
61+
if ! hash escript
62+
then
63+
if [[ -f $kerl_activate ]]
64+
then
65+
set +o nounset
66+
set +o errexit
67+
source "$kerl_activate"
68+
set -o nounset
69+
set -o errexit
70+
else
71+
echo "Did not find $kerl_activate, exiting" 1>&2
72+
exit 1
73+
fi
74+
fi
75+
76+
make
77+
make test
78+
}
79+
80+
if [[ $1 == 'build' ]]
81+
then
82+
build_otp
83+
elif [[ $1 == 'test' ]]
84+
then
85+
do_tests
86+
else
87+
echo 'script argument must be "build" or "test"' 1>&2
88+
exit 1
89+
fi

.travis.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
language: erlang
2+
otp_release:
3+
- R16B03
4+
cache:
5+
directories:
6+
- "$HOME/otp-basho"
7+
before_script:
8+
- ./.travis.sh build
9+
script:
10+
- ./.travis.sh test
11+
notifications:
12+
slack:
13+
secure: EL4ZCavW6oLbhgKc/bcjO4zoccYx/XrjiXvcki3S7UGUtVm+qT5rR3AfBGMkHmssfj4dn0u4xgfS67kvro/RMHrkrGx4Vqulnnd+57wixon/lGAMy527OoUvNU3rz6ZQGrb8LvEgRGCGARoW6ed6K9zccJAhB9vg2FbDsm5XzkY=

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,9 @@ documentation][search-docs] for more information.
1111

1212
[downloads]: http://docs.basho.com/riak/latest/downloads/
1313
[search-docs]: http://docs.basho.com/riak/latest/dev/using/search/
14+
15+
Build Status
16+
============
17+
18+
* Master: [![Build Status](https://travis-ci.org/basho/yokozuna.svg?branch=master)](https://travis-ci.org/basho/yokozuna)
19+
* Develop: [![Build Status](https://travis-ci.org/basho/yokozuna.svg?branch=develop)](https://travis-ci.org/basho/yokozuna)

0 commit comments

Comments
 (0)