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