File: .travis.yml

package info (click to toggle)
backblaze-b2 1.3.8-4
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 1,288 kB
  • sloc: python: 10,230; sh: 149; makefile: 40
file content (304 lines) | stat: -rw-r--r-- 13,409 bytes parent folder | download | duplicates (3)
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
notifications:
  slack:
    secure: naix0bLa/50X1HIXwLtkUC/YH9Iurs18eVy/mhfrfD2YFd7QjUGRz24SQU2r0ev0Qh3CUaH9MJoAUbu4oaXGB1VXzZkV7OIGimZe4gcWJuzItnVhyrQJKpcpC7yafdl7uDA0wjWs2BYRHCJ3c35Gv4SmihuGVXUS3WFsL0i3VyXno8xPOfmyuUT7GZWW80uMnV6eOyhbPCBb17CchI8x7owdXVf3drxCrrjoP3oNbbpByTsDC+hnCmVQbhkZAqS63gZRj5LT6gNh4ZA/qenaGkhzfHFRSUW1+H16ZzYcSSl0PfAQBQYrc7agUjI987PBHdOv6BJS+pKmZ0MvaDwbnzhHZZdb8LXqM5K0zAhPiZMPL2MTq7+eNOBdRuTlbWs3OZfbY1cnewSpMmUGfwrIjVnLtvfhfJXVaFbpIfvNc6eafgmHas23A05f4Gk/IcRLvqICw+GQg76ADUpWubQal7gECTGbeivOdRLnQcQYWCg/a5VR5B+4ELENmWLRD7IQgo6rJKpPiRdGRc0C0E9Mqt3w7w+9NiDnjTbSu8Q6ARBLXjAu+jSbY1VK0iPq6k1Wj8U5EgQF/xVLCEtKDRW1bdllwWNgi2yPo1CrkgKmJj6XPU3Zc744NR85uC+PxAjkIIbm90joevPmUQGwkpAgVX2pxCjVAX6ynQ79TFfdd/Y=

#dist: trusty  # on 2016-12-13 pypy builds were broken on trusty, so we'll stick to stable for now
language: python

python:
  - 2.6
  - 2.7
  - 3.4
  - 3.5
  - 3.6
  - nightly
  # stock versions of pypy provided by Travis CI don't work with cryptography 1.0
  #- pypy
  #- pypy3

branches:
  # https://github.com/travis-ci/travis-ci/issues/1147#issuecomment-160820262
  # this reduces workload on Travis if there are many pushes in a short time.
  # It does not have a drawback if:
  # - pull requests are used for review
  # - branches that we care about (not work-in-progress) are listed below
  only:
    - master

matrix:
  allow_failures:
    - python: pypy3  # https://github.com/pyca/cryptography/issues/2880
    - python: nightly  # on 2018-02-14 it was found failing installation with ValueError: bad marshal data (unknown type code)
  include:
    # Source Code Analysis is slow.  We just run it once on
    # Python 2 and once on Python 3.
    - python: 2.7
      env: MODE=SCA
    - python: 3.5
      env: MODE=SCA

    # Travis CI doesn't support OSX python builds officially,
    # but that won't stop us...
    # ... or maybe it will. It's now getting this error:
    #    Could not fetch URL https://pypi.python.org/simple/arrow/: There was a problem confirming the ssl certificate: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:590)
    # which stackoverflow says means the python interpreter needs to be upgraded:
    #    https://stackoverflow.com/questions/16370583/pip-issue-installing-almost-any-library
#    - python: 2.7
#      os: osx
#      language: generic
#      env: OS_X_PYTHON_VERSION=python

# See github issue #311:
#    - python: 3.5
#      os: osx
#      language: generic
#      env: OS_X_PYTHON_VERSION=python3

    # jython
    # It looks like Jython has a similar TLS problem to the Mac:
    #   An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform.
#    - python: 2.7
#      env: JYTHON=true

    # pypy
    - python: pypy
      env: PYPY_VERSION=pypy-4.0.1
    - python: pypy
      env: PYPY_VERSION=pypy-5.1
    - python: pypy3
      env: PYPY_VERSION=pypy3-2.4.0

    # test_raw_api takes too long to be run in every cell of the build matrix
    - python: 2.7
      env: MODE=TEST_RAW_API
    - python: 3.6
      env: MODE=TEST_RAW_API

    # coverage
    - python: 3.5
      env: MODE=coverage

cache:
  - pip
  - directories:
    - $HOME/.eggs
    # custom pypy versions
    - $HOME/.pyenv
    # jython
    - $HOME/.virtualenvs/jython
    - $HOME/jython
    - $HOME/jython-pip
    # OS X
    - $HOME/.virtualenvs/osx-python
    - $HOME/.virtualenvs/osx-python3
    #- /usr/local/Cellar/python  # see comment in the install script
    #- /usr/local/Cellar/python3
before_install:
  - uname -a
  - if [[ "$TRAVIS_OS_NAME" != "osx" ]]; then lsb_release -a; fi
  - |
        # install python on OS X
        if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
            if [ -n 'ALWAYS TRUE!' -o ! -d "/usr/local/Cellar/$OS_X_PYTHON_VERSION" ]; then
                # unfortunately caching /usr/local/Cellar/$OS_X_PYTHON_VERSION is not enough.
                # brew does some kind of side effect which registers the binary in the system
                # or something. The resulting error error is:
                #
                # dyld: Library not loaded: @executable_path/../.Python
                #
                # Due to lack of information on the web as well as the lack of appropriate
                # environment it is very hard to debug out how to properly cache the python
                # installation on OS X.
                #
                # Therefore caching is temporarily disabled until someone figures it out.
                # Typically brew update and installation of python takes 3 to 4 minutes.
                travis_retry brew update
                travis_retry brew install "$OS_X_PYTHON_VERSION"
            else
                echo 'skip install'
            fi
            if [ ! -e "$HOME/.virtualenvs/osx-$OS_X_PYTHON_VERSION/bin/activate" ]; then
                virtualenv -p "$OS_X_PYTHON_VERSION" "$HOME/.virtualenvs/osx-$OS_X_PYTHON_VERSION"
            else
                echo 'skip virtualenv'
            fi
            source "$HOME/.virtualenvs/osx-$OS_X_PYTHON_VERSION/bin/activate"
        else
            echo skip
        fi
  - |
        # get jython
        if [ -n "$JYTHON" ]; then
            # When the system python changes version, the symlink to it inside jython
            # breaks, and jython stops working.  If that happens, remove the installed
            # version and start over.
            if [ -d "$HOME/jython" ]; then
                if "$HOME/jython/bin/jython" --version; then
                    echo jython version works
                else
                    echo jython is broken.  removing it.
                    rm -rf "$HOME/jython"
                fi
            fi

            # Install jython if it's not there.
            if [ ! -d "$HOME/jython" ]; then
                travis_retry wget http://search.maven.org/remotecontent?filepath=org/python/jython-installer/2.7.1b3/jython-installer-2.7.1b3.jar -O jython-installer-2.7.1b3.jar
                java -jar jython-installer-2.7.1b3.jar --silent --directory "$HOME/jython"
            else
                echo skip install jython
            fi

            # install a custom version of pip, as standard pip doesn't work on jython (https://github.com/jythontools/pip/commits/develop)
            if [ ! -d "$HOME/jython-pip" ]; then
                mkdir ~/jython-pip
            else
                echo skip mkdir jython-pip
            fi
            if [ ! -f ~/jython-pip/pip-7.1.2-py2.py3-none-any.whl ]; then
                travis_retry wget https://pypi.python.org/packages/py2.py3/p/pip/pip-7.1.2-py2.py3-none-any.whl -O ~/jython-pip/pip-7.1.2-py2.py3-none-any.whl
            else
                echo skip download pip
            fi

            # The virtualenv is another place where the cache can hold broken symlinks.
            # If the virtualenv doesn't work, remove it.
            export JAVA_OPTS="-Xms128m -Xmx1024m"
            if [ -f "$HOME/.virtualenvs/jython/bin/activate" ]; then
                source "$HOME/.virtualenvs/jython/bin/activate"
                if python --version; then
                    echo jython virtualenv works
                else
                    echo jython virtualenv broken.  removing it.
                    rm -rf "$HOME/.virtualenvs/jython"
                fi
                deactivate
            fi

            # create jython virtualenv
            if [ ! -f "$HOME/.virtualenvs/jython/bin/activate" ]; then
                virtualenv --system-site-packages --extra-search-dir="$HOME/jython-pip" -p "$HOME/jython/bin/jython" "$HOME/.virtualenvs/jython"
            else
                echo skip virtualenv
            fi

            # Activate the virtualenv
            source "$HOME/.virtualenvs/jython/bin/activate"
        else
            echo skip setting up jython
        fi
  - |
        # upgrade pypy (to a version that works with Cryptography 1.0)
        if [ -z "$PYPY_VERSION" ]; then
            echo 'this is a build of native Travis pypy/pypy3, not the upgraded one'
        elif [[ "$TRAVIS_PYTHON_VERSION" == "pypy" ]] || [[ "$TRAVIS_PYTHON_VERSION" == "pypy3" ]]; then
            export PYENV_ROOT="$HOME/.pyenv"
            if [ -f "$PYENV_ROOT/bin/pyenv" ]; then
                pushd "$PYENV_ROOT" && git pull && popd
            else
                rm -rf "$PYENV_ROOT" && git clone --depth 1 https://github.com/yyuu/pyenv.git "$PYENV_ROOT"
            fi
            echo "PYPY_VERSION=$PYPY_VERSION"
            travis_retry "$PYENV_ROOT/bin/pyenv" install --skip-existing "$PYPY_VERSION"
            if [ ! -e "$HOME/.virtualenvs/$PYPY_VERSION/bin/activate" ]; then
                virtualenv -p "$PYENV_ROOT/versions/$PYPY_VERSION/bin/python" "$HOME/.virtualenvs/$PYPY_VERSION"
            fi
            source "$HOME/.virtualenvs/$PYPY_VERSION/bin/activate"
        else
            echo skip upgrade pypy
        fi
  - virtualenv --version
  - python --version
  - |
        # upgrade setuptools if it's too old to support PEP 508
        # PEP 508 support is needed for python version dependent dependencies in requirements.txt/setup.py (e.g. futures)
        pip install "setuptools>=20.2"

install:
  - pip install -r requirements.txt
  - pip install -r requirements-setup.txt
  - pip install -r requirements-test.txt

  - |
        # coverage has additional requirements
        if [ "$MODE" == 'coverage' ]; then
            travis_retry pip install coverage
            if [ -n "$CODACY_PROJECT_TOKEN" ]; then travis_retry pip install codacy-coverage; fi
            if [ -n "$COVERALLS_REPO_TOKEN" ]; then travis_retry pip install coveralls; fi
            if [ -n "$CODECOV_TOKEN" ]; then travis_retry wget https://codecov.io/bash -O codecov.sh && chmod +x codecov.sh; fi
        fi

before_script:
  - pip freeze
  # Before runing the test case, we need to make jython run some code as in first run it can put something on stdout
  - if [ -n "$JYTHON" ]; then python -c "print ''"; else echo skip; fi

script:
  - |
        # nosetests
        if [ -z "$MODE" ]; then
            python setup.py nosetests
        elif [ "$MODE" == 'coverage' ]; then
            python setup.py nosetests --with-coverage --cover-xml --cover-package "$(python setup.py --name)" --cover-branches
        else
            echo skip
        fi
  - |
        # yapf
        if [ "$MODE" == 'SCA' ]; then
            if [ -n "$TRAVIS_COMMIT_RANGE" ]; then
                echo "using commit range: $TRAVIS_COMMIT_RANGE"
                git diff --name-only "$TRAVIS_COMMIT_RANGE" | grep '\.py$' | xargs yapf --diff setup.py || exit
            else
                yapf --diff --recursive . || exit
            fi
        else
            echo skip
        fi
  - if [ "$MODE" == 'SCA' ]; then pyflakes . || exit; else echo skip; fi

  # isort doesn't get along with yapf. Hopefully we'll figure it out and re-enable in the future.
  # - if [ "$MODE" == 'SCA' ]; then isort --order-by-type --recursive --line-width 100 --diff --verbose --check-only || exit; else echo skip; fi

  # home-made bad code detectors
  - if [ "$MODE" == 'SCA' ]; then egrep -r '^ *class [^\(]+(\(\))?:' . && exit 1 || true; else echo skip; fi  # old-style class detector
  - if [ "$MODE" == 'SCA' ]; then grep -r 'isinstance\(' . && exit 1 || true; else echo skip; fi  # very non-pythonic
  - if [ "$MODE" == 'SCA' ]; then egrep -r '\b(all|any)\(\[' . && exit 1 || true; else echo skip; fi  # a list is unnecesarily allocated where a generator expression could have been used
  - if [ "$MODE" == 'SCA' ]; then grep -r '\_\_metaclass\_\_' . && exit 1 || true; else echo skip; fi  # bad metaclass declaration: use six
  - if [ "$MODE" == 'SCA' ]; then grep -P -r '^ *logger = (?!logging\.getLogger\(__name__\)$)' . | grep -v '.eggs/nose-' && exit 1 || true; else echo skip; fi  # bad logger definition: use `logger = logging.getLogger(__name__)`. See the magic logging metaclass.
  - |
        if [ "$MODE" == 'SCA' ]; then
            missing="$(
                (
                    grep -l "Copyright $(date +%Y).*\\. All Rights Reserved." $(git ls-files | grep .py)
                    git ls-files | grep .py
                ) | sort | uniq -c | sort -n | awk '$1 == 1 && $2 !~ ".*/__init__.py"'
            )"
            if [ -n "$missing" ]; then
                echo 'license is missing from:' >&2
                echo "$missing" >&2
                return 1
            fi
        else
            echo skip
        fi

  # package installation
  - |
        if [ "$MODE" == 'SCA' ]; then
            echo skip
        else
            if [ -n "$OS_X_PYTHON_VERSION" ]; then
                # install action fails on osx for unknown reason
                python setup.py develop
            else
                python setup.py install
            fi
        fi
  # custom things specific to b2 CLI
  - if [ -n "$TEST_ACCOUNT_ID" -a "$MODE" == "TEST_RAW_API" ]; then python -m b2.__main__ test_raw_api; else echo skip; fi

after_success:
  - if [ "$MODE" == 'coverage' -a -n "$CODACY_PROJECT_TOKEN" ]; then travis_retry python-codacy-coverage -r coverage.xml; else echo skip; fi
  - if [ "$MODE" == 'coverage' -a -n "$COVERALLS_REPO_TOKEN" ]; then travis_retry coveralls; else echo skip; fi
  - if [ "$MODE" == 'coverage' -a -n "$CODECOV_TOKEN" ]; then travis_retry ./codecov.sh -X gcov -X coveragepy; else echo skip; fi