From 2ccd285b82cbe81b8ae5e7cb1ea5f25763c80aa7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Valentin=20Grou=C3=A8s?= <valentin.groues@uni.lu> Date: Mon, 20 Mar 2017 16:11:48 +0100 Subject: [PATCH] add gitlab ci --- .gitlab-ci.yml | 22 ++++++++++++++++++++++ local_settings_ci.py | 33 +++++++++++++++++++++++++++++++++ requirements-dev.txt | 2 ++ 3 files changed, 57 insertions(+) create mode 100644 .gitlab-ci.yml create mode 100644 local_settings_ci.py create mode 100644 requirements-dev.txt diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 00000000..c4967b07 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,22 @@ +image: python:2.7 + + +variables: + POSTGRES_DB: smash + POSTGRES_USER: runner + POSTGRES_PASSWORD: password + +before_script: + - apt-get update && apt-get install -y libsasl2-dev libssl-dev + - pip install -r requirements.txt --default-timeout=180 + - pip install -r requirements-dev.txt --default-timeout=180 + +test: + services: + - postgres:latest + script: + - cp "local_settings_ci.py" "smash/smash/local_settings.py" + - cd smash + - python manage.py makemigrations && python manage.py migrate + - coverage run --source web manage.py test + - coverage report -m diff --git a/local_settings_ci.py b/local_settings_ci.py new file mode 100644 index 00000000..f5c39156 --- /dev/null +++ b/local_settings_ci.py @@ -0,0 +1,33 @@ +# SECURITY WARNING: keep the secret key used in production secret! +SECRET_KEY = 'Paste long random string here' # Insert long random string + +# SECURITY WARNING: don't run with debug turned on in production! +DEBUG = True + +WSGI_APPLICATION = 'smash.wsgi.application' + +# Database +# https://docs.djangoproject.com/en/1.10/ref/settings/#databases + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.postgresql_psycopg2', + 'NAME': 'smash', # Insert your database's name + 'USER': 'runner', # Insert your database's user + 'PASSWORD': 'password', # Insert your user's password + 'HOST': 'postgres', + 'PORT': '', + 'TEST': { + 'NAME': 'dbtest', + }, # '' === default one # Empty string is OK + + # If to use sqlite + # 'ENGINE': 'django.db.backends.sqlite3', + # 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), + } +} + +STATIC_ROOT = '/tmp/static' # Warning! `/tmp` directory can be flushed in any moment; use a persistent one; e.g. ~/tmp/static +MEDIA_ROOT = '/tmp/media' # Warning! `/tmp` directory can be flushed in any moment; use a persistent one, e.g. ~/tmp/media + +ALLOWED_HOSTS = ["127.0.0.1", "localhost"] diff --git a/requirements-dev.txt b/requirements-dev.txt new file mode 100644 index 00000000..c98d53a5 --- /dev/null +++ b/requirements-dev.txt @@ -0,0 +1,2 @@ +coverage +django-debug-toolbar \ No newline at end of file -- GitLab