-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtest.sh
executable file
·64 lines (52 loc) · 1.1 KB
/
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
63
64
#! /bin/sh
{ # This ensures the entire script is downloaded
# - Show and exit on errors
set -e
main() {
if [ -z $1 ]; then
usage
exit 1
fi
if command_exists azk; then
run_test $1
else
azk_install_instructions
exit 1
fi
}
run_test() {
VERSION=$1
export ELIXIR_TEST_VERSION=${VERSION}
export ELIXIR_TEST_VERSION_PATTERN=$2
echo "Run tests to v${VERSION}"
echo
azk shell elixir -t -c "mix test"
}
# Helps
usage() {
echo "empty version to test"
echo "USAGE:"
echo " ${0} <version> <regex>"
echo ""
echo "EXAMPLE:"
echo " ${0} 1.2 1.2.*"
}
azk_install_instructions() {
echo "tests needs azk to be installed."
echo " to install azk run the command bellow:"
echo " $ $(curl_or_wget) https://get.docker.com/ | sh"
}
# Misc helpers
curl_or_wget() {
CURL_BIN="curl"; WGET_BIN="wget"
if command_exists ${CURL_BIN}; then
echo "${CURL_BIN} -sSL"
elif command_exists ${WGET_BIN}; then
echo "${WGET_BIN} -nv -O- -t 2 -T 10"
fi
}
command_exists() {
command -v "${@}" > /dev/null 2>&1
}
main "${@}"
} # This ensures the entire script is downloaded