summaryrefslogtreecommitdiff
path: root/.travis.yml
blob: b5b9f5efb4c7f6cfbec27c1efe2b795b501bf4ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
dist: xenial
language: python
cache:
  - pip
  - directories:
    - $HOME/.pyenv_cache
python:
  - 3.5
  - 3.6
  - 3.7
  - 3.8

# Explicitly include other jobs/configurations not defined by the above settings
jobs:
  include:

    # For Python 3.7 do some extra configurations.
    # Linux with both "icu" and "fastnumbers"
    - python: 3.7
      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 Python 3.7 without "icu" to test native locales
    - language: sh
      os: osx
      name: "Test on MacOS"
      env: TOXENV=py37
      before_install:
        - export PYENV_VERSION="3.7.1"
        - export PYENV_VERSION_STRING="Python ${PYENV_VERSION}"
        - wget https://github.com/praekeltfoundation/travis-pyenv/releases/download/0.4.0/setup-pyenv.sh
        - source setup-pyenv.sh
    - language: sh
      os: windows
      name: "Test on Windows"
      env: TOXENV=py37
      before_install:
        - choco install python --version 3.7.1
        - export PATH="/c/Python37:/c/Python37/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 AND repo = SethMMorton/natsort

after_success:
- coverage xml
- python-codacy-coverage -r coverage.xml
- codecov