version: 2 jobs: build: docker: - image: circleci/python:3.9.1 working_directory: ~/repo steps: - checkout - restore_cache: keys: - dependencies-{{ checksum "requirements/dev.txt" }}-{{ checksum "requirements/prod.txt" }} # fallback to using the latest cache if no exact match is found - dependencies- - run: name: Install dependencies command: pip install -r requirements/dev.txt test: docker: - image: circleci/postgres:9.6.5 environment: POSTGRES_DB: example POSTGRES_USER: circleci POSTGRES_PASSWORD: somePwd POSTGRES_PORT: 5432 DATABASE_URL: postgresql://circleci:somePwd@localhost:5432/example working_directory: ~/repo steps: - checkout - restore_cache: keys: - dependencies-{{ checksum "requirements/dev.txt" }}-{{ checksum "requirements/prod.txt" }} # fallback to using the latest cache if no exact match is found - dependencies- - run: name: Setup dababase environment: FLASK_APP: /home/circleci/repo/autoapp.py FLASK_DEBUG: 0 command: flask db upgrade - run: name: Flask test command: flask test workflows: version: 2 build-test: jobs: - build - test: requires: - build