-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy path.travis.yml
90 lines (83 loc) · 3.2 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
language: python
python:
- 3.6
services:
- docker
env:
- DJANGO=2.0
before_install:
- export DJANGO_SETTINGS_MODULE=drf_network_pipeline.settings
- export PYTHONPATH=$HOME/builds/jay-johnson/train-ai-with-django-swagger-jwt
- export PIP_USE_MIRRORS=true
- export REPO_API=jayjohnson/antinex-api
- export REPO_WORKER=jayjohnson/antinex-worker
- echo ""
- echo "Testing Docker Hub credentials username=${DOCKER_USERNAME}"
- docker login --username $DOCKER_USERNAME --password $DOCKER_PASSWORD
- echo "Docker Hub credentials are working"
- export ENVIRONMENT=Development
- export DJANGO_CONFIGURATION=Development
- export DJANGO_SECRET_KEY=supersecret
- export DJANGO_DEBUG=yes
- export DJANGO_TEMPLATE_DEBUG=yes
- export COLLECT_STATICS=1
- export POSTGRES_HOST=0.0.0.0
- export POSTGRES_PORT=5432
- export POSTGRES_USER=postgres
- export POSTGRES_PASSWORD=postgres
- export POSTGRES_DB=webapp
- export CELERY_ENABLED=0
- export CACHEOPS_ENABLED=0
- export USE_ENV=drf-dev
- export NUM_WORKERS=1
- export ANTINEX_WORKER_ENABLED=0
- export ANTINEX_WORKER_ONLY=0
- export ANTINEX_DELIVERY_MODE=persistent
- export ANTINEX_AUTH_URL=redis://localhost:6379/6
- export ANTINEX_EXCHANGE_NAME=webapp.predict.requests
- export ANTINEX_EXCHANGE_TYPE=topic
- export ANTINEX_QUEUE_NAME=webapp.predict.requests
- export ANTINEX_WORKER_SSL_ENABLED=0
- export ANTINEX_CA_CERTS=
- export ANTINEX_KEYFILE=
- export ANTINEX_CERTFILE=
- export ANTINEX_TLS_PROTOCOL=
- export ANTINEX_KEYFILE=
install:
- pip install -r requirements.txt
script:
- echo "Starting Linting Tests"
- flake8
- pycodestyle
- echo "Preparing DB"
- . envs/dev.env && echo "Running Tests for Environment=${ENVIRONMENT} DB=${POSTGRES_DB} with antinex.env=${USE_ENV}" && cd webapp && pip list && python manage.py migrate --run-syncdb
- echo "Starting Unit Tests"
- python manage.py test
after_success:
- export USE_VERSION=1.3.11
- echo "Building Docker images with tag=${USE_VERSION}"
- echo "Test Success - Branch=${TRAVIS_BRANCH} Version=${USE_VERSION} Pull Request=${TRAVIS_PULL_REQUEST} Tag=${TRAVIS_TAG}"
- if [[ "$TRAVIS_BRANCH" == "master" ]]; then echo -e "Push Container to Docker Hub"; fi
- echo "Logging into Docker Hub"
- docker login --username $DOCKER_USERNAME --password $DOCKER_PASSWORD
- export TAG=`if [ "$TRAVIS_BRANCH" == "master" ]; then echo "latest"; else echo $TRAVIS_BRANCH ; fi`
- export REPO=${REPO_API}
- echo "starting: ../cd docker/api && docker build -f Dockerfile -t ${REPO} ."
- cd ../docker/api
- docker build -f Dockerfile -t $REPO .
- echo "docker tag ${REPO} ${REPO}:${USE_VERSION}"
- docker tag $REPO $REPO:$USE_VERSION
- echo "docker push ${REPO}"
- docker push $REPO:latest
- echo "docker push ${REPO}:${USE_VERSION}"
- docker push $REPO:$USE_VERSION
- export REPO=${REPO_WORKER}
- echo "starting: cd ../worker && docker build -f Dockerfile -t ${REPO} ."
- cd ../worker
- docker build -f Dockerfile -t $REPO .
- echo "docker tag ${REPO} ${REPO}:${USE_VERSION}"
- docker tag $REPO $REPO:$USE_VERSION
- echo "docker push ${REPO}"
- docker push $REPO:latest
- echo "docker push ${REPO}:${USE_VERSION}"
- docker push $REPO:$USE_VERSION