.circleci/config.yml
version: 2
jobs:
test:
docker:
- image: circleci/python:3.6.1
- image: circleci/redis:3.2-alpine
working_directory: ~/repo
steps:
- checkout
- restore_cache:
keys:
- v1-dependencies-{{ checksum "setup.py" }}
- run:
name: install dependencies
command: |
python3 -m venv venv
. venv/bin/activate
make test_requirements
- save_cache:
paths:
- ./venv
key: v1-dependencies-{{ checksum "setup.py" }}
- run:
name: run tests
command: |
. venv/bin/activate
flake8
pytest
- run:
name: report coverage
command: |
. venv/bin/activate
codecov
- store_artifacts:
path: test-reports
destination: test-reports
publish:
docker:
- image: circleci/python:3.6.1
working_directory: ~/repo
steps:
- checkout
- restore_cache:
keys:
- v1-dependencies-{{ checksum "setup.py" }}
- run:
name: install dependencies
command: |
python3 -m venv venv
. venv/bin/activate
make test_requirements
- run:
name: publish
command: |
. venv/bin/activate
make publish
workflows:
version: 2
test_and_publish:
jobs:
- test
- publish:
requires:
- test
filters:
branches:
only: master