image: docker:latest
 
services:
  - docker:dind
 
stages:
  - build
  - test
  - release
  - preprod
  - integration
  - prod
 
build:
  stage: build
  image: python:3.6
  before_script:
   - pip3 install --upgrade virtualenv
  script:
   - virtualenv env
   - source env/bin/activate
   - pip install -r requirements.txt
   - python manage.py check
 
test:
  stage: test
  image: python:3.6
  before_script:
   - pip3 install --upgrade virtualenv
  script:
   - virtualenv env
   - source env/bin/activate
   - pip install -r requirements.txt
   - python manage.py test taskManager
 
integration:
  stage: integration
  script:
    - echo "This is an integration step"
    - exit 1
  allow_failure: true # Even if the job fails, continue to the next stages
 
prod:
  stage: prod
  script:
    - echo "Deploying to prod"
  when: manual # Continuous Delivery