-
Notifications
You must be signed in to change notification settings - Fork 10
/
.travis.yml
44 lines (38 loc) · 1.55 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
language: python
python:
- 3.6
services:
- docker
before_install:
- export PYTHONPATH=$HOME/builds/jay-johnson/antinex-pipeline
- export PIP_USE_MIRRORS=true
- export USE_VERSION=$(cat setup.py | grep " version=" | sed -e 's/"/ /g' | awk '{print $2}')
- export REPO=jayjohnson/antinex-pipeline
- echo "Building Docker with tag=${USE_VERSION}"
- echo ""
- echo "Testing Docker Hub credentials username=${DOCKER_USERNAME}"
- docker login --username $DOCKER_USERNAME --password $DOCKER_PASSWORD
- echo "Docker Hub credentials are working"
install:
- pip install -e .
script:
- echo "Running Lint Tests"
- flake8
- pycodestyle
- echo "Running Unit Tests"
- python setup.py test
after_success:
- export USE_VERSION=$(cat setup.py | grep " version=" | sed -e 's/"/ /g' | awk '{print $2}')
- echo "Test Success - Branch=${TRAVIS_BRANCH} Version=${USE_VERSION} Pull Request=${TRAVIS_PULL_REQUEST} Tag=${TRAVIS_TAG}"
- if [[ "$TRAVIS_BRANCH" == "master" ]]; then echo -e "Push Container to Docker Hub"; fi
- echo "Logging into Docker Hub"
- docker login --username $DOCKER_USERNAME --password $DOCKER_PASSWORD
- export TAG=`if [ "$TRAVIS_BRANCH" == "master" ]; then echo "latest"; else echo $TRAVIS_BRANCH ; fi`
- echo "starting: docker build -f Dockerfile -t ${REPO} ."
- docker build -f Dockerfile -t $REPO .
- echo "docker tag ${REPO} ${REPO}:${USE_VERSION}"
- docker tag $REPO $REPO:$USE_VERSION
- echo "docker push ${REPO}"
- docker push $REPO:latest
- echo "docker push ${REPO}:${USE_VERSION}"
- docker push $REPO:$USE_VERSION