Skip to content

Commit

Permalink
Merge pull request #1511 from unicef/staging
Browse files Browse the repository at this point in the history
Staging
  • Loading branch information
ntrncic authored Jun 4, 2018
2 parents 4f98761 + 4577bb9 commit 9f872b2
Show file tree
Hide file tree
Showing 1,581 changed files with 62,302 additions and 60,007 deletions.
37 changes: 8 additions & 29 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,33 +17,20 @@ jobs:
steps:
- checkout
- restore_cache:
key: deps2-{{ .Branch }}-{{ checksum "EquiTrack/requirements/base.txt" }}--{{ checksum "EquiTrack/requirements/test.txt" }}-{{ checksum ".circleci/config.yml" }}
key: deps2-{{ .Branch }}--{{ checksum "src/requirements/test.txt" }}-{{ checksum ".circleci/config.yml" }}
- run:
name: create main virtualenv, install requirements
name: Run Tests
command: |
virtualenv -p $(type -p python3) env1
. env1/bin/activate
pip install -r EquiTrack/requirements/test.txt
pip install tox
tox -re d110,report
- save_cache:
key: deps2-{{ .Branch }}-{{ checksum "EquiTrack/requirements/base.txt" }}--{{ checksum "EquiTrack/requirements/test.txt" }}-{{ checksum ".circleci/config.yml" }}
key: deps2-{{ .Branch }}--{{ checksum "src/requirements/test.txt" }}-{{ checksum ".circleci/config.yml" }}
paths:
- "env1"
- /root/.cache/pip
- run:
name: Postgres Extensions
command: |
psql -U postgres -d template1 -c 'create extension if not exists hstore;'
- run:
name: Run Tests
command: |
. env1/bin/activate
cd EquiTrack
mkdir media
./runtests.sh
- store_artifacts:
path: test-reports/
destination: tr1
path: build/coverage
destination: coverage

build_and_deploy:
working_directory: ~/code
Expand Down Expand Up @@ -72,10 +59,6 @@ jobs:
curl -L -o /tmp/docker-$VER.tgz https://get.docker.com/builds/Linux/x86_64/docker-$VER.tgz
tar -xz -C /tmp -f /tmp/docker-$VER.tgz
mv /tmp/docker/* /usr/bin
- run:
name: Postgres Extensions
command: |
psql -U postgres -d template1 -c 'create extension if not exists hstore;'
- run:
name: see all docker containers
command: |
Expand All @@ -88,10 +71,6 @@ jobs:
name: Start DB Image
command: |
docker run --name docker-postgres -e PGUSER=postgres -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=postgres -e POSTGRES_DB=circle_test -d circleci/postgres:9.5-alpine-postgis
- run:
name: Postgres Extensions
command: |
sleep 20 && docker exec docker-postgres psql -U postgres -d template1 -c 'create extension if not exists hstore;'
- run:
name: Building the image
command: |
Expand All @@ -102,7 +81,7 @@ jobs:
command: |
TAG=${CIRCLE_BRANCH}
HOSTIP=`/sbin/ip route|awk '/default/ { print $3 }'`
docker run --network container:docker-postgres -it -e "DJANGO_SETTINGS_MODULE=EquiTrack.settings.local" -e "DATABASE_URL=postgis://postgres:postgres@localhost:5432/circle_test" -e "DISABLE_JWT_LOGIN=1" -e SECRET_KEY unicef/etools:$TAG /bin/bash -c "pip install -r requirements/test.txt; python manage.py test --noinput"
echo "Skipping tests in image for now... to be fixed"
- run:
name: Pushing to Docker Hub
command: |
Expand Down
18 changes: 18 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[run]
branch = true
omit = */tests/*,
*/migrations/*,

source = etools

[report]
fail_under = 50
show_missing = true
skip_covered = True
exclude_lines =
pragma: no cover
from\s+__future__\s+import\s+
__author__\s+=

[html]
directory = build/coverage
32 changes: 32 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
[flake8]
max-line-length = 120
ignore =
; PyFlakes errors
; F405 name may be undefined, or defined from star imports: module
F405,
; pycodestyle / PEP8
; E121 continuation line under-indented for hanging indent
E121,
; E123 closing bracket does not match indentation of opening bracket’s line
E123,
; E126 continuation line over-indented for hanging indent
E126,
; E226 missing whitespace around arithmetic operator
E226,
; E241/E242 multiple spaces after ‘,’ tab after ‘,’
E24,
; E501 maximum line length
E501,
; E704 (*) multiple statements on one line (def)
E704,
; W503 line break before binary operator
W503,
; W504 line break after binary operator
W504
; H405 multi line docstring summary not separated with an empty line
H405,

exclude =
*/migrations,
*/load_initial_data.py,
*/publics/management/commands/xml,
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ packer_cache
*.box

Vagrantfile
EquiTrack/EquiTrack/saml/FederationMetadata.xml
saml/FederationMetadata.xml

*.tar

Expand Down Expand Up @@ -113,6 +113,8 @@ docs/_build/
.DS_Store

# custom settings files
EquiTrack/EquiTrack/settings/custom.py
src/etools/config/settings/custom.py

*secrets.yml
/dist
.tox
12 changes: 12 additions & 0 deletions .isort.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[isort]
combine_as_imports = true
default_section = THIRDPARTY
include_trailing_comma = true
known_django = django
sections = FUTURE,STDLIB,DJANGO,THIRDPARTY,FIRSTPARTY,LOCALFOLDER
known_first_party = etools
multi_line_output = 3
line_length = 119
balanced_wrapping = true
order_by_type = false
not_skip = __init__.py
14 changes: 14 additions & 0 deletions .pyup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# pyup.io docs: https://pyup.io/docs/bot/config/
# don't send automated PRs when new package updates are available
update: false

# default branch
branch: develop

# should pyup search for requirement files?
search: False

# specify the requirement files
requirements:
- src/requirements/production.txt
- src/requirements/local.txt
10 changes: 6 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,16 @@ ENV CPLUS_INCLUDE_PATH /usr/include/gdal
ENV C_INCLUDE_PATH /usr/include/gdal
ENV REQUIREMENTS_FILE production.txt

ADD ./EquiTrack/requirements/*.txt /pip/
ADD ./EquiTrack/requirements/$REQUIREMENTS_FILE /pip/app_requirements.txt
ADD src/requirements/*.txt /pip/
ADD src/requirements/$REQUIREMENTS_FILE /pip/app_requirements.txt
RUN pip install -f /pip -r /pip/app_requirements.txt

ENV PYTHONUNBUFFERED 1
ADD EquiTrack /code/
ADD src /code/
ADD manage.py /code/manage.py
ENV PYTHONPATH /code

WORKDIR /code/

ENV DJANGO_SETTINGS_MODULE EquiTrack.settings.production
ENV DJANGO_SETTINGS_MODULE etools.config.settings.production
RUN SECRET_KEY=not-so-secret-key-just-for-collectstatic DISABLE_JWT_LOGIN=1 python manage.py collectstatic --noinput
8 changes: 4 additions & 4 deletions Dockerfile-dev
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ RUN pip install --upgrade \
# http://gis.stackexchange.com/a/74060
ENV CPLUS_INCLUDE_PATH /usr/include/gdal
ENV C_INCLUDE_PATH /usr/include/gdal
ARG REQUIREMENTS_FILE
ARG REQUIREMENTS_FILE=test.txt

ADD ./EquiTrack/requirements/*.txt /pip/
ADD ./EquiTrack/requirements/$REQUIREMENTS_FILE /pip/app_requirements.txt
ADD src/requirements/*.txt /pip/
ADD src/requirements/$REQUIREMENTS_FILE /pip/app_requirements.txt
RUN pip install -f /pip -r /pip/app_requirements.txt

ENV PYTHONUNBUFFERED 1
VOLUME "./:/code/"
WORKDIR /code/

ENV DJANGO_SETTINGS_MODULE EquiTrack.settings.local
ENV DJANGO_SETTINGS_MODULE etools.config.settings.local
13 changes: 0 additions & 13 deletions EquiTrack/.coveragerc

This file was deleted.

9 changes: 0 additions & 9 deletions EquiTrack/.flake8

This file was deleted.

9 changes: 0 additions & 9 deletions EquiTrack/EquiTrack/__init__.py

This file was deleted.

37 changes: 0 additions & 37 deletions EquiTrack/EquiTrack/admin.py

This file was deleted.

15 changes: 0 additions & 15 deletions EquiTrack/EquiTrack/forms.py

This file was deleted.

75 changes: 0 additions & 75 deletions EquiTrack/EquiTrack/mixins.py

This file was deleted.

21 changes: 0 additions & 21 deletions EquiTrack/EquiTrack/permissions.py

This file was deleted.

Loading

0 comments on commit 9f872b2

Please sign in to comment.