.travis.yml 2.8 KB

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