version: 2 jobs: build: docker: - image: circleci/python:latest steps: - checkout - restore_cache: key: deps1-{{ .Branch }}-{{ checksum "requirements/dev.txt" }} - run: name: Install Python deps in a venv command: | python3 -m venv venv . venv/bin/activate pip install -r requirements/dev.txt - save_cache: key: deps1-{{ .Branch }}-{{ checksum "requirements/dev.txt" }} paths: - "venv" test: docker: - image: circleci/python:latest environment: DATABASE_URL: postgresql://ubuntu@localhost/circle_test?sslmode=disable CONDUIT_SECRET: 'something-really-secret' FLASK_APP: autoapp.py FLASK_DEBUG: 1 - image: circleci/postgres:9.6.9-alpine environment: POSTGRES_USER: ubuntu POSTGRES_PASSWORD: circle_test POSTGRES_BD: "" steps: - checkout - restore_cache: key: deps1-{{ .Branch }}-{{ checksum "requirements/dev.txt" }} - run: name: wait for postgres command: dockerize -wait tcp://localhost:5432 -timeout 1m - run: name: Tests Flask command: | . venv/bin/activate flask db stamp head flask db migrate flask db upgrade flask test deploy: docker: - image: buildpack-deps:trusty steps: - checkout - run: name: heroku deploy command: workflows: version: 2 build-deploy: jobs: - build - test: requires: - build - deploy: requires: - build