Skip to content

Change journal behaviour to remove cash journals and use sales/purchases #95

Change journal behaviour to remove cash journals and use sales/purchases

Change journal behaviour to remove cash journals and use sales/purchases #95

# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: SOM_GENERATIONKWH
on:
pull_request:
branches: [ master ]
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
env:
POSTGRES_USER: erp
POSTGRES_PASSWORD: erp
jobs:
build:
runs-on: ubuntu-latest
strategy:
# You can use PyPy versions in python-version.
# For example, pypy2 and pypy3
fail-fast: false
matrix:
python-version: [ "2.7", "3.10" ]
services:
postgres:
image: timescale/timescaledb-postgis:latest-pg12
env:
POSTGRES_USER: erp
POSTGRES_PASSWORD: erp
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
# Maps tcp port 5432 on service container to the host
- 5432:5432
redis:
image: redis:5.0
ports:
# Maps tcp port 6379 on service container to the host
- 6379:6379
mongo:
image: mongo:3.0
ports:
- 27017:27017
steps:
- name: Set up Python ${{ matrix.python-version }}
if: matrix.python-version != '2.7'
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Set up Python 2.7
if: matrix.python-version == '2.7'
run: |
sudo apt-get update
sudo apt-get install -y python2.7 python2.7-dev
sudo ln -sf python2.7 /usr/bin/python
curl https://bootstrap.pypa.io/pip/2.7/get-pip.py -o get-pip.py
python get-pip.py
rm get-pip.py
pip install --upgrade pip setuptools wheel
- name: Download required repositories
env:
GITHUB_TOKEN: ${{ secrets.PAT_GITHUB_TOKEN }}
run: |
eval `ssh-agent -s`
ssh-add - <<< '${{ secrets.DEPLOY_KEY }}'
export ROOT_DIR_SRC=${{github.workspace}}/..
git clone --depth 1 [email protected]:Som-Energia/openerp_som_addons.git $ROOT_DIR_SRC/openerp_som_addons
git clone --depth 1 https://[email protected]/gisce/erp.git -b developer $ROOT_DIR_SRC/erp
git clone --depth 1 [email protected]:Som-Energia/somenergia-generationkwh.git -b ${{ github.head_ref }} $ROOT_DIR_SRC/somenergia-generationkwh
git clone --depth 1 [email protected]:Som-Energia/plantmeter.git $ROOT_DIR_SRC/plantmeter
git clone --depth 1 [email protected]:gisce/oorq.git -b api_v5 $ROOT_DIR_SRC/oorq
git clone --depth 1 [email protected]:gisce/spawn_oop.git $ROOT_DIR_SRC/spawn_oop
git clone --depth 1 [email protected]:gisce/poweremail.git $ROOT_DIR_SRC/poweremail2
git clone --depth 1 [email protected]:gisce/openerp-sentry.git -b v5_legacy $ROOT_DIR_SRC/openerp-sentry
git clone --depth 1 [email protected]:gisce/ws_transactions.git $ROOT_DIR_SRC/ws_transactions
git clone --depth 1 [email protected]:gisce/ir_attachment_mongodb.git $ROOT_DIR_SRC/ir_attachment_mongodb
git clone --depth 1 [email protected]:gisce/mongodb_backend.git -b gisce $ROOT_DIR_SRC/mongodb_backend
git clone --depth 1 [email protected]:gisce/poweremail-modules.git $ROOT_DIR_SRC/poweremail-modules
git clone --depth 1 [email protected]:gisce/crm_poweremail.git $ROOT_DIR_SRC/crm_poweremail
git clone --depth 1 https://[email protected]/gisce/libFacturacioATR.git $ROOT_DIR_SRC/libFacturacioATR
git clone --depth 1 [email protected]:gisce/ooop.git $ROOT_DIR_SRC/ooop
git clone --depth 1 [email protected]:Som-Energia/giscedata_facturacio_indexada_som.git $ROOT_DIR_SRC/giscedata_facturacio_indexada_som
- name: Install dependencies
run: |
sudo apt-get --allow-releaseinfo-change update
sudo apt-get install python2-dev python3-dev libxml2-dev libxmlsec1 libxmlsec1-dev libgdal-dev -y
export ROOT_DIR_SRC=${{github.workspace}}/..
cd $ROOT_DIR_SRC
pip install virtualenv
virtualenv venv
. $ROOT_DIR_SRC/venv/bin/activate
cd $ROOT_DIR_SRC/libFacturacioATR
git checkout $(git describe --tags `git rev-list --tags --max-count=1`)
pip install -e .
pip install somutils==1.7.2
cd $ROOT_DIR_SRC/somenergia-generationkwh
pip install -e .
cd $ROOT_DIR_SRC/plantmeter
pip install -e .
cd $ROOT_DIR_SRC/ooop
git checkout $(git describe --tags `git rev-list --tags --max-count=1`)
pip install -e .
cd $ROOT_DIR_SRC
pip install -r $ROOT_DIR_SRC/erp/requirements-dev.txt
pip install -r $ROOT_DIR_SRC/erp/requirements.txt
pip install -r $ROOT_DIR_SRC/oorq/requirements.txt
#pip install --upgrade --force-reinstall https://github.com/gisce/destral/archive/master.zip
#pip install destral==1.7.3
- name: Link Addons
run: |
export ROOT_DIR_SRC=${{github.workspace}}/..
. $ROOT_DIR_SRC/venv/bin/activate
cd $ROOT_DIR_SRC/erp && ./tools/link_addons.sh
- name: Run Tests
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ESIOS_TOKEN: ${{ secrets.ESIOS_TOKEN }}
SRID: ${{ secrets.SRID }}
run: |
export ROOT_DIR_SRC=${{github.workspace}}/..
export CI_REPO=som-energia/openerp_som_addons
export CI_PULL_REQUEST=${{ github.event.number }}
export ROOT_DIR_SRC=${{github.workspace}}/..
. $ROOT_DIR_SRC/venv/bin/activate
export PYTHONPATH=${{github.workspace}}/../erp/server/bin:${{github.workspace}}/../erp/server/bin/addons:${{github.workspace}}/../erp/server/sitecustomize
export OPENERP_PRICE_ACCURACY=6
export OORQ_ASYNC=False
export OPENERP_SRID=$SRID
export OPENERP_ESIOS_TOKEN=$ESIOS_TOKEN
export OPENERP_MONGODB_HOST=localhost
export OPENERP_REDIS_URL=redis://localhost:6379
export OPENERP_ROOT_PATH=${{github.workspace}}/../erp/server/bin
export OPENERP_ADDONS_PATH=$OPENERP_ROOT_PATH/addons
export OPENERP_DB_HOST=localhost
export OPENERP_DB_USER=$POSTGRES_USER
export OPENERP_DB_PASSWORD=$POSTGRES_PASSWORD
cd ${{github.workspace}}
destral -m som_generationkwh --report-coverage --enable-coverage --report-junitxml ${{github.workspace}}/test-results/destral
- name: Publish Unit Test Results
if: (success() || failure()) && matrix.python-version == '2.7' && github.event_name == 'pull_request'
uses: EnricoMi/publish-unit-test-result-action@v1
with:
files: test-results/destral/*.xml