|
1 |
| -# Python CircleCI 2.0 configuration file |
2 |
| -# |
3 |
| -# Check https://circleci.com/docs/2.0/language-python/ for more details |
4 |
| -# |
5 | 1 | version: 2
|
| 2 | + |
6 | 3 | jobs:
|
7 |
| - build: |
| 4 | + test-3.6: &test-template |
| 5 | + # Job to run tests test on python 3.6 |
8 | 6 | docker:
|
9 |
| - # specify the version you desire here |
10 |
| - # use `-browsers` prefix for selenium tests, e.g. `3.6.1-browsers` |
11 | 7 | - image: circleci/python:3.6
|
12 | 8 |
|
13 |
| - # Specify service dependencies here if necessary |
14 |
| - # CircleCI maintains a library of pre-built images |
15 |
| - # documented at https://circleci.com/docs/2.0/circleci-images/ |
16 |
| - # - image: circleci/postgres:9.4 |
17 |
| - |
18 |
| - working_directory: ~/repo |
| 9 | + environment: |
| 10 | + PYTHON_BIN: python3 |
| 11 | + PYTHON_VERSION: 3.6 |
19 | 12 |
|
20 | 13 | steps:
|
21 | 14 | - checkout
|
22 | 15 |
|
23 | 16 | # Download and cache dependencies
|
24 | 17 | - restore_cache:
|
25 | 18 | keys:
|
26 |
| - - v1-dependencies-{{ checksum "setup.py" }} |
27 |
| - # fallback to using the latest cache if no exact match is found |
28 |
| - - v1-dependencies- |
| 19 | + - v2-test-dependencies-{{ .Environment.CIRCLE_JOB }}-{{ checksum "setup.py" }} |
29 | 20 |
|
30 | 21 | - run:
|
31 |
| - name: install dependencies |
| 22 | + name: Install test dependencies |
32 | 23 | command: |
|
33 |
| - python3 -m venv venv |
| 24 | + ${PYTHON_BIN} -m venv venv |
34 | 25 | . venv/bin/activate
|
35 | 26 | pip install -U pip
|
36 | 27 | pip install -U setuptools
|
37 |
| - pip install . |
| 28 | + # Install package with dependencies |
| 29 | + pip install .[test] |
38 | 30 |
|
39 | 31 | - save_cache:
|
40 | 32 | paths:
|
41 | 33 | - ./venv
|
42 |
| - key: v1-dependencies-{{ checksum "setup.py" }} |
| 34 | + key: v2-test-dependencies-{{ .Environment.CIRCLE_JOB }}-{{ checksum "setup.py" }} |
| 35 | + |
| 36 | + # run Flake8! |
| 37 | + - run: |
| 38 | + name: Flake8 Compliance |
| 39 | + command: | |
| 40 | + . venv/bin/activate |
| 41 | + ${PYTHON_BIN} setup.py flake8 |
43 | 42 |
|
44 | 43 | # run tests!
|
45 | 44 | - run:
|
46 | 45 | name: Unit-Tests
|
47 | 46 | command: |
|
48 | 47 | . venv/bin/activate
|
49 |
| - python setup.py test |
| 48 | + pip install |
| 49 | + ${PYTHON_BIN} setup.py nosetests |
50 | 50 |
|
51 |
| - # run Flake8! |
| 51 | + test-3.5: |
| 52 | + # Clone-job to run tests test on python 3.6 |
| 53 | + <<: *test-template |
| 54 | + docker: |
| 55 | + - image: circleci/python:3.5 |
| 56 | + |
| 57 | + environment: |
| 58 | + PYTHON_BIN: python3 |
| 59 | + PYTHON_VERSION: 3.5 |
| 60 | + |
| 61 | + build: |
| 62 | + # Build and store artifacts |
| 63 | + |
| 64 | + docker: |
| 65 | + - image: circleci/python:3.6 |
| 66 | + |
| 67 | + |
| 68 | + steps: |
| 69 | + - checkout |
52 | 70 | - run:
|
53 |
| - name: Flake8 Compliance |
| 71 | + name: Create environment |
54 | 72 | command: |
|
| 73 | + python3 -m venv venv |
55 | 74 | . venv/bin/activate
|
56 |
| - python setup.py flake8 |
| 75 | + pip install -U pip setuptools wheel |
| 76 | +
|
| 77 | + - run: |
| 78 | + name: Build Source and Wheel distribution files |
| 79 | + command: | |
| 80 | + . venv/bin/activate |
| 81 | + python setup.py sdist bdist_wheel |
| 82 | + python setup.py --version > version.txt |
| 83 | +
|
| 84 | + - store_artifacts: |
| 85 | + path: dist |
| 86 | + destination: dist |
| 87 | + |
| 88 | + - persist_to_workspace: |
| 89 | + root: . |
| 90 | + paths: |
| 91 | + - dist |
| 92 | + - version.txt |
57 | 93 |
|
58 |
| -# # Build |
59 |
| -# - store_artifacts: |
60 |
| -# path: test-reports |
61 |
| -# destination: test-reports |
| 94 | +workflows: |
| 95 | + version: 2 |
| 96 | + test_build_deploy: |
| 97 | + jobs: |
| 98 | + - test-3.6 |
| 99 | + - test-3.5 |
| 100 | + - build: |
| 101 | + requires: |
| 102 | + - test-3.6 |
| 103 | + - test-3.5 |
0 commit comments