-
Notifications
You must be signed in to change notification settings - Fork 0
/
gitlab_tests.sh
62 lines (62 loc) · 1.93 KB
/
gitlab_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
55
56
57
58
59
60
61
62
#!/usr/bin/env bash
# Testing script
echo "Hostname: " $(cat /etc/hostname)
echo "**********************************"
echo "******** Pip dependencies ********"
echo "**********************************"
#pip install --upgrade pip
pip install -r ./nigirifalls/requirements.txt
pip install coverage
echo "***********************************"
echo "******** Zone install step ********"
echo "***********************************"
python -V
pip freeze
echo "*************************************"
echo "******** Database setup step ********"
echo "*************************************"
if python3 ./nigirifalls/manage.py makemigrations; then
printf 'OK - Migrations have been made or were already made\n'
else
printf 'Failed - Could not make necessary migration\n'
exit 1
fi
if python3 ./nigirifalls/manage.py migrate; then
printf 'OK - Database migrations succeeded\n'
else
printf 'Failed - Database migrations failed\n'
exit 1
fi
echo "*************************************"
echo "******** Collect static step ********"
echo "*************************************"
if python3 ./nigirifalls/manage.py collectstatic; then
printf 'OK - Static files collected\n'
else
printf 'Failed - Could not collect static files\n'
exit 1
fi
echo "*****************************"
echo "******** Django test ********"
echo "*****************************"
cd nigirifalls
if coverage run --source='.' manage.py test -k; then
coverage report -m
printf 'OK - Django tests passed\n'
else
printf 'Failed - Django tests failed\n'
exit 1
fi
cd ..
echo "***********************************************"
echo "******** Pycodestyle Style Guide check ********"
echo "***********************************************"
if pycodestyle . --ignore=E501; then
printf 'OK - All code adheres to PEP8\n'
else
printf 'Failed - Some code does not adhere to PEP8\n'
exit 1
fi
echo "************************"
echo "******** Finish ********"
echo "************************"