.travis.yml 3.0 KB

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