Skip to content

Commit

Permalink
Merge pull request #30 from Monogramm/develop
Browse files Browse the repository at this point in the history
🔖 Release 1.1.0
  • Loading branch information
madmath03 committed Apr 19, 2020
2 parents a3d2f30 + 29f4658 commit ac82e04
Show file tree
Hide file tree
Showing 74 changed files with 2,838 additions and 467 deletions.
2 changes: 2 additions & 0 deletions .codacy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
exclude_paths:
- '**.sql'
4 changes: 4 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[report]
omit =
*/python?.?/*
*/site-packages/nose/*
24 changes: 24 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@

########################################
# ERPNext configuration
########################################

ERPNEXT_HOME=/srv/erpnext/frappe

ERPNEXT_SITE=localhost

ERPNEXT_ADMIN_PWD=erpnext_admin_password

# Generated with openssl rand -base64 32
ERPNEXT_ENCRYPTION_KEY=dcNdIKUHX/Vgl1sEc0eJIChyYx+2dQ/uASjWXs9hnic=

ERPNEXT_DB_ROOT_LOGIN=root
ERPNEXT_DB_ROOT_PWD=erpnext_db_root_password

# DB name will be used as the DB user
ERPNEXT_DB_NAME=erpnext
ERPNEXT_DB_PWD=erpnext_password

# Local development configuration
IMAGE_NAME=docker-erpnext:erpnext_ocr-dev
FRAPPE_APP_TO_TEST=erpnext_ocr
23 changes: 13 additions & 10 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
---
* * *

name: Bug report
about: Create a report to help us improve
title: ''
labels: bug
assignees: madmath03
assignees:

---
* * *

**Describe the bug**
A clear and concise description of what the bug is.
Expand All @@ -26,15 +27,17 @@ A clear and concise description of what you expected to happen.
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

**Additional context**
Add any other context about the problem here.
7 changes: 4 additions & 3 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
---
* * *

name: Feature request
about: Suggest an idea for this project
title: ''
labels: enhancement
assignees: madmath03
assignees:

---
* * *

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
Expand Down
9 changes: 0 additions & 9 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,3 @@
---
name: Pull Request
about: Create a Pull Request to help us improve
title: 'type: Subject'
labels:
assignees: madmath03

---

<!--
Some key notes before you open a PR:
Expand Down
56 changes: 42 additions & 14 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,35 @@ language: shell

branches:
only:
- develop
- master
- develop

before_script:
before_install:
- env | sort
- home=$(pwd)
- dir=".travis"
- export IMAGE_NAME=docker-erpnext-ext:erpnext_ocr-travis
- export TAG=travis
- export VCS_REF=`git rev-parse --short HEAD`
- export BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"`
- export home=$(pwd)
- export travis_dir="${home}/.travis"
- export IMAGE_NAME="docker-erpnext_ocr:${TAG}"
- export BUILD_BRANCH=${TRAVIS_PULL_REQUEST_BRANCH:-${TRAVIS_BRANCH}}
- export BUILD_URL=https://github.com/${TRAVIS_PULL_REQUEST_SLUG:-${TRAVIS_REPO_SLUG}}

script:
- cd "$dir"
install:
- echo "Changing to travis test directory ($travis_dir)"
- cd "$travis_dir"
# Prepare base image for build version and variant
- sed -i -e "s/%%VERSION%%/${VERSION}/g" Dockerfile.${VARIANT}
- sed -i -e "s/%%IMAGE_NAME%%/${IMAGE_NAME}/g" Dockerfile_test
- sed -i -e "s/%%IMAGE_NAME%%/${IMAGE_NAME}/g" Dockerfile.test
# Test container build
- travis_retry travis_wait 60 docker-compose -f docker-compose.${DATABASE}.yml build

before_script:
- docker images

script:
- echo "Changing to travis test directory ($travis_dir)"
- cd "$travis_dir"
# Test container run
- travis_retry docker-compose -f docker-compose.${DATABASE}.yml up -d && sleep 60
- docker-compose -f docker-compose.${DATABASE}.yml ps
Expand All @@ -43,7 +53,7 @@ script:
- docker-compose -f docker-compose.${DATABASE}.yml ps "erpnext_app" | grep "Up"
- docker-compose -f docker-compose.${DATABASE}.yml logs "erpnext_web"
- docker-compose -f docker-compose.${DATABASE}.yml ps "erpnext_web" | grep "Up"
- echo 'Wait until test finished (3 minutes)' && sleep 180
- echo 'Wait until test finished (5 minutes)' && sleep 300
- docker-compose -f docker-compose.${DATABASE}.yml logs "sut"
- docker-compose -f docker-compose.${DATABASE}.yml ps "sut" | grep "Exit 0"
# Test container restart
Expand All @@ -56,14 +66,32 @@ script:
- docker-compose -f docker-compose.${DATABASE}.yml ps "erpnext_app" | grep "Up"
- docker-compose -f docker-compose.${DATABASE}.yml logs "erpnext_web"
- docker-compose -f docker-compose.${DATABASE}.yml ps "erpnext_web" | grep "Up"
- echo 'Wait until test finished (3 minutes)' && sleep 180
- echo 'Wait until test finished (5 minutes)' && sleep 300
- docker-compose -f docker-compose.${DATABASE}.yml logs "sut"
- docker-compose -f docker-compose.${DATABASE}.yml ps "sut" | grep "Exit 0"

#after_script:
# - cd "$home"
# - sudo pip install python-coveralls
# - coveralls -b "$home" -d /srv/erpnext/frappe/sites/.coverage
after_script:
- echo "Changing to project directory ($home)"
- cd "$home"
- sudo pip install coverage==4.5.4
- sudo pip install python-coveralls
- curl https://deepsource.io/cli | sudo sh
# Create same directory path as docker test execution
- sudo mkdir -p '/home/frappe/frappe-bench/apps'
- sudo ln -sf "$home" '/home/frappe/frappe-bench/apps/erpnext_ocr'
# Copy and convert coverage to XML format
- cp '/srv/erpnext/frappe/sites/.coverage' .coverage
- coverage xml
- coverage report -m
# Publish coverage to Coveralls
- coveralls -b "$home" -d "$home/.coverage"
# Publish coverage to Codacy
- test -z "$CODACY_PROJECT_TOKEN" || bash <(curl -Ls https://coverage.codacy.com/get.sh) report -l Python -r "./coverage.xml"
# Publish coverage to Codecov
- test -z "$CODECOV_TOKEN" || bash <(curl -s https://codecov.io/bash)
# Publish coverage to DeepSource
- export DEEPSOURCE_DSN=https://sampledsn@deepsource.io
- ./bin/deepsource report --analyzer test-coverage --key python --value-file ./coverage.xml

notifications:
email: false
Expand Down
6 changes: 6 additions & 0 deletions .travis/.env
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
# ERPNext configuration
########################################

ERPNEXT_HOME=/srv/erpnext/frappe

ERPNEXT_SITE=localhost

ERPNEXT_ADMIN_PWD=erpnext_admin_password
Expand All @@ -17,3 +19,7 @@ ERPNEXT_DB_ROOT_PWD=erpnext_db_root_password
ERPNEXT_DB_NAME=erpnext
ERPNEXT_DB_PWD=erpnext_password

# Tessdata links
TESSDATA_BEST=https://github.com/tesseract-ocr/tessdata_best/blob/master/ara.traineddata?raw=true
TESSDATA_FAST=https://github.com/tesseract-ocr/tessdata_fast/blob/master/ara.traineddata?raw=true
TESSDATA_PATH=/usr/share/tesseract-ocr/tessdata
11 changes: 11 additions & 0 deletions .travis/Dockerfile.alpine
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ RUN set -ex; \
ENV DOCKER_TAG=travis \
DOCKER_VCS_REF=${TRAVIS_COMMIT} \
DOCKER_BUILD_DATE=${TRAVIS_BUILD_NUMBER} \
TESSDATA_PREFIX=/home/$FRAPPE_USER/tessdata \
LANG=C.UTF-8 \
LC_ALL=C

Expand All @@ -29,6 +30,16 @@ RUN set -ex; \
leptonica \
pkgconfig \
; \
mkdir -p $TESSDATA_PREFIX; \
sudo chown -R $FRAPPE_USER:$FRAPPE_USER $TESSDATA_PREFIX ; \
wget -q https://raw.github.com/tesseract-ocr/tessdata/master/eng.traineddata -O $TESSDATA_PREFIX/eng.traineddata; \
wget -q https://raw.github.com/tesseract-ocr/tessdata/master/equ.traineddata -O $TESSDATA_PREFIX/equ.traineddata; \
wget -q https://raw.github.com/tesseract-ocr/tessdata/master/osd.traineddata -O $TESSDATA_PREFIX/osd.traineddata; \
wget -q https://raw.github.com/tesseract-ocr/tessdata/master/fra.traineddata -O $TESSDATA_PREFIX/fra.traineddata; \
wget -q https://raw.github.com/tesseract-ocr/tessdata/master/deu.traineddata -O $TESSDATA_PREFIX/deu.traineddata; \
wget -q https://raw.github.com/tesseract-ocr/tessdata/master/spa.traineddata -O $TESSDATA_PREFIX/spa.traineddata; \
wget -q https://raw.github.com/tesseract-ocr/tessdata/master/por.traineddata -O $TESSDATA_PREFIX/por.traineddata; \
sudo chmod -R 755 $TESSDATA_PREFIX ; \
sudo sed -i \
-e 's/rights="none" pattern="PDF"/rights="read" pattern="PDF"/g' \
/etc/ImageMagick*/policy.xml \
Expand Down
14 changes: 13 additions & 1 deletion .travis/Dockerfile.debian
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ RUN set -ex; \
# Build environment variables
ENV DOCKER_TAG=travis \
DOCKER_VCS_REF=${TRAVIS_COMMIT} \
DOCKER_BUILD_DATE=${TRAVIS_BUILD_NUMBER}
DOCKER_BUILD_DATE=${TRAVIS_BUILD_NUMBER} \
TESSDATA_PREFIX=/home/$FRAPPE_USER/tessdata \
LC_ALL=C

# Copy the whole repository to app folder for manual install
#COPY --chown=frappe:frappe . "/home/$FRAPPE_USER"/frappe-bench/apps/erpnext_ocr
Expand All @@ -38,6 +40,16 @@ RUN set -ex; \
pkg-config \
; \
sudo rm -rf /var/lib/apt/lists/*; \
mkdir -p $TESSDATA_PREFIX; \
sudo chown -R $FRAPPE_USER:$FRAPPE_USER $TESSDATA_PREFIX ; \
wget -q https://raw.github.com/tesseract-ocr/tessdata/master/eng.traineddata -O $TESSDATA_PREFIX/eng.traineddata; \
wget -q https://raw.github.com/tesseract-ocr/tessdata/master/equ.traineddata -O $TESSDATA_PREFIX/equ.traineddata; \
wget -q https://raw.github.com/tesseract-ocr/tessdata/master/osd.traineddata -O $TESSDATA_PREFIX/osd.traineddata; \
wget -q https://raw.github.com/tesseract-ocr/tessdata/master/fra.traineddata -O $TESSDATA_PREFIX/fra.traineddata; \
wget -q https://raw.github.com/tesseract-ocr/tessdata/master/deu.traineddata -O $TESSDATA_PREFIX/deu.traineddata; \
wget -q https://raw.github.com/tesseract-ocr/tessdata/master/spa.traineddata -O $TESSDATA_PREFIX/spa.traineddata; \
wget -q https://raw.github.com/tesseract-ocr/tessdata/master/por.traineddata -O $TESSDATA_PREFIX/por.traineddata; \
sudo chmod -R 755 $TESSDATA_PREFIX ; \
sudo sed -i \
-e 's/rights="none" pattern="PDF"/rights="read" pattern="PDF"/g' \
/etc/ImageMagick*/policy.xml \
Expand Down
15 changes: 14 additions & 1 deletion .travis/Dockerfile.debian-slim
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ RUN set -ex; \
# Build environment variables
ENV DOCKER_TAG=travis \
DOCKER_VCS_REF=${TRAVIS_COMMIT} \
DOCKER_BUILD_DATE=${TRAVIS_BUILD_NUMBER}
DOCKER_BUILD_DATE=${TRAVIS_BUILD_NUMBER} \
TESSDATA_PREFIX=/home/$FRAPPE_USER/tessdata \
LC_ALL=C

# Copy the whole repository to app folder for manual install
#COPY --chown=frappe:frappe . "/home/$FRAPPE_USER"/frappe-bench/apps/erpnext_ocr
Expand All @@ -32,12 +34,23 @@ RUN set -ex; \
sudo apt-get install -y --no-install-recommends \
ghostscript \
imagemagick \
libmagickwand-dev \
tesseract-ocr \
libtesseract-dev \
libleptonica-dev \
pkg-config \
; \
sudo rm -rf /var/lib/apt/lists/*; \
mkdir -p $TESSDATA_PREFIX; \
sudo chown -R $FRAPPE_USER:$FRAPPE_USER $TESSDATA_PREFIX ; \
wget -q https://raw.github.com/tesseract-ocr/tessdata/master/eng.traineddata -O $TESSDATA_PREFIX/eng.traineddata; \
wget -q https://raw.github.com/tesseract-ocr/tessdata/master/equ.traineddata -O $TESSDATA_PREFIX/equ.traineddata; \
wget -q https://raw.github.com/tesseract-ocr/tessdata/master/osd.traineddata -O $TESSDATA_PREFIX/osd.traineddata; \
wget -q https://raw.github.com/tesseract-ocr/tessdata/master/fra.traineddata -O $TESSDATA_PREFIX/fra.traineddata; \
wget -q https://raw.github.com/tesseract-ocr/tessdata/master/deu.traineddata -O $TESSDATA_PREFIX/deu.traineddata; \
wget -q https://raw.github.com/tesseract-ocr/tessdata/master/spa.traineddata -O $TESSDATA_PREFIX/spa.traineddata; \
wget -q https://raw.github.com/tesseract-ocr/tessdata/master/por.traineddata -O $TESSDATA_PREFIX/por.traineddata; \
sudo chmod -R 755 $TESSDATA_PREFIX ; \
sudo sed -i \
-e 's/rights="none" pattern="PDF"/rights="read" pattern="PDF"/g' \
/etc/ImageMagick*/policy.xml \
Expand Down
2 changes: 1 addition & 1 deletion .travis/Dockerfile_test → .travis/Dockerfile.test
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM %%IMAGE_NAME%%

ADD docker_test.sh /docker_test.sh
COPY docker_test.sh /docker_test.sh

RUN set -ex; \
sudo chmod 755 /docker_test.sh; \
Expand Down
23 changes: 12 additions & 11 deletions .travis/docker-compose.mariadb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ services:
sut:
build:
context: ./
dockerfile: Dockerfile_test
dockerfile: Dockerfile.test
command: sh /docker_test.sh
# Only for travis-ci, do not name test container in dockerhub
container_name: sut
Expand Down Expand Up @@ -51,8 +51,8 @@ services:
context: ./
dockerfile: Dockerfile.${VARIANT}
args:
- BUILD_BRANCH=${BUILD_BRANCH}
- BUILD_URL=${BUILD_URL}
- BUILD_BRANCH=${BUILD_BRANCH}
- BUILD_URL=${BUILD_URL}
image: ${IMAGE_NAME}
container_name: erpnext_app
command: app
Expand All @@ -73,7 +73,8 @@ services:
- FRAPPE_DEFAULT_SITE=${ERPNEXT_SITE}
- FRAPPE_LOGGING=1
- DEVELOPER_MODE=0
#- Amin user setup
- ALLOW_TESTS=1
# Admin user setup
- ADMIN_PASSWORD=${ERPNEXT_ADMIN_PWD}
- ENCRYPTION_KEY=${ERPNEXT_ENCRYPTION_KEY}
# Database setup
Expand All @@ -90,8 +91,8 @@ services:
- REDIS_QUEUE_HOST=erpnext_redis_queue
- REDIS_SOCKETIO_HOST=erpnext_redis_socketio
volumes:
- /srv/erpnext/frappe/sites:/home/frappe/frappe-bench/sites
- /srv/erpnext/frappe/logs:/home/frappe/frappe-bench/logs
- ${ERPNEXT_HOME}/sites:/home/frappe/frappe-bench/sites
- ${ERPNEXT_HOME}/logs:/home/frappe/frappe-bench/logs
- /etc/localtime:/etc/localtime:ro
- /etc/timezone:/etc/timezone:ro

Expand Down Expand Up @@ -144,7 +145,7 @@ services:
# Docker setup
- DOCKER_APPS_TIMEOUT=900
volumes:
- /srv/erpnext/frappe/sites:/home/frappe/frappe-bench/sites
- ${ERPNEXT_HOME}/sites:/home/frappe/frappe-bench/sites
- /etc/localtime:/etc/localtime:ro
- /etc/timezone:/etc/timezone:ro

Expand All @@ -160,7 +161,7 @@ services:
# Docker setup
- DOCKER_APPS_TIMEOUT=900
volumes:
- /srv/erpnext/frappe/sites:/home/frappe/frappe-bench/sites
- ${ERPNEXT_HOME}/sites:/home/frappe/frappe-bench/sites
- /etc/localtime:/etc/localtime:ro
- /etc/timezone:/etc/timezone:ro

Expand All @@ -176,7 +177,7 @@ services:
# Docker setup
- DOCKER_APPS_TIMEOUT=900
volumes:
- /srv/erpnext/frappe/sites:/home/frappe/frappe-bench/sites
- ${ERPNEXT_HOME}/sites:/home/frappe/frappe-bench/sites
- /etc/localtime:/etc/localtime:ro
- /etc/timezone:/etc/timezone:ro

Expand All @@ -192,7 +193,7 @@ services:
# Docker setup
- DOCKER_APPS_TIMEOUT=900
volumes:
- /srv/erpnext/frappe/sites:/home/frappe/frappe-bench/sites
- ${ERPNEXT_HOME}/sites:/home/frappe/frappe-bench/sites
- /etc/localtime:/etc/localtime:ro
- /etc/timezone:/etc/timezone:ro

Expand All @@ -210,7 +211,7 @@ services:
# Docker setup
- DOCKER_APPS_TIMEOUT=900
volumes:
- /srv/erpnext/frappe/sites:/home/frappe/frappe-bench/sites
- ${ERPNEXT_HOME}/sites:/home/frappe/frappe-bench/sites
- /etc/localtime:/etc/localtime:ro
- /etc/timezone:/etc/timezone:ro

Expand Down
Loading

0 comments on commit ac82e04

Please sign in to comment.