forked from AlgoTraders/stock-analysis-engine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
70 lines (64 loc) · 2.61 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
language: python
python:
- 3.6
services:
- docker
before_install:
- export PYTHONPATH=$HOME/builds/jay-johnson/stock-analysis-engine
- export PIP_USE_MIRRORS=true
- export USE_VERSION=$(cat setup.py | grep " version=" | sed -e 's/"/ /g' | sed -e "s/'/ /g" | awk '{print $2}')
- export REPO=jayjohnson/stock-analysis-engine
- export REPO_JUPYTER=jayjohnson/stock-analysis-jupyter
- echo "is TRAVIS_PULL_REQUEST=${TRAVIS_PULL_REQUEST}"
- >
if [[ "${TRAVIS_PULL_REQUEST}" == "false" ]]; then
echo "Building Docker with tag=${USE_VERSION}";
echo "";
echo "Testing Docker Hub credentials username=${DOCKER_USERNAME}";
echo "${DOCKER_PASSWORD}" | docker login -u "${DOCKER_USERNAME}" --password-stdin
if [[ "$?" != "0" ]]; then
echo "Docker login failed for user: ${DOCKER_USERNAME}";
fi
echo "Docker Hub credentials are working";
else
echo "Done before_install";
fi
install:
- pip install -e .
script:
- echo "Running Lint Tests"
- flake8 .
- pycodestyle --exclude=.tox,.eggs
- echo "Running Unit Tests"
- py.test
after_success:
- export USE_VERSION=$(cat setup.py | grep " version=" | sed -e 's/"/ /g' | 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_PULL_REQUEST}" == "false" ]]; then
echo "Logging into Docker Hub: ${DOCKER_USERNAME}";
echo "${DOCKER_PASSWORD}" | docker login -u "${DOCKER_USERNAME}" --password-stdin
if [[ "$?" != "0" ]]; then
echo "Docker login failed for user: ${DOCKER_USERNAME}";
fi
export TAG=`if [ "${TRAVIS_BRANCH}" == "master" ]; then echo "latest"; else echo $TRAVIS_BRANCH ; fi`;
echo "starting: cd docker && docker build -f Dockerfile -t ${REPO} .";
cd docker && 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;
echo "docker push ${REPO}:${USE_VERSION}";
docker push $REPO:$USE_VERSION;
echo "";
echo "Starting Jupyter container build: ${REPO_JUPYTER}";
cd jupyter && docker build -f Dockerfile -t $REPO_JUPYTER .;
echo "docker tag ${REPO_JUPYTER} ${REPO_JUPYTER}:${USE_VERSION}";
docker tag $REPO_JUPYTER $REPO_JUPYTER:$USE_VERSION;
echo "docker push ${REPO_JUPYTER}";
docker push $REPO_JUPYTER;
echo "docker push ${REPO_JUPYTER}:${USE_VERSION}";
docker push $REPO_JUPYTER:$USE_VERSION;
else
echo "Done testing";
fi