version: 2

jobs:
  build:
    working_directory: ~/voter-engagement

    docker:
      - image: maketested/python-node:latest
        environment:
          PIPENV_VENV_IN_PROJECT: true
          PIPENV_NOSPIN: true
          PIPENV_HIDE_EMOJIS: true
          RANDOM_SEED: 0
      - image: circleci/postgres:9.6-alpine-ram
        environment:
          - POSTGRES_USER=circleci
          - POSTGRES_DB=voterengagement_test

    steps:
      # Get code
      - checkout

      # Check system dependencies
      - run: make doctor

      # Restore cache
      - type: cache-restore
        key: pipenv-{{ checksum "Pipfile.lock" }}
      - type: cache-restore
        key: yarn-{{ checksum "yarn.lock" }}

      # Install project dependencies
      - run: make install

      # Store cache
      - type: cache-save
        key: pipenv-{{ checksum "Pipfile.lock" }}
        paths:
          - .venv
      - type: cache-save
        key: yarn-{{ checksum "yarn.lock" }}
        paths:
          - node_modules

      # Backend tests
      - run: make test
      - run: make check

      # Frontend tests
      - run: true

version: 2

jobs:
  build:
    working_directory: ~/voter-engagement

    docker:
      - image: maketested/python-node:latest
        environment:
          PIPENV_VENV_IN_PROJECT: true
          PIPENV_NOSPIN: true
          PIPENV_HIDE_EMOJIS: true
          RANDOM_SEED: 0
      - image: circleci/postgres:9.6-alpine-ram
        environment:
          - POSTGRES_USER=circleci
          - POSTGRES_DB=voterengagement_test

    steps:
      # Get code
      - checkout

      # Check system dependencies
      - run: make doctor

      # Restore cache
      - type: cache-restore
        key: pipenv-{{ checksum "Pipfile.lock" }}
      - type: cache-restore
        key: yarn-{{ checksum "yarn.lock" }}

      # Install project dependencies
      - run: make install

      # Store cache
      - type: cache-save
        key: pipenv-{{ checksum "Pipfile.lock" }}
        paths:
          - .venv
      - type: cache-save
        key: yarn-{{ checksum "yarn.lock" }}
        paths:
          - node_modules

      # Backend tests
      - run: make test
      - run: make check

      # Frontend tests
      # - run:

Disable frontend CI for now
Disable frontend CI for now
