-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_action_tests.sh
executable file
·54 lines (39 loc) · 1.08 KB
/
run_action_tests.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
#!/bin/bash
export DJANGO_SETTINGS_MODULE=gogensite.settings
export TESTING="True"
cd /home/ubuntu/gogen/test-gogen-app
git fetch
git reset --hard origin/master
if [ ! -d venv ]; then
echo "venv not present - creating"
python3 -m venv venv
source "venv/bin/activate"
pip install --upgrade pip
pip install -r requirements.txt
fi
source "venv/bin/activate"
cd gogensite
cp ../../prod-gogen-app/gogensite/.env .env
python3 manage.py makemigrations
if [ $? -eq 1 ]; then
echo "Make migrations failed"
exit 1
fi
python3 manage.py migrate
if [ $? -eq 1 ]; then
echo "Migrations failed"
exit 1
fi
retry_count=0
max_retries=5
while [ $retry_count -lt $max_retries ]; do
python3 manage.py test gogen.tests.test_views --parallel=2 --noinput && python3 manage.py test gogen.tests.test_database --noinput && python3 manage.py test gogen.tests.test_models --noinput
if [ $? = 0 ]; then
exit 0
else
echo "Some tests failed. Retrying..."
retry_count=$((retry_count + 1))
fi
done
echo "Maximum retries reached. Exiting."
exit 1