|
1 | 1 | # Python CircleCI 2.0 configuration file
|
2 | 2 | # vi: et:ts=2:sw=2
|
3 |
| -# |
4 |
| -# Check https://circleci.com/docs/2.0/language-python/ for more details |
5 |
| -# |
6 |
| -version: 2 |
| 3 | + |
| 4 | +version: 2.0 |
| 5 | + |
7 | 6 | jobs:
|
8 |
| - build: |
| 7 | + python_27: |
9 | 8 | docker:
|
10 |
| - - image: circleci/python:3-stretch |
| 9 | + - image: circleci/python:2.7.17 |
| 10 | + environment: &env |
| 11 | + VERSION: 2.16.5 |
| 12 | + CC: /usr/lib/ccache/cc |
| 13 | + C_INCLUDE_PATH: /usr/local/include:/usr/include |
| 14 | + LD_LIBRARY_PATH: /usr/local/lib:/usr/lib |
11 | 15 | working_directory: ~/python-mbedtls
|
12 |
| - steps: |
| 16 | + steps: &steps |
13 | 17 | - checkout
|
14 |
| - |
15 |
| - - run: |
16 |
| - name: Downgrade openssl for Python 3.4 |
| 18 | + - run: &deps |
| 19 | + name: Install dependencies |
17 | 20 | command: |
|
18 |
| - sudo apt-get update |
19 |
| - sudo apt-get install libssl1.0-dev |
20 |
| -
|
21 |
| - - run: |
22 |
| - name: Install pyenv |
| 21 | + sudo apt-get -qq update |
| 22 | + sudo apt-get -qq install ccache |
| 23 | + echo "export PATH=/usr/lib/ccache:$PATH" >> $BASH_ENV |
| 24 | + - run: &python_version |
| 25 | + name: Display current Python |
| 26 | + command: python -VV | tee python_version |
| 27 | + - restore_cache: &restore_cache_ccache |
| 28 | + keys: |
| 29 | + - ccache--v0--{{ checksum "python_version" }} |
| 30 | + - run: &mbedtls |
| 31 | + name: Install mbedtls |
23 | 32 | command: |
|
24 |
| - git clone https://github.com/pyenv/pyenv.git $HOME/python-mbedtls/.pyenv |
25 |
| - cat << 'EOF' >> $BASH_ENV |
26 |
| - export PYENV_ROOT="$HOME/python-mbedtls/.pyenv" |
27 |
| - export PATH="$PYENV_ROOT/bin:$PATH" |
28 |
| - EOF |
| 33 | + sudo ./scripts/download-mbedtls.sh $VERSION /usr/local/src |
| 34 | + sudo ./scripts/install-mbedtls.sh /usr/local/src |
| 35 | + - run: &install |
| 36 | + name: Install library |
| 37 | + command: | |
| 38 | + python setup.py bdist_wheel |
| 39 | + python -m pip install --user --upgrade dist/*.whl |
| 40 | + - save_cache: &save_cache_ccache |
| 41 | + key: ccache--v0--{{ checksum "python_version" }}--{{ .BuildNum }} |
| 42 | + paths: |
| 43 | + - /home/circleci/.ccache |
| 44 | + - run: &tests |
| 45 | + name: Run tests |
| 46 | + command: | |
| 47 | + python -m pip install --user -r requirements/tests.txt |
| 48 | + python -m pytest |
| 49 | + - store_artifacts: &artifacts |
| 50 | + path: out |
| 51 | + destination: artifacts |
29 | 52 |
|
30 |
| - - restore_cache: |
31 |
| - key: py27-2.7.16-v0-{{ arch }} |
32 |
| - - restore_cache: |
33 |
| - key: py34-3.4.10-v0-{{ arch }} |
34 |
| - - restore_cache: |
35 |
| - key: py35-3.5.9-v0-{{ arch }} |
36 |
| - - restore_cache: |
37 |
| - key: py36-3.6.10-v0-{{ arch }} |
38 |
| - - restore_cache: |
39 |
| - key: py37-3.7.6-v0-{{ arch }} |
40 |
| - - restore_cache: |
41 |
| - key: py38-3.8.1-v0-{{ arch }} |
| 53 | + python_34: |
| 54 | + docker: |
| 55 | + - image: circleci/python:3.4.10 |
| 56 | + environment: *env |
| 57 | + working_directory: ~/python-mbedtls |
| 58 | + steps: *steps |
| 59 | + |
| 60 | + python_35: |
| 61 | + docker: |
| 62 | + - image: circleci/python:3.5.9 |
| 63 | + environment: *env |
| 64 | + working_directory: ~/python-mbedtls |
| 65 | + steps: *steps |
| 66 | + |
| 67 | + python_36: |
| 68 | + docker: |
| 69 | + - image: circleci/python:3.6.10 |
| 70 | + environment: *env |
| 71 | + working_directory: ~/python-mbedtls |
| 72 | + steps: *steps |
| 73 | + |
| 74 | + python_37: |
| 75 | + docker: |
| 76 | + - image: circleci/python:3.7.6 |
| 77 | + environment: *env |
| 78 | + working_directory: ~/python-mbedtls |
| 79 | + steps: *steps |
| 80 | + |
| 81 | + python_38: |
| 82 | + docker: |
| 83 | + - image: circleci/python:3.8.2 |
| 84 | + environment: *env |
| 85 | + working_directory: ~/python-mbedtls |
| 86 | + steps: *steps |
42 | 87 |
|
| 88 | + python_39: |
| 89 | + docker: |
| 90 | + - image: circleci/python:3.9-rc |
| 91 | + environment: *env |
| 92 | + working_directory: ~/python-mbedtls |
| 93 | + steps: *steps |
| 94 | + |
| 95 | + python_extra: |
| 96 | + docker: |
| 97 | + - image: circleci/python:3.7.6 |
| 98 | + environment: *env |
| 99 | + working_directory: ~/python-mbedtls |
| 100 | + steps: |
| 101 | + - checkout |
| 102 | + - run: *deps |
| 103 | + - run: *python_version |
| 104 | + - restore_cache: |
| 105 | + keys: |
| 106 | + - ccache--v0--{{ checksum "python_version" }}--cov |
| 107 | + - run: *mbedtls |
43 | 108 | - run:
|
44 |
| - name: Install Python versions |
| 109 | + name: Install library |
45 | 110 | command: |
|
46 |
| - eval "$(pyenv init -)" |
47 |
| - test -d ".pyenv/versions/2.7.16" || pyenv install 2.7.16 |
48 |
| - test -d ".pyenv/versions/3.4.10" || pyenv install 3.4.10 |
49 |
| - test -d ".pyenv/versions/3.5.9" || pyenv install 3.5.9 |
50 |
| - test -d ".pyenv/versions/3.6.10" || pyenv install 3.6.10 |
51 |
| - test -d ".pyenv/versions/3.7.6" || pyenv install 3.7.6 |
52 |
| - test -d ".pyenv/versions/3.8.1" || pyenv install 3.8.1 |
53 |
| -
|
54 |
| - - save_cache: |
55 |
| - key: py27-2.7.16-v0-{{ arch }} |
56 |
| - paths: |
57 |
| - - .pyenv/versions/2.7.16 |
58 |
| - - save_cache: |
59 |
| - key: py34-3.4.10-v0-{{ arch }} |
60 |
| - paths: |
61 |
| - - .pyenv/versions/3.4.10 |
62 |
| - - save_cache: |
63 |
| - key: py35-3.5.9-v0-{{ arch }} |
64 |
| - paths: |
65 |
| - - .pyenv/versions/3.5.9 |
66 |
| - - save_cache: |
67 |
| - key: py36-3.6.10-v0-{{ arch }} |
68 |
| - paths: |
69 |
| - - .pyenv/versions/3.6.10 |
70 |
| - - save_cache: |
71 |
| - key: py37-3.7.6-v0-{{ arch }} |
72 |
| - paths: |
73 |
| - - .pyenv/versions/3.7.6 |
| 111 | + python setup.py --with-coverage build_ext --inplace |
74 | 112 | - save_cache:
|
75 |
| - key: py38-3.8.1-v0-{{ arch }} |
| 113 | + key: ccache--v0--{{ checksum "python_version" }}--cov--{{ .BuildNum }} |
76 | 114 | paths:
|
77 |
| - - .pyenv/versions/3.8.1 |
78 |
| - |
| 115 | + - /home/circleci/.ccache |
79 | 116 | - run:
|
80 |
| - name: Install mbedtls |
| 117 | + name: Run tests |
81 | 118 | command: |
|
82 |
| - VERSION=2.16.5 |
83 |
| - DESTDIR=$HOME/lib/$VERSION |
84 |
| - sudo apt-get install cmake |
85 |
| - sudo ./scripts/download-mbedtls.sh $VERSION $DESTDIR/src |
86 |
| - sudo ./scripts/install-mbedtls.sh $DESTDIR/src $DESTDIR |
87 |
| - cat << EOF >> $BASH_ENV |
88 |
| - export VERSION=$VERSION |
89 |
| - export DESTDIR=$DESTDIR |
90 |
| - export LD_LIBRARY_PATH=$DESTDIR/lib |
91 |
| - export C_INCLUDE_PATH=$DESTDIR/include |
92 |
| - export TOX_PARALLEL_NO_SPINNER=1 |
93 |
| - EOF |
94 |
| -
|
| 119 | + python -m pip install --user -r requirements/tests.txt |
| 120 | + python -m pip install --user cython pytest-black pytest-cov |
| 121 | + PYTHONPATH=$(pwd)/src/:$PYTHONPATH |
| 122 | + export PYTHONPATH |
| 123 | + python -m pytest --black --cov=src/ tests/ |
95 | 124 | - run:
|
96 |
| - name: Create environment |
| 125 | + name: Coverage |
97 | 126 | command: |
|
98 |
| - python -m venv venv |
99 |
| - . venv/bin/activate |
100 |
| - pip install -r requirements/circleci.txt |
101 |
| -
|
| 127 | + python -m pip install --user coveralls |
| 128 | + PYTHONPATH=$(pwd)/src/:$PYTHONPATH |
| 129 | + export PYTHONPATH |
| 130 | + python -m coveralls |
102 | 131 | - run:
|
103 |
| - name: Run tests |
| 132 | + name: Run doctest |
104 | 133 | command: |
|
105 |
| - eval "$(pyenv init -)" |
106 |
| - pyenv shell 2.7.16 3.4.10 3.5.9 3.6.10 3.7.6 3.8.1 |
107 |
| - . venv/bin/activate |
108 |
| - tox --parallel auto -e py27,py34,py35,py36,py37-coveralls,py38 |
109 |
| - tox -e py37 --run-command "{envpython} -m doctest {toxinidir}/README.rst" |
110 |
| -
|
| 134 | + PYTHONPATH=$(pwd)/src/:$PYTHONPATH |
| 135 | + export PYTHONPATH |
| 136 | + python -m doctest README.rst |
111 | 137 | - run:
|
112 | 138 | name: Build API documentation
|
113 | 139 | command: |
|
114 |
| - eval "$(pyenv init -)" |
115 |
| - pyenv shell 3.7.6 |
116 |
| - . venv/bin/activate |
117 |
| - tox -e py37-docs |
118 |
| -
|
| 140 | + python -m pip install --user sphinx sphinx_rtd_theme |
| 141 | + sphinx-build docs/source docs_out/ --color -W -bhtml |
119 | 142 | - run:
|
120 | 143 | name: Save docs
|
121 | 144 | when: on_success
|
122 | 145 | command: |
|
123 | 146 | mkdir -p out/
|
124 |
| - cp -R .tox/docs_out out/docs |
125 |
| -
|
126 |
| - - run: |
127 |
| - name: Save logs |
128 |
| - when: on_fail |
129 |
| - command: | |
130 |
| - mkdir -p out/log |
131 |
| - cp .tox/*/log/py*.log out/log || true |
| 147 | + cp -R docs_out out/docs |
| 148 | + - store_artifacts: *artifacts |
132 | 149 |
|
133 |
| - - store_artifacts: |
134 |
| - path: out |
135 |
| - destination: artifacts |
| 150 | +workflows: |
| 151 | + version: 2 |
| 152 | + build: |
| 153 | + jobs: |
| 154 | + - python_extra |
| 155 | + # - python_39 # Requires Python 3.0 |
| 156 | + - python_38 |
| 157 | + - python_37 |
| 158 | + - python_36 |
| 159 | + - python_35 |
| 160 | + - python_34 |
| 161 | + - python_27 |
0 commit comments