.travis.yml 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. language: python
  2. python:
  3. - "2.7"
  4. - "3.4"
  5. - "3.6"
  6. before_install:
  7. - pip install --upgrade pip
  8. install:
  9. - pip install -r requirements.txt
  10. - pip install flake8 pytest pytest-mock
  11. addons:
  12. apt:
  13. packages:
  14. - libgtest-dev
  15. before_script:
  16. # fail the build if there are Python syntax errors or undefined names
  17. - flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics
  18. # exit-zero treats all errors as warnings. The GitHub web ui editor is 127 chars wide
  19. - SELECT=C,E10,E11,E401,E502,E703,E8,E9,F,W191,W291,W292,W293,W391
  20. - flake8 . --count --exit-zero --select=${SELECT} --max-complexity=10 --max-line-length=127 --statistics
  21. script:
  22. # NOTE: we must do all testing on the installed python package, not
  23. # on the build tree. Otherwise the testing is invalid and may not
  24. # indicate the code actually works
  25. #
  26. # Set pythonpath
  27. # install
  28. - git clone git://github.com/ArduPilot/mavlink.git
  29. - ln -s $PWD/mavlink/message_definitions ../
  30. - python setup.py build install
  31. # Generate messages
  32. - mavgen.py --lang='C' --output=/tmp/mavgen_test mavlink/message_definitions/v1.0/common.xml --wire-protocol=1.0 --strict-units
  33. - mavgen.py --lang='CS' --output=/tmp/mavgen_test mavlink/message_definitions/v1.0/common.xml --wire-protocol=1.0 --strict-units
  34. - mavgen.py --lang='JavaScript' --output=/tmp/mavgen_test mavlink/message_definitions/v1.0/common.xml --wire-protocol=1.0 --strict-units
  35. - mavgen.py --lang='Python' --output=/tmp/mavgen_test mavlink/message_definitions/v1.0/common.xml --wire-protocol=1.0 --strict-units
  36. - mavgen.py --lang='WLua' --output=/tmp/mavgen_test mavlink/message_definitions/v1.0/common.xml --wire-protocol=1.0 --strict-units
  37. - mavgen.py --lang='ObjC' --output=/tmp/mavgen_test mavlink/message_definitions/v1.0/common.xml --wire-protocol=1.0 --strict-units
  38. - mavgen.py --lang='Swift' --output=/tmp/mavgen_test mavlink/message_definitions/v1.0/common.xml --wire-protocol=1.0 --strict-units
  39. - mavgen.py --lang='Java' --output=/tmp/mavgen_test mavlink/message_definitions/v1.0/common.xml --wire-protocol=1.0 --strict-units
  40. - mavgen.py --lang='C' --output=/tmp/mavgen_test mavlink/message_definitions/v1.0/common.xml --wire-protocol=2.0 --strict-units
  41. - mavgen.py --lang='CS' --output=/tmp/mavgen_test mavlink/message_definitions/v1.0/common.xml --wire-protocol=2.0 --strict-units
  42. - mavgen.py --lang='JavaScript' --output=/tmp/mavgen_test mavlink/message_definitions/v1.0/common.xml --wire-protocol=2.0 --strict-units
  43. - mavgen.py --lang='Python' --output=/tmp/mavgen_test mavlink/message_definitions/v1.0/common.xml --wire-protocol=2.0 --strict-units
  44. - mavgen.py --lang='WLua' --output=/tmp/mavgen_test mavlink/message_definitions/v1.0/common.xml --wire-protocol=2.0 --strict-units
  45. - mavgen.py --lang='ObjC' --output=/tmp/mavgen_test mavlink/message_definitions/v1.0/common.xml --wire-protocol=2.0 --strict-units
  46. - mavgen.py --lang='Swift' --output=/tmp/mavgen_test mavlink/message_definitions/v1.0/common.xml --wire-protocol=2.0 --strict-units
  47. - mavgen.py --lang='Java' --output=/tmp/mavgen_test mavlink/message_definitions/v1.0/common.xml --wire-protocol=2.0 --strict-units
  48. - 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
  49. - ./test_generator.sh
  50. # Avoid `spurious errors` caused by ~/.npm permission issues
  51. # ref: https://github.com/travis-ci/travis-ci/issues/2244
  52. # ref: https://github.com/npm/npm/issues/4815
  53. # Does it already exist? Who owns? What permissions?
  54. - ls -lah ~/.npm || mkdir ~/.npm
  55. # Make sure we own it
  56. # $USER references the current user in Travis env
  57. - sudo chown -R $USER ~/.npm
  58. - "cd generator/javascript && npm test"
  59. # Run tests
  60. - cd $TRAVIS_BUILD_DIR
  61. - python -m pytest