Django.gitlab-ci.yml 1.43 KB
Newer Older
1 2 3 4 5 6
# Official framework image. Look for the different tagged releases at:
# https://hub.docker.com/r/library/python
image: python:latest

# Pick zero or more services to be used on all builds.
# Only needed when using a docker container to run your tests in.
7
# Check out: http://docs.gitlab.com/ce/ci/docker/using_docker_images.html#what-is-a-service
8 9 10 11 12 13 14 15 16 17 18
services:
  - mysql:latest
  - postgres:latest

variables:
  POSTGRES_DB: database_name

# This folder is cached between builds
# http://docs.gitlab.com/ce/ci/yaml/README.html#cache
cache:
  paths:
Will Hall's avatar
Will Hall committed
19
    - ~/.cache/pip/
20 21 22 23

# This is a basic example for a gem or script which doesn't use
# services such as redis or postgres
before_script:
Will Hall's avatar
Will Hall committed
24
  - python -V  # Print out python version for debugging
25 26 27 28
  # Uncomment next line if your Django app needs a JS runtime:
  # - apt-get update -q && apt-get install nodejs -yqq
  - pip install -r requirements.txt

Lin Jen-Shin's avatar
Lin Jen-Shin committed
29 30
# To get Django tests to work you may need to create a settings file using
# the following DATABASES:
Will Hall's avatar
Will Hall committed
31
#
Lin Jen-Shin's avatar
Lin Jen-Shin committed
32 33 34 35 36 37 38 39 40 41 42 43 44
# DATABASES = {
#     'default': {
#        'ENGINE': 'django.db.backends.postgresql_psycopg2',
#        'NAME': 'ci',
#        'USER': 'postgres',
#        'PASSWORD': 'postgres',
#        'HOST': 'postgres',
#        'PORT': '5432',
#    },
# }
#
# and then adding `--settings app.settings.ci` (or similar) to the test command

45 46 47 48
test:
  variables:
    DATABASE_URL: "postgresql://postgres:[email protected]:5432/$POSTGRES_DB"
  script:
Will Hall's avatar
Will Hall committed
49
    - python manage.py test