|
1 |
| -# Python CircleCI 2.0 configuration file |
2 |
| -# |
3 |
| -# Check https://circleci.com/docs/2.0/language-python/ for more details |
4 |
| -# |
5 |
| -version: 2 |
| 1 | +--- |
| 2 | + |
| 3 | +version: 2.1 |
| 4 | + |
| 5 | +executors: |
| 6 | + python-27: {docker: [{image: 'python:2.7'}]} |
| 7 | + python-35: {docker: [{image: 'python:3.5'}]} |
| 8 | + python-36: {docker: [{image: 'python:3.6'}]} |
| 9 | + python-37: {docker: [{image: 'python:3.7'}]} |
| 10 | + |
6 | 11 | jobs:
|
7 | 12 | build:
|
8 |
| - docker: |
9 |
| - - image: circleci/python:3.7.3 |
10 |
| - |
| 13 | + parameters: |
| 14 | + executor: |
| 15 | + type: executor |
| 16 | + executor: << parameters.executor >> |
11 | 17 | working_directory: ~/repo
|
12 |
| - |
13 | 18 | steps:
|
14 |
| - - checkout |
15 |
| - |
16 |
| - # Download and cache dependencies |
17 |
| - - restore_cache: |
18 |
| - keys: |
19 |
| - - v1-dependencies-{{ checksum "requirements.txt" }} |
20 |
| - # fallback to using the latest cache if no exact match is found |
21 |
| - - v1-dependencies- |
22 |
| - |
23 |
| - - run: |
24 |
| - name: install dependencies |
25 |
| - command: | |
26 |
| - python3 -m venv venv |
27 |
| - . venv/bin/activate |
28 |
| - python setup.py install |
29 |
| -
|
30 |
| - - save_cache: |
31 |
| - paths: |
32 |
| - - ./venv |
33 |
| - key: v1-dependencies-{{ checksum "requirements.txt" }} |
| 19 | + - checkout |
| 20 | + - restore_cache: |
| 21 | + keys: |
| 22 | + - v1-dependencies-{{ .Environment.CIRCLE_JOB }}-{{ checksum "requirements.txt" }} |
| 23 | + - run: |
| 24 | + name: install dependencies |
| 25 | + command: | |
| 26 | + pip install virtualenv |
| 27 | + virtualenv venv |
| 28 | + . venv/bin/activate |
| 29 | + pip install -r test_requirements.txt |
| 30 | + python setup.py install |
| 31 | + - save_cache: |
| 32 | + paths: |
| 33 | + - ./venv |
| 34 | + key: v1-dependencies-{{ .Environment.CIRCLE_JOB }}-{{ checksum "requirements.txt" }} |
| 35 | + - run: |
| 36 | + name: run tests |
| 37 | + command: | |
| 38 | + . venv/bin/activate |
| 39 | + python setup.py test |
34 | 40 |
|
35 |
| - - run: |
36 |
| - name: run tests |
37 |
| - command: | |
38 |
| - . venv/bin/activate |
39 |
| - python setup.py test |
| 41 | +workflows: |
| 42 | + run-tests: |
| 43 | + jobs: |
| 44 | + - build: {name: run-tests-python-2.7, executor: python-27} |
| 45 | + - build: {name: run-tests-python-3.5, executor: python-35} |
| 46 | + - build: {name: run-tests-python-3.6, executor: python-36} |
| 47 | + - build: {name: run-tests-python-3.7, executor: python-37} |
0 commit comments