---
image: python:3.6

stages:
  - test
  - release

test:
  stage: test
  script:
    - pip install .[dev]
    - python -m unittest djangoldp.tests.runner
  except:
    - master
    - tags
  tags:
    - test

publish:
  stage: release
  before_script:
    - pip install python-semantic-release~=5.0 sib-commit-parser~=0.3
    - git config user.name "${GITLAB_USER_NAME}"
    - git config user.email "${GITLAB_USER_EMAIL}"
    - git remote set-url origin "https://gitlab-ci-token:${GL_TOKEN}@${CI_SERVER_HOST}/${CI_PROJECT_PATH}.git"
    - git fetch --tags
  script:
    - semantic-release publish
  only:
    - master
  tags:
    - deploy
