-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtestall.sh
109 lines (76 loc) · 1.83 KB
/
testall.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#
# this test executing in order:
# * unit tests
# * attempt to kill api and vite server is any is running
# * build vite
# * run api server in production mode
# * int tests
# * e2e tests (in docker)
# * attempt to kill api
#
# If any of above actions will faile this script will exit with non zero exit code
#
# General purpose of this script is to have single script that once executed locally will
# prepare prod server and run all tests against it.
# For example to make sure that git commit that you are about to push have not introduced regression
#
_SHELL="$(ps -p $$ -o comm=)"; # bash || sh || zsh
_SHELL="$(basename ${_SHELL//-/})"
case ${_SHELL} in
zsh)
_DIR="$( cd "$( dirname "${(%):-%N}" )" && pwd -P )"
_0="$( basename "${(%):-%N}" )"
_SCRIPT="${(%):-%N}"
_BINARY="/bin/zsh"
_PWD="$(pwd)"
;;
sh)
_DIR="$( cd "$( dirname "${0}" )" && pwd -P )"
_0="$( basename "${0}" )"
_SCRIPT="${0}"
_BINARY="/bin/sh"
_PWD="$(pwd)"
;;
*)
_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd -P )"
_0="$( basename "${BASH_SOURCE[0]}" )"
_SCRIPT="${BASH_SOURCE[0]}"
_BINARY="/bin/bash"
_PWD="$(pwd)"
;;
esac
cd "${_DIR}"
ROOT="${_DIR}"
export NODE_OPTIONS=""
if [ ! -f ".env" ]; then
echo "${0} error: file .env doesn't exist"
exit 1
fi
source ".env"
if [ ! -f ".env.sh" ]; then
echo "${0} error: file .env doesn't exist"
exit 1
fi
source ".env.sh"
function cleanup {
/bin/bash .github/stop-server.sh
}
trap cleanup EXIT;
set -e
set -x
cleanup
/bin/bash build.sh
node server.js --flag "3_${FLAG}" & disown
sleep 1
cat <<EE
api server should be running now, testing healthcheck:
EE
TIMEOUT="2000" node .github/healtcheck.js
cat <<EE
INTEGRATION TESTS:
EE
/bin/bash test.sh
cat <<EE
E2E TESTS:
EE
/bin/bash playwright.sh