|
| 1 | +version: 2 |
| 2 | +jobs: |
| 3 | + test-3.6: &full-test-template |
| 4 | + docker: |
| 5 | + - image: circleci/python:3.6-jessie |
| 6 | + |
| 7 | + working_directory: ~/repo |
| 8 | + |
| 9 | + steps: |
| 10 | + |
| 11 | + - checkout |
| 12 | + |
| 13 | + - restore_cache: |
| 14 | + keys: |
| 15 | + - v1-dependencies-{{ checksum "python/requirements.txt" }}-{{ .Environment.CIRCLE_JOB }} |
| 16 | + |
| 17 | + - run: |
| 18 | + name: create virtualenv |
| 19 | + command: | |
| 20 | + python -m virtualenv env |
| 21 | +
|
| 22 | + - run: &install-dependencies-template |
| 23 | + name: install dependencies |
| 24 | + command: | |
| 25 | + . env/bin/activate |
| 26 | + python --version |
| 27 | + pip install -r python/requirements.txt |
| 28 | +
|
| 29 | + - save_cache: |
| 30 | + paths: |
| 31 | + - ./env |
| 32 | + key: v1-dependencies-{{ checksum "python/requirements.txt" }}-{{ .Environment.CIRCLE_JOB }} |
| 33 | + |
| 34 | + - run: &install-package-template |
| 35 | + name: install package |
| 36 | + command: | |
| 37 | + . env/bin/activate |
| 38 | + python setup.py build_ext --inplace |
| 39 | + pip install . |
| 40 | + |
| 41 | + - run: &run-tests-template |
| 42 | + name: run unittests |
| 43 | + command: | |
| 44 | + . env/bin/activate |
| 45 | + python --version |
| 46 | + coverage run -m unittest discover |
| 47 | +
|
| 48 | + - store_artifacts: |
| 49 | + path: ./htmlcov |
| 50 | + |
| 51 | + - run: |
| 52 | + name: codecov |
| 53 | + command: | |
| 54 | + . env/bin/activate |
| 55 | + codecov |
| 56 | +
|
| 57 | + - run: &sdist-build-template |
| 58 | + name: build sdist |
| 59 | + command: | |
| 60 | + . env/bin/activate |
| 61 | + python setup.py sdist |
| 62 | +
|
| 63 | + - store_artifacts: |
| 64 | + path: ./dist |
| 65 | + |
| 66 | + - run: &sdist-install-template |
| 67 | + name: test installing from sdist without cython |
| 68 | + command: | |
| 69 | + python -m virtualenv env_sdist |
| 70 | + . env_sdist/bin/activate |
| 71 | + pip install dist/dwave-qbsolv-*.tar.gz |
| 72 | +
|
| 73 | + - run: &sdist-cython-install-template |
| 74 | + name: install sdist with cython |
| 75 | + command: | |
| 76 | + python -m virtualenv env_cython_sdist |
| 77 | + . env_cython_sdist/bin/activate |
| 78 | + pip install cython |
| 79 | + pip install dist/dwave-qbsolv-*.tar.gz |
| 80 | +
|
| 81 | + test-3.7: |
| 82 | + <<: *full-test-template |
| 83 | + docker: |
| 84 | + - image: circleci/python:3.7-stretch |
| 85 | + |
| 86 | + test-3.5: |
| 87 | + <<: *full-test-template |
| 88 | + docker: |
| 89 | + - image: circleci/python:3.5-jessie |
| 90 | + |
| 91 | + test-3.4: |
| 92 | + <<: *full-test-template |
| 93 | + docker: |
| 94 | + - image: circleci/python:3.4-jessie |
| 95 | + |
| 96 | + test-2.7: |
| 97 | + <<: *full-test-template |
| 98 | + docker: |
| 99 | + - image: circleci/python:2.7-jessie |
| 100 | + |
| 101 | + test-osx-3.7: &osx-tests-template |
| 102 | + macos: |
| 103 | + xcode: "9.4.1" |
| 104 | + environment: |
| 105 | + PYTHON: 3.7.0 |
| 106 | + # HOMEBREW_NO_AUTO_UPDATE: 1 # for 3.7 we need to update homebrew |
| 107 | + |
| 108 | + working_directory: ~/repo |
| 109 | + |
| 110 | + steps: |
| 111 | + - checkout |
| 112 | + |
| 113 | + - run: |
| 114 | + name: install pyenv |
| 115 | + command: | |
| 116 | + brew install pyenv |
| 117 | +
|
| 118 | + - restore_cache: |
| 119 | + keys: |
| 120 | + - pyenv-{{ .Environment.CIRCLE_JOB }} |
| 121 | + |
| 122 | + - run: |
| 123 | + name: install python |
| 124 | + command: | |
| 125 | + pyenv install $PYTHON -s |
| 126 | +
|
| 127 | + - save_cache: |
| 128 | + paths: |
| 129 | + - ~/.pyenv |
| 130 | + key: pyenv-{{ .Environment.CIRCLE_JOB }} |
| 131 | + |
| 132 | + - run: |
| 133 | + name: create virtualenv |
| 134 | + command: | |
| 135 | + eval "$(pyenv init -)" |
| 136 | + pyenv local $PYTHON |
| 137 | + python -m pip install virtualenv |
| 138 | + python -m virtualenv env |
| 139 | +
|
| 140 | + - restore_cache: |
| 141 | + keys: |
| 142 | + - v1-dependencies-{{ checksum "python/requirements.txt" }}-{{ .Environment.CIRCLE_JOB }} |
| 143 | + |
| 144 | + - run: &install-dependencies-template |
| 145 | + name: install dependencies |
| 146 | + command: | |
| 147 | + . env/bin/activate |
| 148 | + python --version |
| 149 | + pip install -r python/requirements.txt |
| 150 | +
|
| 151 | + - save_cache: |
| 152 | + paths: |
| 153 | + - ./env |
| 154 | + key: v1-dependencies-{{ checksum "python/requirements.txt" }}-{{ .Environment.CIRCLE_JOB }} |
| 155 | + |
| 156 | + - run: *install-package-template |
| 157 | + |
| 158 | + - run: *run-tests-template |
| 159 | + |
| 160 | + - run: *sdist-build-template |
| 161 | + |
| 162 | + - store_artifacts: |
| 163 | + path: ./dist |
| 164 | + |
| 165 | + - run: *sdist-install-template |
| 166 | + |
| 167 | + - run: *sdist-cython-install-template |
| 168 | + |
| 169 | + test-osx-3.6: |
| 170 | + <<: *osx-tests-template |
| 171 | + environment: |
| 172 | + PYTHON: 3.6.5 |
| 173 | + HOMEBREW_NO_AUTO_UPDATE: 1 |
| 174 | + |
| 175 | + test-osx-3.5: |
| 176 | + <<: *osx-tests-template |
| 177 | + environment: |
| 178 | + PYTHON: 3.5.5 |
| 179 | + HOMEBREW_NO_AUTO_UPDATE: 1 |
| 180 | + |
| 181 | + test-osx-3.4: |
| 182 | + <<: *osx-tests-template |
| 183 | + environment: |
| 184 | + PYTHON: 3.4.8 |
| 185 | + HOMEBREW_NO_AUTO_UPDATE: 1 |
| 186 | + |
| 187 | + test-osx-2.7: |
| 188 | + <<: *osx-tests-template |
| 189 | + environment: |
| 190 | + PYTHON: 2.7.15 |
| 191 | + HOMEBREW_NO_AUTO_UPDATE: 1 |
| 192 | + |
| 193 | +################################################################################################## |
| 194 | +# Deploy |
| 195 | +################################################################################################## |
| 196 | + |
| 197 | + build-manylinux-64: &manylinux-template |
| 198 | + docker: |
| 199 | + - image: quay.io/pypa/manylinux1_x86_64 |
| 200 | + |
| 201 | + working_directory: ~/repo |
| 202 | + |
| 203 | + steps: |
| 204 | + - checkout |
| 205 | + |
| 206 | + - run: |
| 207 | + name: build wheels |
| 208 | + command: | |
| 209 | + for PYBIN in /opt/python/*/bin; do |
| 210 | + "${PYBIN}/pip" install -r python/requirements.txt |
| 211 | + "${PYBIN}/pip" wheel . -w ./wheelhouse |
| 212 | + "${PYBIN}/python" setup.py sdist -d ./dist |
| 213 | + done |
| 214 | +
|
| 215 | + - run: |
| 216 | + name: bundle shared libraries into wheels |
| 217 | + command: | |
| 218 | + for whl in ./wheelhouse/dwave*qbsolv*.whl; do |
| 219 | + auditwheel repair "$whl" -w ./dist |
| 220 | + done |
| 221 | +
|
| 222 | + - store_artifacts: |
| 223 | + path: ./dist |
| 224 | + |
| 225 | + - run: &init-pypirc-template |
| 226 | + name: init .pypirc |
| 227 | + command: | |
| 228 | + echo -e "[pypi]" >> ~/.pypirc |
| 229 | + echo -e "username = $PYPI_USERNAME" >> ~/.pypirc |
| 230 | + echo -e "password = $PYPI_PASSWORD" >> ~/.pypirc |
| 231 | +
|
| 232 | + - run: |
| 233 | + name: create a virtualenv |
| 234 | + command: | |
| 235 | + pythons=(/opt/python/*/bin) |
| 236 | + python="${pythons[0]}" |
| 237 | + "$python/pip" install virtualenv |
| 238 | + "$python/python" -m virtualenv env |
| 239 | +
|
| 240 | + - run: &upload-template |
| 241 | + name: install twine and deploy |
| 242 | + command: | |
| 243 | + . env/bin/activate |
| 244 | + python -m pip install twine |
| 245 | + twine upload --skip-existing ./dist/* |
| 246 | +
|
| 247 | + build-manylinux-32: |
| 248 | + <<: *manylinux-template |
| 249 | + docker: |
| 250 | + - image: quay.io/pypa/manylinux1_i686 |
| 251 | + |
| 252 | + build-osx-3.7: &osx-build-template |
| 253 | + macos: |
| 254 | + xcode: "9.4.1" |
| 255 | + environment: |
| 256 | + PYTHON: 3.7.0 |
| 257 | + # HOMEBREW_NO_AUTO_UPDATE: 1 # for 3.7 we need to update homebrew |
| 258 | + |
| 259 | + working_directory: ~/repo |
| 260 | + |
| 261 | + steps: |
| 262 | + - checkout |
| 263 | + |
| 264 | + - run: |
| 265 | + name: install pyenv |
| 266 | + command: | |
| 267 | + brew install pyenv |
| 268 | +
|
| 269 | + - restore_cache: |
| 270 | + keys: |
| 271 | + - pyenv-{{ .Environment.CIRCLE_JOB }} |
| 272 | + |
| 273 | + - run: |
| 274 | + name: install python |
| 275 | + command: | |
| 276 | + pyenv install $PYTHON -s |
| 277 | +
|
| 278 | + - save_cache: |
| 279 | + paths: |
| 280 | + - ~/.pyenv |
| 281 | + key: pyenv-{{ .Environment.CIRCLE_JOB }} |
| 282 | + |
| 283 | + - run: |
| 284 | + name: create virtualenv |
| 285 | + command: | |
| 286 | + eval "$(pyenv init -)" |
| 287 | + pyenv local $PYTHON |
| 288 | + python -m pip install virtualenv |
| 289 | + python -m virtualenv env |
| 290 | +
|
| 291 | + - run: *install-dependencies-template |
| 292 | + |
| 293 | + - run: *install-package-template |
| 294 | + |
| 295 | + - run: |
| 296 | + name: create bdist_wheel |
| 297 | + command: | |
| 298 | + . env/bin/activate |
| 299 | + python setup.py bdist_wheel |
| 300 | +
|
| 301 | + - store_artifacts: |
| 302 | + path: ./dist |
| 303 | + |
| 304 | + - run: *init-pypirc-template |
| 305 | + |
| 306 | + - run: *upload-template |
| 307 | + |
| 308 | + build-osx-3.6: |
| 309 | + <<: *osx-build-template |
| 310 | + environment: |
| 311 | + PYTHON: 3.6.5 |
| 312 | + HOMEBREW_NO_AUTO_UPDATE: 1 |
| 313 | + |
| 314 | + build-osx-3.5: |
| 315 | + <<: *osx-build-template |
| 316 | + environment: |
| 317 | + PYTHON: 3.5.5 |
| 318 | + HOMEBREW_NO_AUTO_UPDATE: 1 |
| 319 | + |
| 320 | + build-osx-3.4: |
| 321 | + <<: *osx-build-template |
| 322 | + environment: |
| 323 | + PYTHON: 3.4.8 |
| 324 | + HOMEBREW_NO_AUTO_UPDATE: 1 |
| 325 | + |
| 326 | + build-osx-2.7: |
| 327 | + <<: *osx-build-template |
| 328 | + environment: |
| 329 | + PYTHON: 2.7.15 |
| 330 | + HOMEBREW_NO_AUTO_UPDATE: 1 |
| 331 | + |
| 332 | +workflows: |
| 333 | + version: 2 |
| 334 | + test: |
| 335 | + jobs: |
| 336 | + - test-3.7 |
| 337 | + - test-3.6 |
| 338 | + - test-3.5 |
| 339 | + - test-3.4 |
| 340 | + - test-2.7 |
| 341 | + - test-osx-3.7 |
| 342 | + - test-osx-3.6 |
| 343 | + - test-osx-3.5 |
| 344 | + - test-osx-3.4 |
| 345 | + - test-osx-2.7 |
| 346 | + |
| 347 | + deploy: |
| 348 | + jobs: |
| 349 | + - build-manylinux-64: |
| 350 | + filters: |
| 351 | + tags: |
| 352 | + only: /^[0-9]+(\.[0-9]+)*(\.dev([0-9]+)?)?$/ |
| 353 | + branches: |
| 354 | + ignore: /.*/ |
| 355 | + - build-manylinux-32: |
| 356 | + filters: |
| 357 | + tags: |
| 358 | + only: /^[0-9]+(\.[0-9]+)*(\.dev([0-9]+)?)?$/ |
| 359 | + branches: |
| 360 | + ignore: /.*/ |
| 361 | + - build-osx-3.7: |
| 362 | + filters: |
| 363 | + tags: |
| 364 | + only: /^[0-9]+(\.[0-9]+)*(\.dev([0-9]+)?)?$/ |
| 365 | + branches: |
| 366 | + ignore: /.*/ |
| 367 | + - build-osx-3.6: |
| 368 | + filters: |
| 369 | + tags: |
| 370 | + only: /^[0-9]+(\.[0-9]+)*(\.dev([0-9]+)?)?$/ |
| 371 | + branches: |
| 372 | + ignore: /.*/ |
| 373 | + - build-osx-3.5: |
| 374 | + filters: |
| 375 | + tags: |
| 376 | + only: /^[0-9]+(\.[0-9]+)*(\.dev([0-9]+)?)?$/ |
| 377 | + branches: |
| 378 | + ignore: /.*/ |
| 379 | + - build-osx-3.4: |
| 380 | + filters: |
| 381 | + tags: |
| 382 | + only: /^[0-9]+(\.[0-9]+)*(\.dev([0-9]+)?)?$/ |
| 383 | + branches: |
| 384 | + ignore: /.*/ |
| 385 | + - build-osx-2.7: |
| 386 | + filters: |
| 387 | + tags: |
| 388 | + only: /^[0-9]+(\.[0-9]+)*(\.dev([0-9]+)?)?$/ |
| 389 | + branches: |
| 390 | + ignore: /.*/ |
0 commit comments