dist: xenial
language: python
cache:
- pip
- directories:
- $HOME/.pyenv_cache
python:
- 3.5
- 3.6
- 3.7
- 3.8
- 3.9
# Explicitly include other jobs/configurations not defined by the above settings
jobs:
include:
# For Python 3.8 do some extra configurations.
# Linux with both "icu" and "fastnumbers"
- python: 3.8
name: "Test with ICU and fastnumbers"
env: WITH_EXTRAS="fast,icu"
addons:
apt:
packages:
- libicu-dev
- language-pack-de
- language-pack-en
# For MacOS and Windows, only run one Python version without "icu" to test native locales
- language: sh
os: osx
osx_image: xcode11.2 # Python 3.7.4 running on macOS 10.14.4
name: "Test on MacOS"
env: TOXENV=py37
install:
- python3 -m pip install -U pip
- python3 -m pip install tox tox-travis codacy-coverage codecov
- language: sh
os: windows
name: "Test on Windows"
env: TOXENV=py38
before_install:
- choco install python --version=3.8.1
- export PATH="/c/Python38:/c/Python38/Scripts:$PATH"
# This "code quality" stage does static analysis and formatting checks.
# Platform- and Python-version-independent.
# No python version specified, will use the first listed in the python: list.
- stage: code quality
python: 3.6 # black requires >= 3.6
name: "Formatting"
install: pip install black
script: black --quiet --check --diff
- stage: code quality
name: "Static Analysis"
install: pip install flake8 flake8-import-order flake8-bugbear pep8-naming
script: flake8
- stage: code quality
name: "Package Validation"
install: pip install twine check-manifest
script:
- check-manifest --ignore ".github*,*.md,.coveragerc"
- python setup.py sdist
- twine check dist/*
# The "deploy" stage will actually upload the package to PyPI.
# For non-tags, we deploy to the test PyPI, for tags it's for real.
# Platform- and Python-version-independent.
# No python version specified, will use the first listed in the python: list.
- stage: deploy
name: "Deploy to PyPI (real on tagged commits, test otherwise)"
install: skip
script: skip
deploy:
- provider: pypi
server: https://test.pypi.org/legacy/
user: SethMMorton
password:
secure: "Va9uj9+6uDHMH6qcB3Z35MKDvqBDSLai0+cQN2rWjAZfhYq1H3B2TKb/cToN1dhy96t2Q7u7sXeWy9ptiJRACUOXeabL0+Ao3tFpRAgF7YBV9WUsoz9ux7waDoyMRrv1Oztbztg8sR6T3Sltz7Utd9Uf1TlYINO6D8poO7g2Cdo="
distributions: sdist --format=gztar bdist_wheel
skip_existing: true
on:
tags: false
repo: SethMMorton/natsort
branch: master
- provider: pypi
user: SethMMorton
password:
secure: "Va9uj9+6uDHMH6qcB3Z35MKDvqBDSLai0+cQN2rWjAZfhYq1H3B2TKb/cToN1dhy96t2Q7u7sXeWy9ptiJRACUOXeabL0+Ao3tFpRAgF7YBV9WUsoz9ux7waDoyMRrv1Oztbztg8sR6T3Sltz7Utd9Uf1TlYINO6D8poO7g2Cdo="
distributions: sdist --format=gztar bdist_wheel
skip_existing: true
on:
tags: true
repo: SethMMorton/natsort
branch: master
# The remainder of the code should be the same no matter the configuration/OS
install:
- python -m pip install -U pip
- python -m pip install tox tox-travis codacy-coverage codecov
script:
- tox
stages:
- code quality
- test
# Only deploy on master branch and from the main repository
- name: deploy
if: (branch = master OR tag IS present) AND repo = SethMMorton/natsort
after_success:
- coverage xml
- python-codacy-coverage -r coverage.xml
- codecov