diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 00000000..344db01b --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,235 @@ +version: 2 + +jobs: + + # + # linux + # + + test-3.9: &test-linux-template + docker: + - image: circleci/python:3.9 + + steps: + - checkout + + - restore_cache: &restore-cache-env + key: v1-dependencies-{{ checksum "requirements.txt" }}-{{ checksum "tests/requirements.txt" }}-{{ checksum "docs/requirements.txt" }}-{{ .Environment.CIRCLE_JOB }} + + - run: &create-virtualenv + name: Create virtual environment + command: | + python -m venv env + + - run: &install-requirements + name: Install requirements + command: | + . env/bin/activate + pip install -r requirements.txt -r tests/requirements.txt -r docs/requirements.txt + pip install wheel twine + + - save_cache: &save-cache-env + key: v1-dependencies-{{ checksum "requirements.txt" }}-{{ checksum "tests/requirements.txt" }}-{{ checksum "docs/requirements.txt" }}-{{ .Environment.CIRCLE_JOB }} + paths: + - env + + - run: &build-package + name: Build package + command: env/bin/python setup.py sdist bdist_wheel + + - run: &install-package + name: Install requirements + command: env/bin/pip install . + + - run: &run-python-tests + name: Run Python tests + command: env/bin/coverage run -m unittest discover + + - run: &upload-python-code-coverage + name: Upload code coverage + command: env/bin/coveralls + + test-3.8: + <<: *test-linux-template + docker: + - image: circleci/python:3.8 + + test-3.7: + <<: *test-linux-template + docker: + - image: circleci/python:3.7 + + test-3.6: + <<: *test-linux-template + docker: + - image: circleci/python:3.6 + + test-3.5: + <<: *test-linux-template + docker: + - image: circleci/python:3.5 + + # + # macos + # + + test-osx-3.9: &test-osx-template + macos: + xcode: "12.1.0" + + environment: + PYTHON: 3.9.0 + + steps: + - checkout + + # install $PYTHON and cache it + - run: &brew-install-pyenv + name: Install pyenv + command: HOMEBREW_NO_AUTO_UPDATE=1 brew install pyenv + + - restore_cache: &restore-cache-pyenv + keys: + - v1-pyenv-{{ .Environment.CIRCLE_JOB }}-xcode-12.1.0 + + - run: &pyenv-install-python + name: Install python + command: pyenv install $PYTHON -s + + - run: &pyenv-set-system-python + name: Set system python + command: | + pyenv global $PYTHON + echo 'eval "$(pyenv init -)"' >> ~/.bash_profile + + - save_cache: &save-cache-pyenv + key: v1-pyenv-{{ .Environment.CIRCLE_JOB }}-xcode-12.1.0 + paths: + - ~/.pyenv + + # install dependencies and cache them + - restore_cache: *restore-cache-env + + - run: *create-virtualenv + + - run: *install-requirements + + - save_cache: *save-cache-env + + - run: *install-package + + - run: *run-python-tests + + test-osx-3.8: + <<: *test-osx-template + environment: + PYTHON: 3.8.1 + + test-osx-3.7: + <<: *test-osx-template + environment: + PYTHON: 3.7.4 + + test-osx-3.6: + <<: *test-osx-template + environment: + PYTHON: 3.6.5 + + test-osx-3.5: + <<: *test-osx-template + environment: + PYTHON: 3.5.5 + + # + # docs + # + + test-docs: + docker: + - image: circleci/python:3.7 + + steps: + - checkout + + - restore_cache: *restore-cache-env + + - run: *create-virtualenv + + - run: *install-requirements + + - save_cache: *save-cache-env + + - run: *install-package + + - run: &build-docs + name: Build docs + command: | + . env/bin/activate + make -C docs/ html + + - store_artifacts: &save-docs + path: ./docs/build/html + + - run: &run-doctest + name: Test docs + command: | + . env/bin/activate + make -C docs/ doctest + + # + # deploy + # + + pypi-deploy: + <<: *test-linux-template + steps: + - checkout + + - restore_cache: *restore-cache-env + + - run: *create-virtualenv + + - run: *install-requirements + + - save_cache: *save-cache-env + + - run: *build-package + + - store_artifacts: + path: ./dist + + - run: + name: Upload package to PyPI + command: env/bin/twine upload -u "$PYPI_USERNAME" -p "$PYPI_PASSWORD" --skip-existing ./dist/* + +workflows: + version: 2 + test: + jobs: + - test-3.9 + - test-3.8 + - test-3.7 + - test-3.6 + - test-3.5 + - test-osx-3.9 + - test-osx-3.8 + - test-osx-3.7 + - test-osx-3.6 + - test-osx-3.5 + + deploy: + jobs: + - test-3.8: + filters: + tags: + only: /^[0-9]+(\.[0-9]+)*(\.dev([0-9]+)?)?$/ + branches: + ignore: /.*/ + - pypi-deploy: + requires: + - test-3.8 + filters: + tags: + only: /^[0-9]+(\.[0-9]+)*(\.dev([0-9]+)?)?$/ + branches: + ignore: /.*/ diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 50331362..00000000 --- a/.travis.yml +++ /dev/null @@ -1,65 +0,0 @@ -dist: xenial - -language: python - -matrix: - include: - - os: linux - sudo: required - python: "3.9" - env: TOXENV=py39 - deploy: - - - os: linux - sudo: required - python: "3.8" - env: TOXENV=py38 - deploy: - - - os: linux - sudo: required - python: "3.7" - env: TOXENV=py37 - - - os: linux - sudo: required - python: "3.6" - env: TOXENV=py36 - deploy: - - - os: linux - sudo: required - python: "3.5" - env: TOXENV=py35 - deploy: - - - os: osx - osx_image: xcode10.2 # Python 3.7.2 running on macOS 10.14.3 - language: generic - env: TOXENV=py37 - before_install: - - pip3 install virtualenv - - virtualenv env -p python3 - - source env/bin/activate - deploy: - -install: - - pip install --upgrade setuptools - - pip install -r requirements.txt -r tests/requirements.txt - - pip install . - -script: - - coverage run -m unittest discover - -after_success: - - coveralls - -deploy: - provider: pypi - user: "dwtools" - password: - secure: "XUs9pXWe+x7YN0lGC1xlgvGODxIhu2CRAZyWWqep+GZCJVGXwxYTXYpPsCOY7N1zIx+WD2zYTvzAMmU5eB7DBgrZYxsi+ck06KizL0Vcxnzyg3oU0Uk5uSA0KH2nI3+BbhA7lfYbLjiWuO3ALGqArpnMC5xrCwt0WUuOeCmaT8hNifADxhTmdadyhA3qWjehsaokeyeu8xHT02pEJ3vBJWew6YSOjkz4oXvq9x43VlwINRVPt96JkRj1z0CF0Oj2LBgZ+8B4zbzPswBsN23bxtbAzQc+KvMzT4lDjdyZdADnOAuYwDQoOU5CtNA7hLLH4OpzZQeqJfT3yTD4wLwqn2EuB7e3Vcesvx8qMm2iEHTc0RmIq3lZAVMqlbizNTgl3qVayExvwNmRV7AGYtFU1q2WNJuQFwBl4A8KJct68pYx/umyymrVKNlli1VbahjVUwqWYKhddUe1nXTtfN7I6OKTuC4m/j/yuzqn1qdPv1cJiBjj+ZnOe5oym8rbtWx5rNNsD+SQrng7gMwdkw85tCYlWRZvVQ8CpnoDqAKkKjFGIhm6Drzx6uVaMFDgYF4VGvIK///sw56upfmM0eYR0bzwWamQ80c3Xw/MqXKF2Giq1clYMyd5mivrv3V2iosPBEd6u6i3IUEdFRx2GYsMVbdto5RlvIBvsJJfcDglLxA=" - distributions: "sdist bdist_wheel" - skip_existing: true - on: - tags: true