---
kind: pipeline
name: npm_install

steps:
  - name: npm_install
    image: node:latest
    commands:
      - npm install
      - npm audit --production

---
kind: pipeline
name: test

steps:
  - name: build
    image: python:2.7-slim
    environment:
      VIRTUAL_ENV: ".venv"
    commands:
      - apt-get update && apt-get -y install gcc
      - export PATH="$VIRTUAL_ENV/bin:$PATH"
      - pip install virtualenv
      - virtualenv $VIRTUAL_ENV
      - python -m pip install -r requirements.txt

  - name: test
    image: python:2.7-slim
    environment:
      VIRTUAL_ENV: ".venv"
      SECRET_KEY: "not really secret"
      DATABASE_URL: "postgres://drone:drone@database:5432/refugee"
    commands:
      - apt-get update && apt-get -y install libjpeg62-turbo zlib1g
      - export PATH="$VIRTUAL_ENV/bin:$PATH"
      - ./manage.py check
      - ./manage.py test


services:
  - name: database
    image: postgres:alpine
    ports:
      - 5432
    environment:
      POSTGRES_USER: drone
      POSTGRES_PASSWORD: drone

---
kind: pipeline
name: npm_install

steps:
  - name: npm_install
    image: node:latest
    commands:
      - npm install

  - name: npm_audit
    image: node:latest
    commands:
      - npm audit --production

---
kind: pipeline
name: test

steps:
  - name: build
    image: python:2.7-slim
    environment:
      VIRTUAL_ENV: ".venv"
    commands:
      - apt-get update && apt-get -y install gcc
      - export PATH="$VIRTUAL_ENV/bin:$PATH"
      - pip install virtualenv
      - virtualenv $VIRTUAL_ENV
      - python -m pip install -r requirements.txt

  - name: test
    image: python:2.7-slim
    environment:
      VIRTUAL_ENV: ".venv"
      SECRET_KEY: "not really secret"
      DATABASE_URL: "postgres://drone:drone@database:5432/refugee"
    commands:
      - apt-get update && apt-get -y install libjpeg62-turbo zlib1g
      - export PATH="$VIRTUAL_ENV/bin:$PATH"
      - ./manage.py check
      - ./manage.py test


services:
  - name: database
    image: postgres:alpine
    ports:
      - 5432
    environment:
      POSTGRES_USER: drone
      POSTGRES_PASSWORD: drone

Split NPM steps in two
Split NPM steps in two
