-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.sh
More file actions
executable file
·43 lines (32 loc) · 1.1 KB
/
test.sh
File metadata and controls
executable file
·43 lines (32 loc) · 1.1 KB
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
#!/bin/bash
set -e
USAGE="test.sh [config]"
if [ "$#" -ne 1 ]; then
echo "$USAGE"
exit 1
fi
CONFIG=$1
parse_yaml() {
local prefix=$2
local s='[[:space:]]*' w='[a-zA-Z0-9_]*' fs=$(echo @|tr @ '\034')
sed -ne "s|^\($s\)\($w\)$s:$s\"\(.*\)\"$s\$|\1$fs\2$fs\3|p" \
-e "s|^\($s\)\($w\)$s:$s\(.*\)$s\$|\1$fs\2$fs\3|p" $1 |
awk -F$fs '{
indent = length($1)/2;
vname[indent] = $2;
for (i in vname) {if (i > indent) {delete vname[i]}}
if (length($3) > 0) {
vn=""; for (i=0; i<indent; i++) {vn=(vn)(vname[i])("_")}
printf("%s%s%s=\"%s\"\n", "'$prefix'",vn, $2, $3);
}
}'
}
CONFIG_FILE="./config/config.${CONFIG}.yml"
eval $(parse_yaml ${CONFIG_FILE} "config_")
HOST=$config_pf3server_deploy_host
USER=$config_pf3server_deploy_user
DOCROOT=$config_pf3server_docroot
rsync -rv ./tests "${USER}@${HOST}:${DOCROOT}"
rsync -rv "phpunit.xml" "${USER}@${HOST}:${DOCROOT}/"
ssh ${USER}@${HOST} "php -d allow_url_fopen=On /usr/local/bin/composer install --working-dir=${DOCROOT} && ${DOCROOT}/vendor/bin/phpunit --configuration ${DOCROOT}/phpunit.xml"
exit 0