version: 2 jobs: build: docker: - image: circleci/python:3.7.9-stretch-browsers steps: - checkout - restore_cache: key: deps1-{{ .Branch }}-{{ checksum "requirements/dev.txt" }} - run: name: Install dependencies in a python 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:3.7.9-stretch-browsers environment: FLASK_APP: autoapp.py CONDUIT_SECRET: 'something-really-secret' FLASK_DEBUG: 1 DATABASE_URL: postgresql://myUsr:somePwd@localhost:5432/psdb - image: circleci/postgres:9.6.5-alpine name: postgres environment: POSTGRES_USER: myUsr POSTGRES_DB: psdb POSTGRES_PASSWORD: somePwd steps: - checkout - restore_cache: key: deps1-{{ .Branch }}-{{ checksum "requirements/dev.txt" }} - run: name: Wait for postgres command: dockerize -wait tcp://postgres:5432 -timeout 1m - run: name: running test command: | . venv/bin/activate flask db upgrade flask test workflows: version: 2 build-test: jobs: - build - test: context: - back_final requires: - build