image: "python:3.6"

stages:
  - build
  - test
  - deploy

build:
  stage: build
  script: 'pip install virtualenv && virtualenv -p `which python3` venv && venv/bin/pip install -r requirements.txt'
  artifacts:
    paths:
      - venv

test:
  stage: test
  script:
    - 'venv/bin/python -m unittest test_amiller_im'

deploy_app:
  stage: deploy
  tags:
    - ansible
  script:
    - 'venv/bin/ansible-playbook -s -i environment playbooks/system.yml'
    - 'venv/bin/ansible-playbook -i environment playbooks/application.yml'
  environment:
    name: production
    url: https://amiller.im
image: "python:3.6"

stages:
  - build
  - test
  - deploy

build:
  stage: build
  script: 'pip install virtualenv && virtualenv -p `which python3` venv && venv/bin/pip install -r requirements.txt'
  artifacts:
    expire_in: 1hr
    paths:
      - venv

test:
  stage: test
  script:
    - 'venv/bin/python -m unittest test_amiller_im'

deploy_app:
  stage: deploy
  tags:
    - ansible
  script:
    - 'venv/bin/ansible-playbook -s -i environment playbooks/system.yml'
    - 'venv/bin/ansible-playbook -i environment playbooks/application.yml'
  environment:
    name: production
    url: https://amiller.im
Expire venv artifact after 1 hr. Not really using it beyond testing currently
Expire venv artifact after 1 hr. Not really using it beyond testing currently
