Skip to content

Commit 07577a5

Browse files
committed
init
0 parents  commit 07577a5

30 files changed

+470
-0
lines changed
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
name: MSSQL - Automated CI testing
2+
# This workflow run automatically for every commit on github it checks the syntax and launch the tests.
3+
# | grep . | uniq -c filters out empty lines and then groups consecutive lines together with the number of occurrences
4+
on:
5+
pull_request:
6+
workflow_dispatch:
7+
inputs:
8+
comment:
9+
description: Just a simple comment to know the purpose of the manual build
10+
required: false
11+
12+
jobs:
13+
run_test:
14+
runs-on: ubuntu-20.04
15+
services:
16+
mssql:
17+
image: mcr.microsoft.com/mssql/server:2017-latest
18+
env:
19+
ACCEPT_EULA: Y
20+
SA_PASSWORD: GitHub999
21+
ports:
22+
- 1433:1433
23+
# needed because the mssql container does not provide a health check
24+
options: --health-interval=10s --health-timeout=3s --health-start-period=10s --health-retries=10 --health-cmd="/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P ${SA_PASSWORD} -Q 'SELECT 1' || exit 1"
25+
26+
steps:
27+
- name: Set up Python 3.8
28+
uses: actions/setup-python@v2
29+
with:
30+
python-version: 3.8
31+
- name: install linux packages
32+
run: |
33+
wget https://raw.githubusercontent.com/openimis/database_ms_sqlserver/main/Empty%20databases/openIMIS_ONLINE.sql -O openIMIS_ONLINE.sql
34+
wget https://raw.githubusercontent.com/openimis/database_ms_sqlserver/main/Demo%20database/openIMIS_demo_ONLINE.sql -O openIMIS_demo_ONLINE.sql
35+
curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
36+
curl https://packages.microsoft.com/config/ubuntu/20.04/prod.list | sudo tee /etc/apt/sources.list.d/msprod.list
37+
sudo apt-get update
38+
sudo ACCEPT_EULA=Y apt-get install -y mssql-tools build-essential dialog apt-utils unixodbc-dev -y
39+
python -m pip install --upgrade pip
40+
- name: pull openimis backend
41+
run: |
42+
rm ./openimis -rf
43+
git clone --depth 1 --branch develop https://github.com/openimis/openimis-be_py.git ./openimis
44+
- name: copy current branch
45+
uses: actions/checkout@v2
46+
with:
47+
path: './current-module'
48+
- name: Update the configuration
49+
working-directory: ./openimis
50+
run: |
51+
export MODULE_NAME="$(echo $GITHUB_REPOSITORY | sed 's#^openimis/openimis-be-\(.*\)_py$#\1#')"
52+
echo "the local module called $MODULE_NAME will be injected in openIMIS .json"
53+
jq --arg name "$MODULE_NAME" 'if [.modules[].name == ($name)]| max then (.modules[] | select(.name == ($name)) | .pip)|="../current-module" else .modules |= .+ [{name:($name), pip:"../current-module"}] end' openimis.json
54+
echo $(jq --arg name "$MODULE_NAME" 'if [.modules[].name == ($name)]| max then (.modules[] | select(.name == ($name)) | .pip)|="../current-module" else .modules |= .+ [{name:($name), pip:"../current-module"}] end' openimis.json) > openimis.json
55+
- name: Install openIMIS Python dependencies
56+
working-directory: ./openimis
57+
run: |
58+
pip install -r requirements.txt
59+
python modules-requirements.py openimis.json > modules-requirements.txt
60+
cat modules-requirements.txt
61+
pip install -r modules-requirements.txt
62+
- name: Environment info
63+
working-directory: ./openimis
64+
run: |
65+
pip list
66+
- name: Initialize DB
67+
run: |
68+
/opt/mssql-tools/bin/sqlcmd -S localhost,1433 -U SA -P $SA_PASSWORD -Q 'DROP DATABASE IF EXISTS imis'
69+
/opt/mssql-tools/bin/sqlcmd -S localhost,1433 -U SA -P $SA_PASSWORD -Q 'CREATE DATABASE imis'
70+
/opt/mssql-tools/bin/sqlcmd -S localhost,1433 -U SA -P $SA_PASSWORD -d imis -i openIMIS_ONLINE.sql | grep . | uniq -c
71+
/opt/mssql-tools/bin/sqlcmd -S localhost,1433 -U SA -P $SA_PASSWORD -d imis -i openIMIS_demo_ONLINE.sql | grep . | uniq -c
72+
env:
73+
SA_PASSWORD: GitHub999
74+
ACCEPT_EULA: Y
75+
76+
# - name: Check formatting with black
77+
# run: |
78+
# black --check .
79+
80+
- name: Django tests
81+
working-directory: ./openimis/openIMIS
82+
run: |
83+
export MODULE_NAME="$(echo $GITHUB_REPOSITORY | sed 's#^openimis/openimis-be-\(.*\)_py$#\1#')"
84+
python -V
85+
ls -l
86+
python manage.py migrate
87+
python init_test_db.py | grep . | uniq -c
88+
python manage.py test --keepdb $MODULE_NAME
89+
env:
90+
SECRET_KEY: secret
91+
DEBUG: true
92+
#DJANGO_SETTINGS_MODULE: hat.settings
93+
DB_HOST: localhost
94+
DB_PORT: 1433
95+
DB_NAME: imis
96+
DB_USER: sa
97+
DB_PASSWORD: GitHub999
98+
#DEV_SERVER: true
99+
SITE_ROOT: api
100+
REMOTE_USER_AUTHENTICATION: True
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: POSTGRES - Automated CI testing
2+
# This workflow run automatically for every commit on github it checks the syntax and launch the tests.
3+
# | grep . | uniq -c filters out empty lines and then groups consecutive lines together with the number of occurrences
4+
on:
5+
pull_request:
6+
workflow_dispatch:
7+
inputs:
8+
comment:
9+
description: Just a simple comment to know the purpose of the manual build
10+
required: false
11+
12+
jobs:
13+
run_test:
14+
runs-on: ubuntu-20.04
15+
services:
16+
psql:
17+
image: ghcr.io/openimis/openimis-pgsql:develop
18+
env:
19+
POSTGRES_PASSWORD: postgres
20+
POSTGRES_DB: IMIS
21+
POSTGRES_USER: postgres
22+
ports:
23+
- 1433:5432
24+
options: >-
25+
--health-cmd pg_isready
26+
--health-interval 10s
27+
--health-timeout 5s
28+
--health-retries 5
29+
steps:
30+
- name: Set up Python 3.8
31+
uses: actions/setup-python@v2
32+
with:
33+
python-version: 3.8
34+
- name: Setup PostgreSQL
35+
run: |
36+
sudo apt-get -yqq install libpq-dev
37+
python -m pip install psycopg2-binary
38+
- name: Pull openIMIS Backend
39+
run: |
40+
rm ./openimis -rf
41+
git clone --depth 1 --branch coreMIS https://github.com/openimis/openimis-be_py.git ./openimis
42+
- name: Copy Current branch
43+
uses: actions/checkout@v2
44+
with:
45+
path: './current-module'
46+
- name: Update the configuration
47+
working-directory: ./openimis
48+
run: |
49+
export MODULE_NAME="$(echo $GITHUB_REPOSITORY | sed 's#^openimis/openimis-be-\(.*\)_py$#\1#')"
50+
echo "the local module called $MODULE_NAME will be injected in openIMIS .json"
51+
jq --arg name "$MODULE_NAME" 'if [.modules[].name == ($name)]| max then (.modules[] | select(.name == ($name)) | .pip)|="../current-module" else .modules |= .+ [{name:($name), pip:"../current-module"}] end' openimis.json
52+
echo $(jq --arg name "$MODULE_NAME" 'if [.modules[].name == ($name)]| max then (.modules[] | select(.name == ($name)) | .pip)|="../current-module" else .modules |= .+ [{name:($name), pip:"../current-module"}] end' openimis.json) > openimis.json
53+
- name: Install openIMIS Python dependencies
54+
working-directory: ./openimis
55+
run: |
56+
pip install -r requirements.txt
57+
python modules-requirements.py openimis.json > modules-requirements.txt
58+
cat modules-requirements.txt
59+
pip install -r modules-requirements.txt
60+
- name: Django tests
61+
working-directory: ./openimis/openIMIS
62+
run: |
63+
export MODULE_NAME="$(echo $GITHUB_REPOSITORY | sed 's#^openimis/openimis-be-\(.*\)_py$#\1#')"
64+
python manage.py migrate
65+
python manage.py showmigrations
66+
python init_test_db.py | grep . | uniq -c
67+
python manage.py test --keep $MODULE_NAME
68+
env:
69+
SECRET_KEY: secret
70+
DEBUG: true
71+
#DJANGO_SETTINGS_MODULE: hat.settings
72+
DB_HOST: localhost
73+
DB_PORT: 1433
74+
DB_NAME: IMIS
75+
DB_USER: postgres
76+
DB_PASSWORD: postgres
77+
#DEV_SERVER: true
78+
SITE_ROOT: api
79+
REMOTE_USER_AUTHENTICATION: True
80+
DB_ENGINE: django.db.backends.postgresql
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# This workflows will upload a Python Package using Twine when a release is created
2+
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
3+
4+
name: Upload Python Package
5+
6+
on:
7+
release:
8+
types: [created]
9+
10+
jobs:
11+
deploy:
12+
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: olegtarasov/[email protected]
17+
id: tagName
18+
- uses: actions/checkout@v2
19+
- name: Set up Python
20+
uses: actions/setup-python@v2
21+
with:
22+
python-version: '3.x'
23+
- name: Install dependencies
24+
run: |
25+
python -m pip install --upgrade pip
26+
pip install setuptools wheel twine jq
27+
28+
- name: update setup.py
29+
run: |
30+
echo "tag to use $GIT_TAG_NAME"
31+
sed -i "s/version='.*'/version='$GIT_TAG_NAME'/g" setup.py
32+
- name: Build and publish
33+
env:
34+
TWINE_USERNAME: __token__
35+
TWINE_PASSWORD: ${{secrets.PYPI_TOKEN}}
36+
run: |
37+
python setup.py sdist bdist_wheel
38+
twine upload dist/*

.gitignore

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
build/
12+
develop-eggs/
13+
dist/
14+
downloads/
15+
eggs/
16+
.eggs/
17+
lib/
18+
lib64/
19+
parts/
20+
sdist/
21+
var/
22+
wheels/
23+
pip-wheel-metadata/
24+
share/python-wheels/
25+
*.egg-info/
26+
.installed.cfg
27+
*.egg
28+
MANIFEST
29+
30+
# PyInstaller
31+
# Usually these files are written by a python script from a template
32+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
33+
*.manifest
34+
*.spec
35+
36+
# Installer logs
37+
pip-log.txt
38+
pip-delete-this-directory.txt
39+
40+
# Unit test / coverage reports
41+
htmlcov/
42+
.tox/
43+
.nox/
44+
.coverage
45+
.coverage.*
46+
.cache
47+
nosetests.xml
48+
coverage.xml
49+
*.cover
50+
*.py,cover
51+
.hypothesis/
52+
.pytest_cache/
53+
54+
# Translations
55+
*.mo
56+
*.pot
57+
58+
# Django stuff:
59+
*.log
60+
local_settings.py
61+
db.sqlite3
62+
db.sqlite3-journal
63+
64+
# Flask stuff:
65+
instance/
66+
.webassets-cache
67+
68+
# Scrapy stuff:
69+
.scrapy
70+
71+
# Sphinx documentation
72+
docs/_build/
73+
74+
# PyBuilder
75+
target/
76+
77+
# Jupyter Notebook
78+
.ipynb_checkpoints
79+
80+
# IPython
81+
profile_default/
82+
ipython_config.py
83+
84+
# pyenv
85+
.python-version
86+
87+
# pipenv
88+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
89+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
90+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
91+
# install all needed dependencies.
92+
#Pipfile.lock
93+
94+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
95+
__pypackages__/
96+
97+
# Celery stuff
98+
celerybeat-schedule
99+
celerybeat.pid
100+
101+
# SageMath parsed files
102+
*.sage.py
103+
104+
# Environments
105+
.env
106+
.venv
107+
env/
108+
venv/
109+
ENV/
110+
env.bak/
111+
venv.bak/
112+
113+
# Spyder project settings
114+
.spyderproject
115+
.spyproject
116+
117+
# Rope project settings
118+
.ropeproject
119+
120+
# mkdocs documentation
121+
/site
122+
123+
# mypy
124+
.mypy_cache/
125+
.dmypy.json
126+
dmypy.json
127+
128+
# Pyre type checker
129+
.pyre/

LICENSE.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
2+
The program users must agree to the following terms:
3+
4+
License notices
5+
This program is free software: you can redistribute it and/or modify it under the terms of the GNU AGPL v3 License as published by the Free Software Foundation, version 3 of the License.
6+
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL v3 License for more details www.gnu.org.
7+
8+
Disclaimer of Warranty
9+
There is no warranty for the program, to the extent permitted by applicable law; except when otherwise stated in writing the copyright holders and/or other parties provide the program "as is" without warranty of any kind, either expressed or implied, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose. The entire risk as to the quality and performance of the program is with you. Should the program prove defective, you assume the cost of all necessary servicing, repair or correction.
10+
11+
Limitation of Liability
12+
In no event unless required by applicable law or agreed to in writing will any copyright holder, or any other party who modifies and/or conveys the program as permitted above, be liable to you for damages, including any general, special, incidental or consequential damages arising out of the use or inability to use the program (including but not limited to loss of data or data being rendered inaccurate or losses sustained by you or third parties or a failure of the program to operate with any other programs), even if such holder or other party has been advised of the possibility of such damages.
13+
14+
In case of dispute arising out or in relation to the use of the program, it is subject to the public law of Switzerland. The place of jurisdiction is Berne.

MANIFEST.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
include LICENSE.md
2+
include README.md

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# openIMIS Backend payroll reference module
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
Metadata-Version: 2.1
2+
Name: openimis-be-payroll
3+
Version: 1.0.0
4+
Summary: The openIMIS Backend payroll reference module.
5+
Home-page: https://openimis.org/
6+
Author: Kamil Malinowski
7+
Author-email: [email protected]
8+
License: GNU AGPL v3
9+
Platform: UNKNOWN
10+
Classifier: Environment :: Web Environment
11+
Classifier: Framework :: Django
12+
Classifier: Framework :: Django :: 3.0
13+
Classifier: Intended Audience :: Developers
14+
Classifier: License :: OSI Approved :: GNU Affero General Public License v3
15+
Classifier: Operating System :: OS Independent
16+
Classifier: Programming Language :: Python
17+
Classifier: Programming Language :: Python :: 3.8
18+
Description-Content-Type: text/markdown
19+
License-File: LICENSE.md
20+
21+
# openIMIS Backend payroll reference module
22+
23+

0 commit comments

Comments
 (0)