Skip to content

Commit

Permalink
Create Travis-CI config file for builds
Browse files Browse the repository at this point in the history
  • Loading branch information
dmytrostriletskyi committed Jun 29, 2019
1 parent f9cfe44 commit 4bc3540
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 5 deletions.
19 changes: 19 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
sudo: required

services:
- docker

before_install:
- docker build -t heroku-load-balancer . -f Dockerfile
- docker run -d -p 7979:7979 -v $PWD:/heroku-load-balancer -e PORT=7979 -e HEROKU_API_KEY=$HEROKU_API_KEY -e PIPELINE_IDENTIFIER='f64cf79b-79ba-4c45-8039-57c9af5d4508' --name heroku-load-balancer heroku-load-balancer

script:
- docker exec -it heroku-load-balancer bash -c "radon cc src -nb --total-average"
- docker exec -it heroku-load-balancer bash -c "cat requirements.txt requirements-dev.txt | safety check --stdin"
- docker exec -it heroku-load-balancer bash -c "bash <(curl -s https://linters.io/sort-requirements) requirements.txt requirements-dev.txt"
- docker exec -it heroku-load-balancer bash -c "bash <(curl -s https://linters.io/isort-diff) src"
- docker exec -it heroku-load-balancer bash -c "flake8 src"

env:
global:
secure: I8Rr7rQOfSFkq+VjYFThFfbBE2YIs4d5y3f9kJEAbZ51p61QWu8h4Opu1/fXGPFA5hCOS2sd8hywj+wVAaavd4GUuJurYbUd4rGVhkpQDCSYlUVr2eGHXGC+JgpyZ14LKsPOAFIfdwumU4ZrmAgTmKuduhiXo/erQk2g086ivBjqUvjG/yRH3ZehlMVY1MU4QIOZa1JrWgG/XmXXIxaFbQpwIeNQw3Q5i10PcG+X+6Yoeg+IrJ4mKIExKzrwrBS3I/JEWh37TAB2AkQN8Ez2u8AktM8uAyKALxL4mThhr9sCsIjfrNHJOYENDKvzLM1Y0XDURSclrngsvp3ihOTo23JSXemBPzbxfP2jvhFV0nDePVq88fVIrhxFNw+Kd1Gvew6hFa1PftNq825eDfLv+oWD8o3J9SU8innqxF6TH5d/UfIkI+Z3ovciedL4Jy7/bGTIqKk5Zc04GylCfEGxm1YFotNpE1LYunMcmE6pJQvs35DWryhJw3ryGOI3CWQLXuSq8pbR3czJpPeZlisJ1pU7vh79x8lZmWsxsza5jYMvPAle6JgInnm8oYkvwNc4fi5u9Y4Tb9Q4QSIc3nX9o62mH1fu6F/N5lefe6xoRkTjz2xkOkwEHtiAFKrXimyI6E/wscOk5NgenMqp0cm4Sk5C3vlLnvCc79/zycCeIpw=
13 changes: 9 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,15 @@ ENV LANG C.UTF-8
ENV LC_ALL C.UTF-8

RUN apt-get update && apt-get install -y \
nginx
software-properties-common \
nginx \
curl

RUN apt-get update && apt-get install -y software-properties-common && add-apt-repository ppa:deadsnakes/ppa && \
apt-get update && apt-get install -y python3.6 python3.6-dev python3-pip python3-setuptools
RUN add-apt-repository ppa:deadsnakes/ppa && apt-get update && apt-get install -y \
python3.6 \
python3.6-dev \
python3-pip \
python3-setuptools

RUN ln -sfn /usr/bin/python3.6 /usr/bin/python3 && ln -sfn /usr/bin/python3 /usr/bin/python

Expand All @@ -16,6 +21,6 @@ COPY . /heroku-load-balancer

ENV PYTHONPATH="$PYTHONPATH:/heroku-load-balancer/src"

RUN pip3 install -r /heroku-load-balancer/requirements.txt
RUN pip3 install -r /heroku-load-balancer/requirements.txt -r /heroku-load-balancer/requirements-dev.txt

CMD /bin/bash -c "python3 src/entrypoint.py create-load-balancer --nginx-port=$PORT --heroku-api-key=$HEROKU_API_KEY --pipeline-identifier=$PIPELINE_IDENTIFIER" && mv nginx.conf /etc/nginx/nginx.conf && nginx -g 'daemon off;'
11 changes: 11 additions & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
add-trailing-comma==1.0.0
flake8-commas==2.0.0
flake8-comprehensions==2.1.0
flake8-docstrings==1.3.0
flake8-per-file-ignores==0.8.1
flake8-print==3.1.0
flake8==3.7.7
isort==4.3.20
pep8-naming==0.8.2
radon==3.0.3
safety==1.8.5
22 changes: 22 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[isort]
line_length=120
multi_line_output=3
include_trailing_comma=True
force_grid_wrap=True
combine_as_imports=True

[flake8]
max-line-length=120
ignore=D200, D413, D107, D100
per-file-ignores=
*/__init__.py: D104, F401, D100,
*/test_*: D205,
src/constants.py: E501

[coverage:run]
omit =
*/.virtualenvs/*,
*/virtualenv/*,

*/__init__.py,
tests/*
5 changes: 4 additions & 1 deletion src/entrypoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@

@click.group()
def cli():
"""
Command line interface root function.
"""
pass


Expand All @@ -32,7 +35,7 @@ def cli():
'--pipeline-identifier',
type=str,
required=True,
help='Pipeline identifier to fetch applications for balancing.'
help='Pipeline identifier to fetch applications for balancing.',
)
def create_load_balancer(nginx_port, heroku_api_key, pipeline_identifier):
"""
Expand Down

0 comments on commit 4bc3540

Please sign in to comment.