forked from elasticluster/elasticluster
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.travis.yml
43 lines (34 loc) · 1.73 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
language: python
dist: xenial
env:
global:
- DOCKER_DEST=riccardomurri/elasticluster
# DOCKER_USER
- secure: "e7ZCh4g6NsmO/xjJvwF1Zx33jXhsilqKG86bjlfVbhtKMh4M9JxlomZvdhsbmv2n8jpPNCUa8yqSWjDxKBB9VHjTsABgVb48XTBivfRzWy750idSsH7RWz8kdnGzQpLPBw43xM81oO0LPaetFIk1+eV+gT6iBk/GJpfEZu3cMAU="
# DOCKER_PASS
- secure: "c2ImpLoN/71+uZ1JAA06ENPYWon9Ohrq0HoKBhZ+6nyYiIl1BznPraWmQZOkx/rgg9IOBM4BMIdfOFhimrI6LDV2m5XlIpSct77wM/qVJyZi6TNuoS6zmRUfcJ9Rm3oAzRhv17Z0gvX1jTlKtlLJXPPyaLjlBAG8OAo7/aklqRk="
install:
- "pip install --upgrade 'setuptools' 'pip>=8.1.2'"
- "pip install 'pytest' 'pytest-cov' 'mock' 'tox' 'codecov'"
- "pip install ."
script:
- pytest -v --cov=elasticluster --cov-branch
matrix:
include:
- python: "2.7"
- python: "3.5"
- python: "3.6"
- python: "3.7"
# build Docker image and publish it on hub.docker.com
after_success:
- codecov
- if [ $(echo "$TRAVIS_PYTHON_VERSION" | cut -d. -f1-2) != '2.7' ]; then echo "Only building Docker images on Py2.7, this is $TRAVIS_PYTHON_VERSION"; exit 0; fi
- if [ -z "$DOCKER_USER" ]; then echo "Untrusted build - cannot access docker environment variables."; exit 0; fi
- docker login -u "$DOCKER_USER" -p "$DOCKER_PASS"
- export BRANCH=$(echo "${TRAVIS_PULL_REQUEST_BRANCH:-$TRAVIS_BRANCH}" | cut -c-8)
- export COMMIT=$(echo "${TRAVIS_PULL_REQUEST_SHA:-$TRAVIS_COMMIT}" | cut -c-8)
- export TAG=$(if [ "$TRAVIS_PULL_REQUEST" != 'false' ]; then echo "pr#$TRAVIS_PULL_REQUEST"; elif [ "$BRANCH" = 'master' ]; then echo "latest"; else echo "$BRANCH" ; fi)
- docker build -f Dockerfile -t $DOCKER_DEST:$COMMIT .
- docker tag $DOCKER_DEST:$COMMIT $DOCKER_DEST:$TAG
- docker tag $DOCKER_DEST:$COMMIT $DOCKER_DEST:travis-$TRAVIS_BUILD_NUMBER
- docker push $DOCKER_DEST