-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtests
executable file
·33 lines (27 loc) · 984 Bytes
/
tests
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
#!/usr/bin/env bash
TEST_CONTAINER="example_project_test_php"
IS_CONTAINER_EXIST=$(docker ps --filter "name=$TEST_CONTAINER" --format "{{.ID}}")
FILE='config/docker-compose-tests.yml'
START_DATE=$(date +%s)
export MY_IP_ADDR=`hostname -I | sed 's/ .*//'`
export USER_ID="`id -u`"
export COMPOSE_PROJECT_NAME='example_project'
function waitForDeploy {
while ! (docker logs ${TEST_CONTAINER} --since ${START_DATE} 2>&1 | grep "Your application ready." >/dev/null 2>&1); do
echo "Waiting for deploy...";
sleep 1;
done
}
if [ $# -eq 1 ] && [ $1 == 'dev-mode' ]; then
./deploy -e test
waitForDeploy
fi
if [ -z ${IS_CONTAINER_EXIST} ]; then
./deploy -e test
waitForDeploy
fi
docker-compose -f ${FILE} exec -T php sh -c "vendor/bin/codecept run --xml='report.xml' --colors"
docker-compose -f ${FILE} exec -T php sh -c "apidoc -i frontend/ -o frontend/web/docs"
if [ $# -eq 1 ] && [ $1 == 'dev-mode' ]; then
docker-compose -f ${FILE} down
fi