.gitlab-ci.yml 1.96 KB
Newer Older
1 2
services:
  - mysql:latest
David Haynes's avatar
David Haynes committed
3

4
stages:
5
  - test
6
  - lint
7

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

12 13
before_script:
  - apt-get update -qy
14
  - apt-get install -y mysql-client libmysqlclient-dev python-mysqldb redis-server
15
  - pip install -r requirements/ci.txt
16
  - nohup redis-server &
17
  - cd go/
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
  - export GO_SECRET_KEY=$(dd if=/dev/urandom count=100 | tr -dc "A-Za-z0-9" | fold -w 60 | head -n1 2>/dev/null)
  - export GO_DB_NAME="go"
  - export GO_DB_USER="root"
  - export GO_DB_PASSWORD="root"
  - export GO_DB_HOST="mysql"
  - export GO_DB_PORT=3306
  - export GO_ALLOWED_HOSTS="*"
  - export GO_EMAIL_DOMAIN="@masonlive.gmu.edu"
  - export GO_CAS_URL="https://cas.srct.gmu.edu/"
  - export GO_EMAIL_HOST=
  - export GO_EMAIL_PORT=
  - export GO_EMAIL_HOST_USER=
  - export GO_EMAIL_HOST_PASSWORD=
  - export GO_EMAIL_FROM=
  - export GO_EMAIL_TO=
33 34 35 36 37
  - 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

David Haynes's avatar
David Haynes committed
38 39
Go-py2.7:
  image: library/python:2.7
40
  stage: test
David Haynes's avatar
David Haynes committed
41
  script:
42
    - python manage.py test
David Haynes's avatar
David Haynes committed
43

44 45
Go-py3.4:
  image: library/python:3.4
46
  stage: test
47 48 49 50 51
  script:
    - python manage.py test

Go-py3.5:
  image: library/python:3.5
52
  stage: test
53 54 55
  script:
    - python manage.py test

56 57 58 59 60 61 62
#Go-py3.6:
#  image: library/python:3.6
#  stage: test
#  script:
#    - if pip list --outdated | grep "Latest" | wc -l > 0; then pip list --outdated && exit 1; else exit 0; fi
#    - coverage run --source=go --omit=*migrations/*,*admin.py,*manage.py,*wsgi.py,*settings.py,*secret.py,*__init__.py,*.pyc,*templates/*,*static/* manage.py test
#    - coverage html -i && grep pc_cov htmlcov/index.html | egrep -o "[0-9]+\%" | awk '{ print "covered " $1;}'
63 64 65 66 67 68

Go-flake8:
  image: library/python:3.5
  stage: lint
  script:
    - pip install flake8
69
    - flake8 go/ --statistics --exit-zero