|
1 | | -version: 2.1 |
2 | | -orb: |
3 | | - codecov: codecov/codecov@3.0.0 |
4 | | - |
5 | | - |
6 | | -jobs: |
7 | | - build: |
8 | | - docker: |
9 | | - - image: cimg/python:3.9.6 |
10 | | - steps: |
11 | | - - checkout |
| 1 | +version: 2 |
| 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-django |
| 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 | + auth: |
| 10 | + username: mydockerhub-user |
| 11 | + password: $DOCKERHUB_PASSWORD # context / project UI env-var reference |
| 12 | + environment: # environment variables for primary container |
| 13 | + PIPENV_VENV_IN_PROJECT: true |
| 14 | + DATABASE_URL: postgresql://root@localhost/circle_test?sslmode=disable |
| 15 | + # CircleCI PostgreSQL images available at: https://hub.docker.com/r/circleci/postgres/ |
| 16 | + - image: circleci/postgres:9.6.2 |
| 17 | + auth: |
| 18 | + username: mydockerhub-user |
| 19 | + password: $DOCKERHUB_PASSWORD # context / project UI env-var reference |
| 20 | + environment: # environment variables for the Postgres container. |
| 21 | + POSTGRES_USER: root |
| 22 | + POSTGRES_DB: circle_test |
| 23 | + steps: # steps that comprise the `build` job |
| 24 | + - checkout # check out source code to working directory |
| 25 | + - run: sudo chown -R circleci:circleci /usr/local/bin |
| 26 | + - run: sudo chown -R circleci:circleci /usr/local/lib/python3.6/site-packages |
| 27 | + - restore_cache: |
| 28 | + # Read about caching dependencies: https://circleci.com/docs/2.0/caching/ |
| 29 | + key: deps9-{{ .Branch }}-{{ checksum "Pipfile.lock" }} |
12 | 30 | - run: |
13 | | - name: Install dependencies |
14 | | - command: pip install -r requirements.txt |
| 31 | + command: | |
| 32 | + sudo pip install pipenv |
| 33 | + pipenv install |
| 34 | + - save_cache: # cache Python dependencies using checksum of Pipfile as the cache-key |
| 35 | + key: deps9-{{ .Branch }}-{{ checksum "Pipfile.lock" }} |
| 36 | + paths: |
| 37 | + - "venv" |
15 | 38 | - run: |
16 | | - name: Run tests and collect coverage |
17 | 39 | command: | |
18 | | - coverage run tests.py |
19 | | - coverage xml |
20 | | - |
21 | | - |
22 | | -workflow: |
23 | | - version: 2.1 |
24 | | - build-test: |
25 | | - jobs: |
26 | | - - build |
| 40 | + pipenv run python manage.py test |
| 41 | + - store_test_results: # Upload test results for display in Test Summary: https://circleci.com/docs/2.0/collect-test-data/ |
| 42 | + path: test-results |
| 43 | + - store_artifacts: # Upload test summary for display in Artifacts: https://circleci.com/docs/2.0/artifacts/ |
| 44 | + path: test-results |
| 45 | + destination: tr1 |
0 commit comments