1
+ version : 2 # use CircleCI 2.0
2
+ jobs : # A basic unit of work in a run
3
+ build : # runs not using Workflows must have a `build` job as entry point
4
+ # directory where steps are run
5
+ working_directory : ~/circleci-demo-python-flask
6
+ docker : # run the steps with Docker
7
+ # CircleCI Python images available at: https://hub.docker.com/r/circleci/python/
8
+ - image : circleci/python:3.6.4
9
+ environment : # environment variables for primary container
10
+ PIPENV_VENV_IN_PROJECT : true
11
+ DATABASE_URL : postgresql://root@localhost/circle_test?sslmode=disable
12
+ # CircleCI PostgreSQL images available at: https://hub.docker.com/r/circleci/postgres/
13
+ - image : circleci/postgres:9.6.2
14
+ environment : # environment variables for the Postgres container.
15
+ POSTGRES_USER : root
16
+ POSTGRES_DB : circle_test
17
+ steps : # steps that comprise the `build` job
18
+ - checkout # check out source code to working directory
19
+ - run : sudo chown -R circleci:circleci /usr/local/bin
20
+ - run : sudo chown -R circleci:circleci /usr/local/lib/python3.6/site-packages
21
+ - restore_cache :
22
+ # Read about caching dependencies: https://circleci.com/docs/2.0/caching/
23
+ key : deps9-{{ .Branch }}-{{ checksum "Pipfile.lock" }}
24
+ - run :
25
+ command : |
26
+ sudo pip install pipenv
27
+ pipenv install
28
+ - save_cache : # cache Python dependencies using checksum of Pipfile as the cache-key
29
+ key : deps9-{{ .Branch }}-{{ checksum "Pipfile.lock" }}
30
+ paths :
31
+ - " .venv"
32
+ - " /usr/local/bin"
33
+ - " /usr/local/lib/python3.6/site-packages"
34
+ - run :
35
+ command : |
36
+ pipenv run python manage.py test
37
+ - store_test_results : # Upload test results for display in Test Summary: https://circleci.com/docs/2.0/collect-test-data/
38
+ path : test-results
39
+ - store_artifacts : # Upload test summary for display in Artifacts: https://circleci.com/docs/2.0/artifacts/
40
+ path : test-results
41
+ destination : tr1
0 commit comments