2
0

.travis.yml 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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. env:
  34. global:
  35. - PYTHONUNBUFFERED=True
  36. before_install:
  37. - |
  38. case "$TRAVIS_EVENT_TYPE" in
  39. push|pull_request)
  40. # Check whether we need to run a test for this provider
  41. DOCS_REGEX='(\.rst$)|(^(docs))/'
  42. FILES_IN_CHANGESET="`git diff --name-only $TRAVIS_COMMIT_RANGE`"
  43. echo "$FILES_IN_CHANGESET" | grep -qvE "$DOCS_REGEX" || {
  44. echo "Only docs were updated. Stopping build process."
  45. exit
  46. }
  47. echo "$FILES_IN_CHANGESET" | grep -qvE "$DOCS_REGEX|(^(cloudbridge/cloud/providers))" || {
  48. echo "Only docs and providers were updated. Checking whether this provider was changed."
  49. # Extract env and provider from $TOXENV into $PYENV and $PROVIDER respectively
  50. IFS=- read PYENV PROVIDER <<< "$TOX_ENV"
  51. echo "$FILES_IN_CHANGESET" | grep -qE "^(cloudbridge/cloud/providers/$PROVIDER)" && {
  52. echo "This provider was affected by this changeset. Running tests."
  53. } || {
  54. echo "This provider was not affected by this changeset. Stopping build process."
  55. exit
  56. }
  57. }
  58. ;;
  59. *)
  60. echo "Build triggered through API or CRON job. Running regardless of changes"
  61. ;;
  62. esac
  63. install:
  64. - pip install -U pip
  65. - pip install -U setuptools
  66. - pip install tox
  67. - pip install coveralls
  68. - pip install codecov
  69. script:
  70. - tox -r -e $TOX_ENV
  71. after_script:
  72. - |
  73. case "$TRAVIS_EVENT_TYPE" in
  74. push|pull_request)
  75. # Don't run coverage if tests or cloudbridge interface was not affected
  76. DOCS_REGEX='(\.rst$)|(^(docs))/'
  77. FILES_IN_CHANGESET="`git diff --name-only $TRAVIS_COMMIT_RANGE`"
  78. echo "$FILES_IN_CHANGESET" | grep -qvE "$DOCS_REGEX|(^(cloudbridge/cloud/providers))" && {
  79. coveralls &
  80. codecov &
  81. wait
  82. } || {
  83. echo "Only docs and providers were updated. Not running coverage."
  84. }
  85. ;;
  86. *)
  87. echo "Build triggered through API or CRON job. Running regardless of changes"
  88. coveralls & codecov & wait
  89. ;;
  90. esac