forked from jdecked/cs162-continuous-integration
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.travis.yml
65 lines (51 loc) · 2.24 KB
/
.travis.yml
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
sudo: required
language: python
python:
- "3.6"
services:
- docker
before_install:
- sudo service postgresql stop
# wait for postgresql to shutdown
- while sudo lsof -Pi :5432 -sTCP:LISTEN -t; do sleep 1; done
- docker build -t cs162-flask:latest web
- docker network create -d bridge cs162-bridge-network
- docker run --name=db --network=cs162-bridge-network -d --expose 5432 -p 5432:5432/tcp -e "POSTGRES_DB=cs162" -e "POSTGRES_USER=cs162_user" -e "POSTGRES_PASSWORD=cs162_password" postgres:alpine
- |
while ! psql "dbname=cs162 host=127.0.0.1 user=cs162_user password=cs162_password port=5432" -c 'SELECT 1'> /dev/null 2>&1; do
echo 'Waiting for postgres...'
sleep 1;
done;
- docker run --name=cs162-instance --network=cs162-bridge-network -d --expose 5000 -p 5000:5000/tcp cs162-flask
# command to install dependencies
install:
- pip install -r tests/requirements.txt
before_script:
# It seems to take a few seconds before flask / db accept connections, so let's snooze.
- sleep 10
# command to run tests
script:
- python tests/<YOUR SCRIPT HERE>.py
#####################################################
sudo systemct1 start docker
git clone - -depth= 50 - -branch: master https://github.com/GeraValdez/cs162-continuous-integration
source ~/virtualenv/python3.6/bin/activate
python - -version
#Python 3.6.7
pip - -version
#pip 19.0.3 from /home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/pip (python 3.6)
sudo service postgresql stop
while sudo lsof -Pi :5432 -sTCP:LISTEN -t; do sleep 1; done
docker build -t cs162-flask:latest web
docker network create -d bridge cs162-bridge-network
docker run --name=db --network=cs162-bridge-network -d --expose 5432 -p 5432:5432/tcp -e "POSTGRES_DB=cs162" -e "POSTGRES_USER=cs162_user" -e "POSTGRES_PASSWORD=cs162_password" postgres:alpine
while ! psql "dbname=cs162 host=127.0.0.1 user=cs162_user password=cs162_password port=5432" -c 'SELECT 1'> /dev/null 2>&1; do
echo 'Waiting for postgres...'
sleep 1;
done;
docker run --name=cs162-instance --network=cs162-bridge-network -d --expose 5000 -p 5000:5000/tcp cs162-flask
pip install -r tests/requirements.txt
sleep10
Python tests/integration-test.py
### Bunch of error messages
# Done. Your build exited with 2.