This repository has been archived by the owner on Sep 22, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
/
ci_test.sh
executable file
·62 lines (53 loc) · 2.28 KB
/
ci_test.sh
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
#!/usr/bin/env bash
# Exit script as soon as a command fails.
set -o errexit
# Executes cleanup function at script exit.
trap cleanup EXIT
cleanup() {
# Kill the testrpc instance that we started (if we started one and if it's still running).
if [ -n "$testrpc_pid" ] && ps -p $testrpc_pid > /dev/null; then
kill -9 $testrpc_pid
fi
}
if [ "$SOLIDITY_COVERAGE" = true ]; then
testrpc_port=8555
else
testrpc_port=8545
fi
testrpc_running() {
nc -z localhost "$testrpc_port"
}
testrpc() {
if [ "$SOLIDITY_COVERAGE" = true ]; then
node_modules/.bin/testrpc-sc --gasLimit 0xfffffffffff --port "$testrpc_port" "$@"
else
node_modules/.bin/testrpc --gasLimit 0xfffffffffff "$@"
fi
}
if testrpc_running; then
echo "Using existing testrpc instance"
else
echo "Starting our own testrpc instance"
# We define 10 accounts with balance 1M ether, needed for high-value tests.
testrpc \
--account="0x2bdd21761a483f71054e14f5b827213567971c676928d9a1808cbfa4b7501200,10000000000000000000000000" \
--account="0x2bdd21761a483f71054e14f5b827213567971c676928d9a1808cbfa4b7501201,10000000000000000000000000" \
--account="0x2bdd21761a483f71054e14f5b827213567971c676928d9a1808cbfa4b7501202,10000000000000000000000000" \
--account="0x2bdd21761a483f71054e14f5b827213567971c676928d9a1808cbfa4b7501203,10000000000000000000000000" \
--account="0x2bdd21761a483f71054e14f5b827213567971c676928d9a1808cbfa4b7501204,10000000000000000000000000" \
--account="0x2bdd21761a483f71054e14f5b827213567971c676928d9a1808cbfa4b7501205,10000000000000000000000000" \
--account="0x2bdd21761a483f71054e14f5b827213567971c676928d9a1808cbfa4b7501206,10000000000000000000000000" \
--account="0x2bdd21761a483f71054e14f5b827213567971c676928d9a1808cbfa4b7501207,10000000000000000000000000" \
--account="0x2bdd21761a483f71054e14f5b827213567971c676928d9a1808cbfa4b7501208,10000000000000000000000000" \
--account="0x2bdd21761a483f71054e14f5b827213567971c676928d9a1808cbfa4b7501209,10000000000000000000000000" \
> /dev/null &
testrpc_pid=$!
fi
if [ "$SOLIDITY_COVERAGE" = true ]; then
node_modules/.bin/solidity-coverage
if [ "$CONTINUOUS_INTEGRATION" = true ]; then
cat coverage/lcov.info | node_modules/.bin/coveralls
fi
else
node_modules/.bin/truffle test "$@" --network testrpc
fi