blob: da5bc67cf6ba64f7905c0a9cc2874724fce5e87b [file] [log] [blame]
# in the python/mypy repo, we only CI the master, release branches, tags and PRs
if: tag IS present OR type = pull_request OR ((branch = master OR branch =~ release-*) AND type = push) OR repo != python/mypy
language: python
# cache package wheels (1 cache per python version)
cache: pip
# also cache the directories where we set up our custom pythons in some builds
cache:
directories:
- $HOME/python-debug
# I ran into some issues with this but will investigate again later.
# - $HOME/.pyenv/versions
- $HOME/Library/Caches/pip
# newer python versions are available only on xenial (while some older only on trusty) Ubuntu distribution
dist: xenial
env:
TOXENV=py
EXTRA_ARGS="-n 2"
TEST_MYPYC=0
PYTHON_DEBUG_BUILD=0
jobs:
fast_finish: true
include:
- name: "run test suite with python 3.6 (compiled with mypyc)"
python: 3.6 # 3.6.3 pip 9.0.1
env:
- TOXENV=py
- EXTRA_ARGS="-n 2"
- TEST_MYPYC=1
- name: "run test suite with python 3.7"
python: 3.7
- name: "run test suite with python 3.8"
python: 3.8
- name: "run test suite with python 3.9 (compiled with mypyc)"
python: 3.9
env:
- TOXENV=py
- EXTRA_ARGS="-n 2"
- TEST_MYPYC=1
- name: "run test suite with python nightly"
python: nightly
- name: "run mypyc runtime tests with python 3.6 debug build"
language: generic
env:
- TOXENV=py36
- PYTHONVERSION=3.6.8
- PYTHON_DEBUG_BUILD=1
- EXTRA_ARGS="-n 2 mypyc/test/test_run.py mypyc/test/test_external.py"
- name: "run mypyc runtime tests with python 3.6 on OS X"
os: osx
osx_image: xcode8.3
language: generic
env:
- PYTHONVERSION=3.6.3
- EXTRA_ARGS="-n 2 mypyc/test/test_run.py mypyc/test/test_external.py"
- name: "type check our own code"
python: 3.7
env:
- TOXENV=type
- EXTRA_ARGS=
- name: "check code style with flake8"
python: 3.7
env:
- TOXENV=lint
- EXTRA_ARGS=
- name: "trigger a build of wheels"
python: 3.7
script: if [[ ($TRAVIS_BRANCH = "master" || $TRAVIS_BRANCH =~ release-*) && $TRAVIS_PULL_REQUEST = "false" ]]; then ./misc/trigger_wheel_build.sh; fi
- name: "check documentation build"
python: 3.7
env:
- TOXENV=docs
# Disabled because of some pip bug? See #6716
# - name: "check dev environment builds"
# python: 3.7
# env:
# - TOXENV=dev
# - EXTRA_ARGS=
allow_failures:
- python: nightly
install:
# pip 21.0 no longer works on Python 3.5
- pip install -U pip==20.3.4 setuptools
- pip install -U 'virtualenv<20'
- pip install -U tox==3.20.1
- python2 -m pip install --user -U typing
- tox --notest
# This is a big hack and only works because the layout of our directories
# means that tox picks up the mypy from the source directories instead of
# the version it installed into a venv. This is also *why* we need to do this,
# since if we arranged for tox to build with mypyc, pytest wouldn't use it.
- if [[ $TEST_MYPYC == 1 ]]; then pip install -r test-requirements.txt; CC=clang MYPYC_OPT_LEVEL=0 python3 setup.py --use-mypyc build_ext --inplace; fi
script:
- tox --skip-pkg-install -- $EXTRA_ARGS
# Getting our hands on a debug build or the right OS X build is
# annoying, unfortunately.
before_install: |
set -e
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
if [[ $PYTHON_DEBUG_BUILD == 1 ]]; then
PYTHONDIR=~/python-debug/python-$PYTHONVERSION
VENV=$PYTHONDIR/env
misc/build-debug-python.sh $PYTHONVERSION $PYTHONDIR $VENV
source $VENV/bin/activate
fi
elif [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
# Attempt to install, skipping if version already exists.
pyenv install $PYTHONVERSION -s
# Regenerate shims
pyenv rehash
# Manually set pyenv variables per https://pythonhosted.org/CodeChat/.travis.yml.html
export PYENV_VERSION=$PYTHONVERSION
export PATH="/Users/travis/.pyenv/shims:${PATH}"
fi