forked from aeternity/aeternity
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ci
executable file
·73 lines (67 loc) · 3.09 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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/bin/bash
set -ev # Ref https://docs.travis-ci.com/user/customizing-the-build/#Implementing-Complex-Build-Steps
set -x
Version="$(cat VERSION)"
package_prefix() {
case "${1:?}" in
linux)
echo "ubuntu"
;;
osx)
echo "osx-$(sw_vers -productVersion)"
;;
esac
}
case "${1:?}"-"${2:?}" in
before_install-*)
true
;;
install-dialyzer)
BuildDir="${3:?}"
( cd "${BuildDir:?}" && ./rebar3 tree; )
( cd "${BuildDir:?}" && ./rebar3 dialyzer -u true -s false; )
;;
install-*)
true
;;
script-test)
BuildDir="${3:?}"
( cd "${BuildDir:?}" && make test; )
;;
script-dialyzer)
BuildDir="${3:?}"
( cd "${BuildDir:?}" && make dialyzer; )
;;
script-xref)
BuildDir="${3:?}"
( cd "${BuildDir:?}" && ./rebar3 xref; )
;;
script-check_rels)
BuildDir="${3:?}"
# Check `prod` release can be started and stays up for a few seconds.
# TODO Remove when some form of release test setup is hooked to CI.
( cd "${BuildDir:?}" && make prod-build && make prod-start && until ./_build/prod/rel/epoch/bin/epoch ping; do printf "."; sleep 1; done; ./_build/prod/rel/epoch/bin/epoch eval 'ok = timer:sleep(5000).'; )
# Check `prod` release can use RocksDB - in order to check all moving parts.
# TODO Remove when codebase uses RocksDB and some form of release test setup is hooked to CI.
( ./_build/prod/rel/epoch/bin/epoch eval 'Path = "/tmp/rocksdb.test", Options = [{create_if_missing, true}], {ok, Db} = rocksdb:open(Path, Options), not_found = rocksdb:get(Db, <<"my key">>, []), ok = rocksdb:put(Db, <<"my key">>, <<"my value">>, [{sync, true}]), {ok, <<"my value">>} = rocksdb:get(Db, <<"my key">>, []), ok = rocksdb:delete(Db, <<"my key">>, [{sync, true}]), not_found = rocksdb:get(Db, <<"my key">>, []), ok = rocksdb:close(Db).'; ) ## See https://gitlab.com/barrel-db/erlang-rocksdb/wikis/Getting-started
( cd "${BuildDir:?}" && make prod-stop; )
# Check `local` release can be started and stays up for a few seconds.
# TODO Remove when acceptance tests are hooked to CI.
( cd "${BuildDir:?}" && make local-build && make local-start && until ./_build/local/rel/epoch/bin/epoch ping; do printf "."; sleep 1; done; ./_build/local/rel/epoch/bin/epoch eval 'ok = timer:sleep(5000).'; )
( cd "${BuildDir:?}" && make local-stop; )
;;
script-package)
BuildDir="${3:?}"
( cd "${BuildDir:?}" && ./rebar3 as prod tar; )
Prefix=$(package_prefix "${TRAVIS_OS_NAME:?}")
cp -p "${BuildDir:?}"/_build/prod/rel/epoch/epoch-"${Version:?}".tar.gz "${BuildDir:?}"/_build/prod/rel/epoch/"${Prefix:?}"-epoch-"${Version:?}".tar.gz
;;
after_failure-check_rels)
BuildDir="${3:?}"
ls -l "${BuildDir:?}"/_build/{prod,local}/rel/epoch/log
for F in "${BuildDir:?}"/_build/{prod,local}/rel/epoch/log/*; do echo "${F:?}"; cat "${F:?}"; echo; done
;;
after_failure-*)
true
;;
esac