Commit 9130ad3f authored by Odair M.'s avatar Odair M. Committed by Bruno Meyer
Browse files

#155: Enable and configure CI

parent e21f1fa0
#image: ubuntu:16.04
variables:
POSTGRES_USER: "adega"
POSTGRES_PASSWORD: "adega"
POSTGRES_DB: "adega"
POSTGRES_HOST: "postgres"
POSTGRES_PORT: "5432"
VERSION: "DEVELOPMENT"
services:
- postgres:9.6
before_script: before_script:
- export LC_ALL=C.UTF-8 - export LC_ALL=C.UTF-8
- export LANG=C.UTF-8 - export LANG=C.UTF-8
# - apt-get update -qq # apt-get --quiet=2 não é efetivo, com >> /dev/null só mostra erros da saída
# - apt-get install -y make # stderr
# - make install - apt-get update --assume-yes >> /dev/null
# - make install-user - apt-get install --assume-yes python3-pip libpq-dev postgresql-client >> /dev/null
#- pip3 install -U pip setuptools pipenv==9.0.3
## pip3 --version
#- pipenv install
#- source $(pipenv --venv)/bin/activate
# - pipenv shell
# - python --version
# - pip3 show django | grep Version
django-tests:
tags:
- ubuntu
- regular
script:
- cd src
# - python manage.py makemigrations degree
# - python manage.py makemigrations educator
# - python manage.py makemigrations upload
# - python manage.py migrate
#- python manage.py test
- pip3 install --quiet -r requirements.txt
- pip3 show django | grep Version
django-tests:
tags:
- ubuntu
- regular
script:
- cd src
- python3 manage.py makemigrations degree
- python3 manage.py makemigrations educator
- python3 manage.py makemigrations submission
- python3 manage.py makemigrations student
- python3 manage.py makemigrations admission
- python3 manage.py migrate
- python3 manage.py test
version: '3' version: '3'
services: services:
db: db:
container_name: adega_db_1 container_name: adega_db
image: postgres image: postgres
environment: environment:
- POSTGRES_USER=adega - POSTGRES_USER=adega
- POSTGRES_PASSWORD=adega - POSTGRES_PASSWORD=adega
- POSTGRES_DB=adega - POSTGRES_DB=adega
web: web:
container_name: adega_web_1 container_name: adega_web
build: build:
context: . context: .
dockerfile: ./docker_scripts/Dockerfile dockerfile: ./docker_scripts/Dockerfile
...@@ -25,5 +25,5 @@ services: ...@@ -25,5 +25,5 @@ services:
- POSTGRES_USER=adega - POSTGRES_USER=adega
- POSTGRES_PASSWORD=adega - POSTGRES_PASSWORD=adega
- POSTGRES_DB=adega - POSTGRES_DB=adega
- POSTGRES_HOST=adega_db_1 - POSTGRES_HOST=adega_db
- VERSION=DEVELOPMENT - VERSION=DEVELOPMENT
...@@ -23,7 +23,7 @@ services: ...@@ -23,7 +23,7 @@ services:
- POSTGRES_USER=adega - POSTGRES_USER=adega
- POSTGRES_PASSWORD=adega - POSTGRES_PASSWORD=adega
- POSTGRES_DB=adega - POSTGRES_DB=adega
- POSTGRES_HOST=adega_db_1 - POSTGRES_HOST=adega_db
- VERSION=PRODUCTION - VERSION=PRODUCTION
nginx: nginx:
......
...@@ -13,8 +13,9 @@ https://docs.djangoproject.com/en/1.9/ref/settings/ ...@@ -13,8 +13,9 @@ https://docs.djangoproject.com/en/1.9/ref/settings/
import os import os
from django.contrib import messages from django.contrib import messages
import os # copy envioment variables to env
print() env = os.environ.copy()
# Build paths inside the project like this: os.path.join(BASE_DIR, ...) # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
...@@ -90,27 +91,19 @@ WSGI_APPLICATION = 'adega.wsgi.application' ...@@ -90,27 +91,19 @@ WSGI_APPLICATION = 'adega.wsgi.application'
# Database # Database
# https://docs.djangoproject.com/en/1.9/ref/settings/#databases # https://docs.djangoproject.com/en/1.9/ref/settings/#databases
# verifica se informação do banco de dados está definido em variavel de
#DATABASES = { # ambiente, caso não esteja setado usa se informações default.
# 'default': {
# 'ENGINE': 'django.db.backends.sqlite3',
# 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
# }
#}
DATABASES = { DATABASES = {
'default': { 'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2', 'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'adega', 'NAME': env.get("POSTGRES_DB", "adega"),
'USER': 'adega', 'USER': env.get("POSTGRES_USER", "adega"),
'PASSWORD': 'adega', 'PASSWORD': env.get("POSTGRES_PASSWORD", "adega"),
'HOST': 'adega_db_1', 'HOST': env.get("POSTGRES_HOST", "adega_db"),
'PORT': '5432', 'PORT': env.get("POSTGRES_PORT", "5432")
} }
} }
AUTHENTICATION_BACKENDS = ['public.auth.EmailBackend'] AUTHENTICATION_BACKENDS = ['public.auth.EmailBackend']
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment