.travis.yml 2.8 KB

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