.travis.yml 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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-gce
  20. - python: 2.7
  21. env: TOX_ENV=py27-openstack
  22. - python: 3.6
  23. env: TOX_ENV=py36-aws
  24. - python: 3.6
  25. env: TOX_ENV=py36-azure
  26. - python: 3.6
  27. env: TOX_ENV=py36-gce
  28. - python: 3.6
  29. env: TOX_ENV=py36-openstack
  30. env:
  31. global:
  32. - PYTHONUNBUFFERED=True
  33. - COVERALLS_PARALLEL=true
  34. before_install:
  35. - openssl aes-256-cbc -K $encrypted_b3fcf6d0737c_key -iv $encrypted_b3fcf6d0737c_iv
  36. -in credentials.tar.gz.enc -out credentials.tar.gz -d
  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 -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
  91. notifications:
  92. webhooks: https://coveralls.io/webhook