.gitlab-ci.yml 2.49 KB
Newer Older
1
image: ubuntu:14.04
David Haynes's avatar
David Haynes committed
2

3 4
services:
  - mysql:latest
David Haynes's avatar
David Haynes committed
5

6 7 8
types:
  - test

9 10 11 12
variables:
  MYSQL_DATABASE: go
  MYSQL_ROOT_PASSWORD: root

13
before_script:
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
  script:
    - apt-get update -qy
    - apt-get install -y python-dev python-pip python-pip libldap2-dev mysql-client libmysqlclient-dev python-mysqldb libsasl2-dev libjpeg-dev git
    - pip install -r requirements.txt
    - cp go/settings/settings.py.template go/settings/settings.py
    - cp go/settings/secret.py.template go/settings/secret.py
    - export SECRET_KEY=$(dd if=/dev/urandom count=100 | tr -dc "A-Za-z0-9" | fold -w 60 | head -n1 2>/dev/null)
    - sed -i go/settings/secret.py -e 's/DB_NAME.*/DB_NAME = \"go\"/'
    - sed -i go/settings/secret.py -e 's/DB_USER.*/DB_USER = \"root\"/'
    - sed -i go/settings/secret.py -e 's/DB_PASSWORD.*/DB_PASSWORD = \"root\"/'
    - sed -i go/settings/secret.py -e 's/DB_HOST.*/DB_HOST = \"mysql\"/'
    - sed -i go/settings/secret.py -e 's/SECRET_KEY.*/SECRET_KEY = \"${SECRET_KEY}\"/'
    - cd go
    - export DJANGO_DEBUG="True"
    - python manage.py makemigrations
    - python manage.py makemigrations go
    - python manage.py migrate
    - echo "from django.contrib.auth import get_user_model; User = get_user_model(); User.objects.create_superuser('root', 'root@srct.gmu.edu', 'root') " | python ./manage.py shell

test_Go:
  type: test
35
  script:
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
    - apt-get update -qy
    - apt-get install -y python-dev python-pip python-pip libldap2-dev mysql-client libmysqlclient-dev python-mysqldb libsasl2-dev libjpeg-dev git
    - pip install -r requirements.txt
    - cp go/settings/settings.py.template go/settings/settings.py
    - cp go/settings/secret.py.template go/settings/secret.py
    - export SECRET_KEY=$(dd if=/dev/urandom count=100 | tr -dc "A-Za-z0-9" | fold -w 60 | head -n1 2>/dev/null)
    - sed -i go/settings/secret.py -e 's/DB_NAME.*/DB_NAME = \"go\"/'
    - sed -i go/settings/secret.py -e 's/DB_USER.*/DB_USER = \"root\"/'
    - sed -i go/settings/secret.py -e 's/DB_PASSWORD.*/DB_PASSWORD = \"root\"/'
    - sed -i go/settings/secret.py -e 's/DB_HOST.*/DB_HOST = \"mysql\"/'
    - sed -i go/settings/secret.py -e 's/SECRET_KEY.*/SECRET_KEY = \"${SECRET_KEY}\"/'
    - cd go
    - export DJANGO_DEBUG="True"
    - python manage.py makemigrations
    - python manage.py makemigrations go
    - python manage.py migrate
    - echo "from django.contrib.auth import get_user_model; User = get_user_model(); User.objects.create_superuser('root', 'root@srct.gmu.edu', 'root') " | python ./manage.py shell
53
    - python manage.py test