language: python python: - "2.7" - "3.4" - "3.6" before_install: - pip install --upgrade pip install: - pip install -r requirements.txt - pip install flake8 pytest pytest-mock addons: apt: packages: - libgtest-dev before_script: # fail the build if there are Python syntax errors or undefined names - flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics # exit-zero treats all errors as warnings. The GitHub web ui editor is 127 chars wide - SELECT=C,E10,E11,E401,E502,E703,E8,E9,F,W191,W291,W292,W293,W391 - flake8 . --count --exit-zero --select=${SELECT} --max-complexity=10 --max-line-length=127 --statistics script: # NOTE: we must do all testing on the installed python package, not # on the build tree. Otherwise the testing is invalid and may not # indicate the code actually works # # Set pythonpath # install - git clone git://github.com/ArduPilot/mavlink.git - ln -s $PWD/mavlink/message_definitions ../ - python setup.py build install # Generate messages - mavgen.py --lang='C' --output=/tmp/mavgen_test mavlink/message_definitions/v1.0/common.xml --wire-protocol=1.0 --strict-units - mavgen.py --lang='CS' --output=/tmp/mavgen_test mavlink/message_definitions/v1.0/common.xml --wire-protocol=1.0 --strict-units - mavgen.py --lang='JavaScript' --output=/tmp/mavgen_test mavlink/message_definitions/v1.0/common.xml --wire-protocol=1.0 --strict-units - mavgen.py --lang='Python' --output=/tmp/mavgen_test mavlink/message_definitions/v1.0/common.xml --wire-protocol=1.0 --strict-units - mavgen.py --lang='WLua' --output=/tmp/mavgen_test mavlink/message_definitions/v1.0/common.xml --wire-protocol=1.0 --strict-units - mavgen.py --lang='ObjC' --output=/tmp/mavgen_test mavlink/message_definitions/v1.0/common.xml --wire-protocol=1.0 --strict-units - mavgen.py --lang='Swift' --output=/tmp/mavgen_test mavlink/message_definitions/v1.0/common.xml --wire-protocol=1.0 --strict-units - mavgen.py --lang='Java' --output=/tmp/mavgen_test mavlink/message_definitions/v1.0/common.xml --wire-protocol=1.0 --strict-units - mavgen.py --lang='C' --output=/tmp/mavgen_test mavlink/message_definitions/v1.0/common.xml --wire-protocol=2.0 --strict-units - mavgen.py --lang='CS' --output=/tmp/mavgen_test mavlink/message_definitions/v1.0/common.xml --wire-protocol=2.0 --strict-units - mavgen.py --lang='JavaScript' --output=/tmp/mavgen_test mavlink/message_definitions/v1.0/common.xml --wire-protocol=2.0 --strict-units - mavgen.py --lang='Python' --output=/tmp/mavgen_test mavlink/message_definitions/v1.0/common.xml --wire-protocol=2.0 --strict-units - mavgen.py --lang='WLua' --output=/tmp/mavgen_test mavlink/message_definitions/v1.0/common.xml --wire-protocol=2.0 --strict-units - mavgen.py --lang='ObjC' --output=/tmp/mavgen_test mavlink/message_definitions/v1.0/common.xml --wire-protocol=2.0 --strict-units - mavgen.py --lang='Swift' --output=/tmp/mavgen_test mavlink/message_definitions/v1.0/common.xml --wire-protocol=2.0 --strict-units - mavgen.py --lang='Java' --output=/tmp/mavgen_test mavlink/message_definitions/v1.0/common.xml --wire-protocol=2.0 --strict-units - mavgen.py --lang='C++11' --output=/tmp/mavgen_test mavlink/message_definitions/v1.0/common.xml --wire-protocol=2.0 --strict-units # C++11 generator only supports 2.0 - ./test_generator.sh # Avoid `spurious errors` caused by ~/.npm permission issues # ref: https://github.com/travis-ci/travis-ci/issues/2244 # ref: https://github.com/npm/npm/issues/4815 # Does it already exist? Who owns? What permissions? - ls -lah ~/.npm || mkdir ~/.npm # Make sure we own it # $USER references the current user in Travis env - sudo chown -R $USER ~/.npm - "cd generator/javascript && npm test" # Run tests - cd $TRAVIS_BUILD_DIR - python -m pytest