.travis.yml 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. dist: trusty
  2. language: python
  3. os:
  4. - linux
  5. # - osx
  6. matrix:
  7. fast_finish: true
  8. allow_failures:
  9. - os: osx
  10. include:
  11. - python: 2.7
  12. env: TOX_ENV=py27-aws
  13. - python: 2.7
  14. env: TOX_ENV=py27-openstack
  15. - python: 3.6
  16. env: TOX_ENV=py36-aws
  17. - python: 3.6
  18. env: TOX_ENV=py36-openstack
  19. - python: pypy-5.3.1
  20. env: TOX_ENV=pypy-aws
  21. - python: pypy-5.3.1
  22. env: TOX_ENV=pypy-openstack
  23. before_install:
  24. - |
  25. case "$TRAVIS_EVENT_TYPE" in
  26. push|pull_request)
  27. # Check whether we need to run a test for this provider
  28. DOCS_REGEX='(\.rst$)|(^(docs))/'
  29. FILES_IN_CHANGESET="`git diff --name-only $TRAVIS_COMMIT_RANGE`"
  30. echo "$FILES_IN_CHANGESET" | grep -qvE "$DOCS_REGEX" || {
  31. echo "Only docs were updated. Stopping build process."
  32. exit
  33. }
  34. echo "$FILES_IN_CHANGESET" | grep -qvE "$DOCS_REGEX|(^(cloudbridge/cloud/providers))" || {
  35. echo "Only docs and providers were updated. Checking whether this provider was changed."
  36. # Extract env and provider from $TOXENV into $PYENV and $PROVIDER respectively
  37. IFS=- read PYENV PROVIDER <<< "$TOX_ENV"
  38. echo "$FILES_IN_CHANGESET" | grep -qE "^(cloudbridge/cloud/providers/$PROVIDER)" && {
  39. echo "This provider was affected by this changeset. Running tests."
  40. } || {
  41. echo "This provider was not affected by this changeset. Stopping build process."
  42. exit
  43. }
  44. }
  45. ;;
  46. *)
  47. echo "Build triggered through API or CRON job. Running regardless of changes"
  48. ;;
  49. esac
  50. install:
  51. - pip install -U setuptools
  52. - pip install tox
  53. - pip install coveralls
  54. - pip install codecov
  55. script:
  56. - tox -e $TOX_ENV
  57. after_success:
  58. - |
  59. case "$TRAVIS_EVENT_TYPE" in
  60. push|pull_request)
  61. # Don't run coverage if tests or cloudbridge interface was not affected
  62. DOCS_REGEX='(\.rst$)|(^(docs))/'
  63. FILES_IN_CHANGESET="`git diff --name-only $TRAVIS_COMMIT_RANGE`"
  64. echo "$FILES_IN_CHANGESET" | grep -qvE "$DOCS_REGEX|(^(cloudbridge/cloud/providers))" && {
  65. coveralls &
  66. codecov &
  67. wait
  68. } || {
  69. echo "Only docs and providers were updated. Not running coverage."
  70. }
  71. ;;
  72. *)
  73. echo "Build triggered through API or CRON job. Running regardless of changes"
  74. ;;
  75. esac