.travis.yml 2.7 KB

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