11# For full coverage, we'd have to test all supported Python, MongoDB, and
22# PyMongo combinations. However, that would result in an overly long build
33# with a very large number of jobs, hence we only test a subset of all the
4- # combinations:
5- # * MongoDB v3.4 & the latest PyMongo v3.x is currently the "main" setup,
6- # tested against Python v2.7, v3.5, v3.6, v3.7, v3.8, PyPy and PyPy3.
7- # * Besides that, we test the lowest actively supported Python/MongoDB/PyMongo
8- # combination: MongoDB v3.4, PyMongo v3.4, Python v2.7.
9- # * MongoDB v3.6 is tested against Python v3.6, and PyMongo v3.6, v3.7, v3.8.
10- #
4+ # combinations.
5+ # * Python3.7, MongoDB v3.4 & the latest PyMongo v3.x is currently the "main" setup,
6+ # Other combinations are tested. See below for the details or check the travis jobs
7+
118# We should periodically check MongoDB Server versions supported by MongoDB
129# Inc., add newly released versions to the test matrix, and remove versions
1310# which have reached their End of Life. See:
1613#
1714# Reminder: Update README.rst if you change MongoDB versions we test.
1815
19-
2016language : python
17+ dist : xenial
2118python :
22- - 2.7
2319- 3.5
2420- 3.6
2521- 3.7
2622- 3.8
27- - pypy
2823- pypy3
2924
30- dist : xenial
31-
3225env :
3326 global :
3427 - MONGODB_3_4=3.4.17
3932 - PYMONGO_3_6=3.6
4033 - PYMONGO_3_9=3.9
4134 - PYMONGO_3_10=3.10
35+
36+ - MAIN_PYTHON_VERSION=3.7
4237 matrix :
4338 - MONGODB=${MONGODB_3_4} PYMONGO=${PYMONGO_3_10}
4439
@@ -47,8 +42,6 @@ matrix:
4742 fast_finish : true
4843
4944 include :
50- - python : 2.7
51- env : MONGODB=${MONGODB_3_4} PYMONGO=${PYMONGO_3_4}
5245 - python : 3.7
5346 env : MONGODB=${MONGODB_3_6} PYMONGO=${PYMONGO_3_6}
5447 - python : 3.7
@@ -66,29 +59,23 @@ install:
6659 # Install Python dependencies.
6760 - pip install --upgrade pip
6861 - pip install coveralls
69- - pip install flake8 flake8-import-order
70- - pip install tox # tox 3.11.0 has requirement virtualenv>=14.0.0
71- - pip install virtualenv # virtualenv>=14.0.0 has dropped Python 3.2 support (and pypy3 is based on py32)
62+ - pip install pre-commit
63+ - pip install tox
7264 # tox dryrun to setup the tox venv (we run a mock test).
7365 - tox -e $(echo py$TRAVIS_PYTHON_VERSION-mg$PYMONGO | tr -d . | sed -e 's/pypypy/pypy/') -- -a "-k=test_ci_placeholder"
74- # Install black for Python v3.7 only.
75- - if [[ $TRAVIS_PYTHON_VERSION == '3.7' ]]; then pip install black; fi
7666
7767before_script :
7868 - mkdir ${PWD}/mongodb-linux-x86_64-${MONGODB}/data
7969 - ${PWD}/mongodb-linux-x86_64-${MONGODB}/bin/mongod --dbpath ${PWD}/mongodb-linux-x86_64-${MONGODB}/data --logpath ${PWD}/mongodb-linux-x86_64-${MONGODB}/mongodb.log --fork
80- - if [[ $TRAVIS_PYTHON_VERSION == '2.7' ]]; then flake8 .; else echo "flake8 only runs on py27"; fi # Run flake8 for Python 2.7 only
81- - if [[ $TRAVIS_PYTHON_VERSION == '3.7' ]]; then black --check . ; else echo "black only runs on py37"; fi # Run black for Python 3.7 only
70+ # Run pre-commit hooks (black, flake8, etc) on entire codebase
71+ - if [[ $TRAVIS_PYTHON_VERSION == $MAIN_PYTHON_VERSION ]]; then pre-commit run -a ; else echo "pre-commit checks only runs on py37"; fi
8272 - mongo --eval 'db.version();' # Make sure mongo is awake
8373
8474script :
8575 - tox -e $(echo py$TRAVIS_PYTHON_VERSION-mg$PYMONGO | tr -d . | sed -e 's/pypypy/pypy/') -- -a "--cov=mongoengine"
8676
87- # For now only submit coveralls for Python v2.7. Python v3.x currently shows
88- # 0% coverage. That's caused by 'use_2to3', which builds the py3-compatible
89- # code in a separate dir and runs tests on that.
9077after_success :
91- - if [[ $TRAVIS_PYTHON_VERSION == '2.7' ]]; then coveralls --verbose; else echo "coveralls only sent for py27 "; fi
78+ - - if [[ $TRAVIS_PYTHON_VERSION == $MAIN_PYTHON_VERSION ]]; then coveralls --verbose; else echo "coveralls only sent for py37 "; fi
9279
9380notifications :
9481 irc : irc.freenode.org#mongoengine
@@ -110,11 +97,11 @@ deploy:
11097 distributions : " sdist bdist_wheel"
11198
11299 # Only deploy on tagged commits (aka GitHub releases) and only for the parent
113- # repo's builds running Python v2 .7 along with PyMongo v3.x and MongoDB v3.4.
100+ # repo's builds running Python v3 .7 along with PyMongo v3.x and MongoDB v3.4.
114101 # We run Travis against many different Python, PyMongo, and MongoDB versions
115102 # and we don't want the deploy to occur multiple times).
116103 on :
117104 tags : true
118105 repo : MongoEngine/mongoengine
119106 condition : ($PYMONGO = ${PYMONGO_3_10}) && ($MONGODB = ${MONGODB_3_4})
120- python : 2 .7
107+ python : 3 .7
0 commit comments