|
1 | | -# Base language is Python, but that does not work on macOs & Windows builds |
2 | | -language: python |
| 1 | +# Based on https://docs.travis-ci.com/user/languages/python/#running-python-tests-on-multiple-operating-systems |
| 2 | +language: python # this works for Linux but is an error on macOS or Windows |
3 | 3 |
|
4 | | -matrix: |
| 4 | +jobs: |
5 | 5 | include: |
6 | | - - name: "Python 2.7: Windows" |
7 | | - os: windows |
8 | | - language: shell |
9 | | - before_install: |
10 | | - - choco install python2 vcredist2008 |
11 | | - - choco install --ignore-dependencies vcpython27 |
12 | | - env: |
13 | | - - PATH=/c/Python27:/c/Python27/Scripts:$PATH |
14 | | - - TRAVIS_PYTHON_VERSION=2.7 |
15 | | - - name: "Python 3.7: Windows" |
16 | | - os: windows |
17 | | - language: shell |
18 | | - before_install: |
19 | | - - choco install python3 --version=3.7.4 |
20 | | - env: |
21 | | - - PATH=/c/Python37:/c/Python37/Scripts:$PATH |
22 | | - - TRAVIS_PYTHON_VERSION=3.7 |
23 | | - - name: "Python 3.7: Xenial Linux" |
24 | | - python: 3.7 |
25 | | - dist: xenial |
26 | | - # Pytest doctests are only enabled for Linux |
27 | | - # because they are integration tests and need ROS running on Docker |
| 6 | + # Latest python releases on all 3 OSes |
| 7 | + - name: "Python 3.8 on Xenial Linux" |
| 8 | + python: 3.8 # this works for Linux but is ignored on macOS or Windows |
28 | 9 | env: |
29 | | - - TRAVIS_PYTHON_VERSION=3.7 |
30 | | - - PYTEST_ADDOPTS=--doctest-modules |
| 10 | + - TRAVIS_RUN_LINTER=true |
| 11 | + - TRAVIS_RUN_INTEGRATION_TESTS=true |
31 | 12 | - TRAVIS_GENERATE_DOCS=true |
| 13 | + - TRAVIS_PYTHON_IMPLEMENTATION="cpython" |
32 | 14 | services: docker |
33 | | - before_install: |
| 15 | + before_script: |
34 | 16 | - docker run -p 19997:19997 --name vrep_rfl -d gramaziokohler/vrep-rfl |
35 | 17 | - docker-compose -f "docs/backends/files/ur5-demo/docker-compose.yml" up -d --build |
36 | 18 | - docker ps -a |
37 | 19 | after_script: |
38 | 20 | - docker-compose -f "docs/backends/files/ur5-demo/docker-compose.yml" down |
39 | 21 | - docker rm -f vrep_rfl |
40 | | - - name: "Python 3.7: macOS" |
| 22 | + - name: "Python 3.7 on macOS" |
41 | 23 | os: osx |
42 | | - osx_image: xcode11.2 |
| 24 | + osx_image: xcode11.2 # Python 3.7.4 running on macOS 10.14.4 |
| 25 | + language: shell # 'language: python' is an error on Travis CI macOS |
| 26 | + env: |
| 27 | + - TRAVIS_PYTHON_IMPLEMENTATION="cpython" |
| 28 | + - name: "Python 3.8 on Windows" |
| 29 | + os: windows # Windows 10.0.17134 N/A Build 17134 |
| 30 | + language: shell # 'language: python' is an error on Travis CI Windows |
| 31 | + before_install: |
| 32 | + - choco install python --version=3.8.0 |
| 33 | + - pip3 install --user --upgrade pip |
| 34 | + - pip3 install cython --install-option="--no-cython-compile" |
| 35 | + env: |
| 36 | + - PATH=/c/Python38:/c/Python38/Scripts:$PATH |
| 37 | + - TRAVIS_PYTHON_IMPLEMENTATION="cpython" |
| 38 | + # Older Python releases |
| 39 | + - name: "Python 3.6 on Xenial Linux" |
| 40 | + python: 3.6 |
| 41 | + env: |
| 42 | + - TRAVIS_PYTHON_IMPLEMENTATION="cpython" |
| 43 | + # IronPython monstrosity |
| 44 | + - name: "IronPython 2.7: Windows" |
| 45 | + os: windows |
43 | 46 | language: shell |
44 | | - env: TRAVIS_PYTHON_VERSION=3.7 |
| 47 | + before_install: |
| 48 | + - choco install ironpython --version=2.7.8.1 |
| 49 | + - ipy -X:Frames -m ensurepip |
| 50 | + - ipy -X:Frames -m pip install --no-deps compas roslibpy |
| 51 | + - ipy -X:Frames -m pip install ironpython-pytest |
| 52 | + script: |
| 53 | + - ipy tests/ipy_test_runner.py |
| 54 | + env: |
| 55 | + - TRAVIS_PYTHON_IMPLEMENTATION="ironpython" |
| 56 | + - IRONPYTHONPATH=$TRAVIS_BUILD_DIR/src |
| 57 | + |
| 58 | + |
| 59 | +# all three OSes agree about 'pip3' |
| 60 | +before_install: |
| 61 | +- if [[ "$TRAVIS_PYTHON_IMPLEMENTATION" == "cpython" ]]; then |
| 62 | + pip3 install --upgrade pip; |
| 63 | + pip3 install cython --install-option="--no-cython-compile"; |
| 64 | + fi |
45 | 65 |
|
46 | 66 | install: |
47 | | - - pip3 install cython --install-option="--no-cython-compile" || pip install cython --install-option="--no-cython-compile" |
48 | | - - pip3 install --no-cache-dir -r requirements-dev.txt || pip install --no-cache-dir -r requirements-dev.txt |
| 67 | +- if [[ "$TRAVIS_PYTHON_IMPLEMENTATION" == "cpython" ]]; then |
| 68 | + pip3 install --no-cache-dir -r requirements-dev.txt; |
| 69 | + fi |
49 | 70 |
|
50 | 71 | script: |
51 | | - # The following syntax with || is taken directly from Travis CI documentation: |
52 | | - # https://docs.travis-ci.com/user/languages/python/#running-python-tests-on-multiple-operating-systems |
53 | | - # 'python' points to Python 2.7 on macOS but points to Python 3.8 on Linux and Windows |
54 | | - # 'python3' is a 'command not found' error on Windows but 'py' works on Windows only |
55 | | - - python3 -c "import compas_fab" || python -c "import compas_fab" |
56 | | - - python3 -c "import compas_fab.backends" || python -c "import compas_fab.backends" |
57 | | - - python3 -c "from compas_fab.backends.vrep.remote_api import vrep" || python -c "from compas_fab.backends.vrep.remote_api import vrep" |
58 | | - - python3 -c "import compas_fab.robots" || python -c "import compas_fab.robots" |
59 | | - - python3 -c "import compas_fab.utilities" || python -c "import compas_fab.utilities" |
60 | | - - if [[ "$TRAVIS_PYTHON_VERSION" == "3.7" ]]; then |
61 | | - python3 -m invoke lint || python -m invoke lint; |
62 | | - fi |
63 | | - - python3 -m invoke test || python -m invoke test |
64 | | - - if [[ "$TRAVIS_GENERATE_DOCS" == "true" ]]; then |
65 | | - python3 -m invoke docs || python -m invoke docs; |
66 | | - fi |
| 72 | +- if [[ "$TRAVIS_RUN_LINTER" == "true" ]]; then |
| 73 | + invoke lint; |
| 74 | + fi |
| 75 | +- if [[ "$TRAVIS_RUN_INTEGRATION_TESTS" == "true" ]]; then |
| 76 | + invoke test --doctest --codeblock; |
| 77 | + else |
| 78 | + invoke test; |
| 79 | + fi; |
| 80 | + |
| 81 | +after_success: |
| 82 | +- if [[ "$TRAVIS_GENERATE_DOCS" == "true" ]]; then |
| 83 | + invoke docs; |
| 84 | + fi |
0 commit comments