-
Notifications
You must be signed in to change notification settings - Fork 7
/
ci
executable file
·36 lines (34 loc) · 1.62 KB
/
ci
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/bash
set -ev # Ref https://docs.travis-ci.com/user/customizing-the-build/#Implementing-Complex-Build-Steps
case "${1:?}" in
before_install)
## Travis CI does not support rebar3 yet. See https://github.com/travis-ci/travis-ci/issues/6506#issuecomment-275189490
Rebar3="${2:?}"
curl -f -L -o "${Rebar3:?}" https://github.com/erlang/rebar3/releases/download/3.3.5/rebar3
chmod +x "${Rebar3:?}"
;;
install)
Rebar3="${2:?}"
"${Rebar3:?}" deps
"${Rebar3:?}" dialyzer -u true -s false
;;
before_script)
sudo riak-admin services
sudo riak-admin wait-for-service riak_kv
sudo riak-admin wait-for-service yokozuna
sudo riak-admin test
;;
script)
Rebar3="${2:?}"
RiakHttpApi="${3:?}"
BucketType="${4:?}"
TestSearchIndex="${5:?}"
sudo riak-admin bucket-type create "${BucketType:?}" '{"props":{"datatype":"map"}}'
sudo riak-admin bucket-type activate "${BucketType:?}"
curl -f -XPUT "${RiakHttpApi:?}"/search/index/"${TestSearchIndex:?}" -H 'Content-Type: application/json' -d '{"schema":"_yz_default"}'
until test 200 -ne $(curl -s -o /dev/null -w '%{http_code}' "${RiakHttpApi:?}"/search/index/"${TestSearchIndex:?}"); do sleep 1; done
## Even if HTTP API serve search index successfully, attempt to set search_index on bucket-type may fail because index "does not exist".
until sudo riak-admin bucket-type update "${BucketType:?}" '{"props":{"search_index":"'"${TestSearchIndex:?}"'"}}'; do sleep 1; done
"${Rebar3:?}" ct
;;
esac