|
1 | 1 | version: 2.1 |
2 | | -jobs: |
3 | | - test-linux: |
4 | | - parameters: |
5 | | - dimod-version: |
6 | | - type: string |
7 | | - python-version: |
8 | | - type: string |
9 | 2 |
|
10 | | - docker: |
11 | | - - image: circleci/python:<< parameters.python-version >> |
| 3 | +parameters: |
| 4 | + package: |
| 5 | + type: string |
| 6 | + default: dwave-qbsolv |
12 | 7 |
|
13 | | - steps: |
| 8 | +orbs: |
| 9 | + |
14 | 10 |
|
15 | | - - checkout |
16 | | - |
17 | | - - restore_cache: &restore-cache-env |
18 | | - keys: |
19 | | - - v3-dependencies-{{ checksum "requirements.txt" }}-{{ checksum "tests/requirements.txt" }}-{{ .Environment.CIRCLE_JOB }} |
20 | | - |
21 | | - - run: |
22 | | - name: create virtualenv |
23 | | - command: | |
24 | | - python -m virtualenv env |
25 | | -
|
26 | | - - run: &install-dependencies |
27 | | - name: install dependencies |
28 | | - command: | |
29 | | - . env/bin/activate |
30 | | - python --version |
31 | | - pip install -r requirements.txt -r tests/requirements.txt |
32 | | -
|
33 | | - - run: |
34 | | - name: install dimod |
35 | | - command: | |
36 | | - . env/bin/activate |
37 | | - pip install 'dimod<< parameters.dimod-version >>' |
38 | | -
|
39 | | - - save_cache: &save-cache-env |
40 | | - paths: |
41 | | - - ./env |
42 | | - key: v3-dependencies-{{ checksum "requirements.txt" }}-{{ checksum "tests/requirements.txt" }}-{{ .Environment.CIRCLE_JOB }} |
43 | | - |
44 | | - - run: &install-package |
45 | | - name: install package |
46 | | - command: | |
47 | | - . env/bin/activate |
48 | | - python setup.py build_ext --inplace |
49 | | - pip install . |
50 | | - |
51 | | - - run: &run-tests |
52 | | - name: run unittests |
53 | | - command: | |
54 | | - . env/bin/activate |
55 | | - python --version |
56 | | - coverage run -m unittest discover |
57 | | -
|
58 | | - - store_artifacts: |
59 | | - path: ./htmlcov |
60 | | - |
61 | | - - run: |
62 | | - name: codecov |
63 | | - command: | |
64 | | - . env/bin/activate |
65 | | - codecov |
66 | | -
|
67 | | - test-osx: |
68 | | - parameters: |
69 | | - python-version: |
70 | | - type: string |
71 | | - |
72 | | - macos: |
73 | | - xcode: "12.2.0" |
74 | | - |
75 | | - environment: |
76 | | - HOMEBREW_NO_AUTO_UPDATE: 1 |
77 | | - |
78 | | - # Force (lie about) macOS 10.9 binary compatibility. |
79 | | - # Needed for properly versioned wheels. |
80 | | - # See: https://github.com/MacPython/wiki/wiki/Spinning-wheels |
81 | | - MACOSX_DEPLOYMENT_TARGET: 10.9 |
82 | | - |
83 | | - working_directory: ~/repo |
84 | | - |
85 | | - steps: |
86 | | - - checkout |
87 | | - |
88 | | - - run: |
89 | | - name: install pyenv |
90 | | - command: | |
91 | | - brew install pyenv |
92 | | -
|
93 | | - - restore_cache: &restore-cache-pyenv |
94 | | - keys: |
95 | | - - v3-pyenv-{{ .Environment.CIRCLE_JOB }}-xcode-12.2.0 |
96 | | - |
97 | | - - run: |
98 | | - name: install python |
99 | | - command: | |
100 | | - pyenv install << parameters.python-version >> -s |
101 | | -
|
102 | | - - save_cache: &save-cache-pyenv |
103 | | - paths: |
104 | | - - ~/.pyenv |
105 | | - key: v3-pyenv-{{ .Environment.CIRCLE_JOB }}-xcode-12.2.0 |
106 | | - |
107 | | - - run: &create-virtualenv-pyenv |
108 | | - name: create virtualenv |
109 | | - command: | |
110 | | - eval "$(pyenv init -)" |
111 | | - pyenv local << parameters.python-version >> |
112 | | - python -m pip install virtualenv |
113 | | - python -m virtualenv env |
114 | | -
|
115 | | - - restore_cache: *restore-cache-env |
116 | | - |
117 | | - - run: *install-dependencies |
118 | | - |
119 | | - - save_cache: *save-cache-env |
120 | | - |
121 | | - - run: *install-package |
122 | | - |
123 | | - - run: *run-tests |
124 | | - |
125 | | -################################################################################################## |
126 | | -# Deploy |
127 | | -################################################################################################## |
128 | | - |
129 | | - build-manylinux-64: &manylinux-template |
130 | | - docker: |
131 | | - - image: quay.io/pypa/manylinux1_x86_64 |
132 | | - |
133 | | - working_directory: ~/repo |
134 | | - |
135 | | - steps: |
136 | | - - checkout |
137 | | - |
138 | | - - run: |
139 | | - name: build wheels |
140 | | - command: | |
141 | | - for PYBIN in /opt/python/*/bin; do |
142 | | - "${PYBIN}/python" -c "import sys; sys.exit((3,6)<=sys.version_info<(3,10))" && continue |
143 | | - "${PYBIN}/pip" install -r requirements.txt -r tests/requirements.txt |
144 | | - "${PYBIN}/pip" wheel . -w ./wheelhouse |
145 | | - "${PYBIN}/python" setup.py sdist -d ./dist |
146 | | - done |
147 | | -
|
148 | | - - run: |
149 | | - name: bundle shared libraries into wheels |
150 | | - command: | |
151 | | - for whl in ./wheelhouse/dwave*qbsolv*.whl; do |
152 | | - auditwheel repair "$whl" -w ./dist |
153 | | - done |
154 | | -
|
155 | | - - store_artifacts: |
156 | | - path: ./dist |
157 | | - |
158 | | - - run: |
159 | | - name: create a virtualenv |
160 | | - command: | |
161 | | - pythons=(/opt/python/*/bin) |
162 | | - python="${pythons[0]}" |
163 | | - "$python/pip" install virtualenv |
164 | | - "$python/python" -m virtualenv env |
165 | | -
|
166 | | - - run: &upload-pypi |
167 | | - name: install twine and deploy |
168 | | - command: | |
169 | | - . env/bin/activate |
170 | | - pip install twine |
171 | | - twine upload -u "$PYPI_USERNAME" -p "$PYPI_PASSWORD" --skip-existing ./dist/* |
172 | | -
|
173 | | - build-manylinux-32: |
174 | | - <<: *manylinux-template |
175 | | - docker: |
176 | | - - image: quay.io/pypa/manylinux1_i686 |
177 | | - |
178 | | - build-osx: |
179 | | - parameters: |
180 | | - python-version: |
181 | | - type: string |
182 | | - |
183 | | - macos: |
184 | | - xcode: "12.2.0" |
185 | | - |
186 | | - environment: |
187 | | - HOMEBREW_NO_AUTO_UPDATE: 1 |
188 | | - MACOSX_DEPLOYMENT_TARGET: 10.9 |
189 | | - |
190 | | - working_directory: ~/repo |
191 | | - |
192 | | - steps: |
193 | | - - checkout |
194 | | - |
195 | | - - run: |
196 | | - name: install pyenv |
197 | | - command: | |
198 | | - brew install pyenv |
199 | | -
|
200 | | - - restore_cache: *restore-cache-pyenv |
201 | | - |
202 | | - - run: |
203 | | - name: install python |
204 | | - command: | |
205 | | - pyenv install << parameters.python-version >> -s |
206 | | -
|
207 | | - - save_cache: *save-cache-pyenv |
208 | | - |
209 | | - - run: *create-virtualenv-pyenv |
210 | | - |
211 | | - - run: *install-dependencies |
212 | | - |
213 | | - - run: *install-package |
214 | | - |
215 | | - - run: |
216 | | - name: create bdist_wheel |
217 | | - command: | |
218 | | - . env/bin/activate |
219 | | - python setup.py bdist_wheel |
220 | | -
|
221 | | - - store_artifacts: |
222 | | - path: ./dist |
223 | | - |
224 | | - - run: *upload-pypi |
| 11 | +environment: |
| 12 | + PIP_PROGRESS_BAR: 'off' |
225 | 13 |
|
226 | 14 | workflows: |
227 | | - test: |
| 15 | + build-test-deploy: |
228 | 16 | jobs: |
229 | | - - test-linux: |
230 | | - name: test-linux-<< matrix.python-version >>-dimod<< matrix.dimod-version >> |
| 17 | + - ocean/build-sdist: |
| 18 | + filters: &always-run # required because it's indirectly required by the deploy job that runs on tags only |
| 19 | + tags: |
| 20 | + only: /.*/ |
| 21 | + |
| 22 | + - ocean/build-manylinux-wheel: |
| 23 | + name: build-<< matrix.manylinux-tag >>_<< matrix.manylinux-arch >>-py<< matrix.python-version >> |
231 | 24 | matrix: |
232 | 25 | parameters: |
233 | | - python-version: &python-versions [3.6.8, 3.7.9, 3.8.9, 3.9.4] |
234 | | - dimod-version: ["~=0.8.0,>=0.8.1", "~=0.9.0", "~=0.10.0"] |
235 | | - - test-osx: |
236 | | - name: test-osx-<< matrix.python-version >> |
| 26 | + manylinux-tag: ["manylinux1", "manylinux2014"] |
| 27 | + manylinux-arch: ["x86_64"] |
| 28 | + python-version: &python-versions ["3.6.8", "3.7.9", "3.8.9", "3.9.4", "3.10.0"] |
| 29 | + exclude: |
| 30 | + # py310 not available in manylinux1_x86_64 |
| 31 | + - manylinux-tag: "manylinux1" |
| 32 | + manylinux-arch: "x86_64" |
| 33 | + python-version: "3.10.0" |
| 34 | + filters: |
| 35 | + <<: *always-run |
| 36 | + |
| 37 | + - ocean/test-linux-from-dist: |
| 38 | + name: test-linux-py<< matrix.python-version >>|<< matrix.constraints >> |
| 39 | + requires: |
| 40 | + - ocean/build-sdist |
| 41 | + - ocean/build-manylinux-wheel |
237 | 42 | matrix: |
238 | 43 | parameters: |
239 | 44 | python-version: *python-versions |
240 | | - |
241 | | - deploy: |
242 | | - jobs: |
243 | | - - build-manylinux-64: |
| 45 | + package: [<< pipeline.parameters.package >>] |
| 46 | + constraints: ["dimod~=0.9.0", "dimod~=0.10.0"] |
| 47 | + exclude: |
| 48 | + # dimod < 0.10 not supported on py310 |
| 49 | + - python-version: "3.10.0" |
| 50 | + package: << pipeline.parameters.package >> |
| 51 | + constraints: "dimod~=0.9.0" |
244 | 52 | filters: |
245 | | - tags: |
246 | | - only: /^[0-9]+(\.[0-9]+)*((\.dev|rc|\.post)([0-9]+)?)?$/ |
247 | | - branches: |
248 | | - ignore: /.*/ |
249 | | - - build-manylinux-32: |
| 53 | + <<: *always-run |
| 54 | + |
| 55 | + - ocean/build-macos-wheel: |
| 56 | + name: build-macos-py<< matrix.python-version >> |
| 57 | + matrix: |
| 58 | + parameters: |
| 59 | + python-version: *python-versions |
| 60 | + xcode: ["13.2.0"] |
250 | 61 | filters: |
251 | | - tags: |
252 | | - only: /^[0-9]+(\.[0-9]+)*((\.dev|rc|\.post)([0-9]+)?)?$/ |
253 | | - branches: |
254 | | - ignore: /.*/ |
255 | | - - build-osx: |
256 | | - name: build-osx-<< matrix.python-version >> |
| 62 | + <<: *always-run |
| 63 | + |
| 64 | + - ocean/test-macos-from-dist: |
| 65 | + name: test-macos-py<< matrix.python-version >> |
| 66 | + requires: |
| 67 | + - ocean/build-sdist |
| 68 | + - ocean/build-macos-wheel |
257 | 69 | matrix: |
258 | 70 | parameters: |
259 | 71 | python-version: *python-versions |
| 72 | + xcode: ["13.2.0"] |
| 73 | + package: [<< pipeline.parameters.package >>] |
| 74 | + filters: |
| 75 | + <<: *always-run |
| 76 | + |
| 77 | + - ocean/pypi-deploy: |
| 78 | + requires: |
| 79 | + - ocean/test-linux-from-dist |
| 80 | + - ocean/test-macos-from-dist |
260 | 81 | filters: |
261 | 82 | tags: |
262 | | - only: /^[0-9]+(\.[0-9]+)*((\.dev|rc|\.post)([0-9]+)?)?$/ |
| 83 | + only: /^[0-9]+(\.[0-9]+)*((\.dev|rc)([0-9]+)?)?$/ |
263 | 84 | branches: |
264 | 85 | ignore: /.*/ |
0 commit comments