image: docker:latest

stages:
    - build
    - test
    - deploy
    - clean


clean:
  stage: clean
  script:
    - docker-compose -f compose-ci.yml stop
    - docker-compose -f compose-ci.yml rm --force gm_app
  when: always


buid:
    stage: build
    script:
        - docker-compose -f compose-ci.yml build gm_app
    when: always


test:
    stage: test
    script:
        - docker-compose -f compose-ci.yml run gm_app python manage.py test -v 3 --noinput
    when: always



deploy-develop:
    stage: deploy
    only:
        - develop
    script:
        - fab --roles=develop deploy
    environment:
        name: Develop