language: 'python' # Default version used for jobs that don't override it. python: '3.7' # TODO: Update to 'bionic' once available. # https://travis-ci.community/t/ubuntu-18-04-1-lts-bionic-beaver/1270 dist: 'xenial' env: global: - 'LINT_SRC="$(ls bidict/*.py tests/*.py tests/*/*.py setup.py)"' before_install: # Ensure we have the required versions of Python and Pip. - 'echo "TRAVIS_PULL_REQUEST_SHA: $TRAVIS_PULL_REQUEST_SHA"' - 'echo "TRAVIS_COMMIT: $TRAVIS_COMMIT"' - 'git --no-pager log -n2' # Travis does a shallow (--depth=50) clone by default. # Clone the full history as requested by setuptools_scm. - 'travis_retry git fetch --unshallow' # Install Python on macOS since https://github.com/travis-ci/travis-ci/issues/2312 is WONTFIXed. - | if [[ $TRAVIS_OS_NAME == osx ]]; then declare -r pyver="${TASK##*-}" # strip all chars up to and including the last - declare -r python="python$pyver" echo "TASK=$TASK -> pyver=$pyver python=$python" if ! type "$python"; then export HOMEBREW_NO_AUTO_UPDATE=1 brew tap minrk/homebrew-python-frameworks brew cask install "python-framework-${pyver/./}" type "$python" || exit 1 fi type python "$python" --version travis_retry curl https://bootstrap.pypa.io/get-pip.py | "$python" "$python" -m pip install virtualenv "$python" -m virtualenv ~/travis-env source ~/travis-env/bin/activate type python fi - 'python --version' # https://github.com/python-trio/trio/issues/487#issuecomment-377931587 - 'echo "Installing latest pip..."' - 'travis_retry curl https://bootstrap.pypa.io/get-pip.py | python' - 'pip --version' install: # Install our test dependencies. - 'travis_retry pip install -U --upgrade-strategy=eager .[test$([[ $COVERAGE ]] && echo ",coverage")]' - 'pip list' script: # Run the test suite. # See tests/hypothesis/_setup_hypothesis.py - 'export HYPOTHESIS_PROFILE=$([[ $TRAVIS_EVENT_TYPE == cron ]] && echo more-examples)' - 'export PYTEST_ADDOPTS=$([[ $COVERAGE ]] && echo "--cov=bidict --cov-config=.coveragerc")' - './run_tests.py' after_script: - | if [[ $COVERAGE ]]; then echo "Installing codecov..." travis_retry pip install codecov || exit 1 echo echo "Uploading coverage report to codecov..." travis_retry codecov fi matrix: allow_failures: - env: 'ALLOW_FAIL=1' fast_finish: true include: # Each job below performs a single task. Setting a per-job "TASK" env var # causes Travis to clearly show each job's task in the web UI. # "test*" tasks run the test suite with various Python versions. # Travis runs jobs in the order defined below -> order jobs by priority. ## Test suite on Linux with latest CPython and PyPy 2 and 3 -> enable coverage. - python: '3.7' env: 'TASK=test-linux-cpython-3.7 COVERAGE=1' - python: '2.7' env: 'TASK=test-linux-cpython-2.7 COVERAGE=1' - python: 'pypy3.5-6.0' env: 'TASK=test-linux-pypy-3.5-6.0 COVERAGE=1' - python: 'pypy2.7-6.0' env: 'TASK=test-linux-pypy-2.7-6.0 COVERAGE=1' ## Test suite on Mac with latest CPython 2 and 3. - python: '2.7' env: 'TASK=test-mac-cpython-2.7' os: 'osx' language: 'generic' - python: '3.7' env: 'TASK=test-mac-cpython-3.7' os: 'osx' language: 'generic' ## Linting, static analysis, code style. - env: 'TASK=flake8' before_install: 'skip' install: 'travis_retry pip install "flake8<3.7"' # keep in sync with the version in setup.py script: 'flake8 $LINT_SRC' - env: 'TASK=pylint' before_install: 'skip' install: 'travis_retry pip install "pylint<2.3" "hypothesis<4" "pytest<5"' # keep in sync with the versions in setup.py script: 'pylint --jobs=0 $LINT_SRC' - env: 'TASK=pydocstyle' before_install: 'skip' install: 'travis_retry pip install "pydocstyle<2.2"' # keep in sync with the version in setup.py script: 'pydocstyle $LINT_SRC' ## Misc. - env: 'TASK=docs-build' before_install: 'skip' install: 'travis_retry pip install "Sphinx<2"' # keep in sync with the version in setup.py script: './build-docs.sh' - env: 'TASK=test-with-optimization-flag' # make sure there are no relied-on side effects in assert statements before_install: 'skip' install: 'skip' script: 'python -O -m doctest -o IGNORE_EXCEPTION_DETAIL -o ELLIPSIS tests/*.txt' ## Remaining CPython versions on Linux. - python: '3.6' env: 'TASK=test-linux-cpython-3.6' - python: '3.5' env: 'TASK=test-linux-cpython-3.5' - python: '3.4' env: 'TASK=test-linux-cpython-3.4' ## Misc. - env: 'TASK=docs-linkcheck ALLOW_FAIL=1' before_install: 'skip' install: 'travis_retry pip install "Sphinx<2"' # keep in sync with the version in setup.py script: '(cd docs && travis_retry make linkcheck)' - python: '3.8-dev' env: 'TASK=test-linux-cpython-3.8-dev ALLOW_FAIL=1' - stage: 'deploy-if-tag' env: 'TASK=deploy-if-tag ALLOW_FAIL=1' before_install: 'skip' install: 'skip' script: 'skip' deploy: - provider: 'pypi' user: 'jab' password: secure: 'B9LLgXkTbtjeC/IbH4wh9PEBzvKEAuYo3EBNW5f1xuLqVqtsysIyxJa5ar/FQ4qwUCBwZPFAXFurN3lLzRhb2Tc04YQ0GYVv6f8lkzwrjoWau4iB9Qt/nnvdRa7KryEJvtenHCAnwoEUaADCjkZjwo6fIA0hEOLB6/AYfhfgXYA=' on: tags: true # Does this deploy all tags to PyPI, not just release tags? # https://docs.travis-ci.com/user/deployment/pypi/ doesn't say. distributions: 'sdist bdist_wheel' before_cache: - 'rm -rf "$HOME"/.cache/pip/log' cache: directories: - '"$HOME"/.cache/pip' - '"$HOME"/.hypothesis' notifications: webhooks: urls: - 'https://webhooks.gitter.im/e/bf64fb45a633c0935b9b' email: recipients: 'jab@math.brown.edu'