Skip to content

Commit

Permalink
WIP: add github actions for som_gkwh
Browse files Browse the repository at this point in the history
  • Loading branch information
MarJene committed Aug 17, 2022
1 parent af0b0fc commit 5af4bdc
Showing 1 changed file with 128 additions and 0 deletions.
128 changes: 128 additions & 0 deletions .github/workflows/som_generation_integration_config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
# 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.7" ]
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 }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Download required repositories
env:
GITHUB_TOKEN: ${{ secrets.PAT_GITHUB_TOKEN }}
run: |
eval `ssh-agent -s`
export ROOT_DIR_SRC=${{github.workspace}}/..
git clone --depth 1 git@github.com:Som-Energia/openerp_som_addons.git $ROOT_DIR_SRC/openerp_som_addons
git clone --depth 1 https://$GITHUB_TOKEN@github.com/gisce/erp.git -b developer $ROOT_DIR_SRC/erp
git clone --depth 1 git@github.com:Som-Energia/somenergia-generationkwh.git $ROOT_DIR_SRC/somenergia-generationkwh
git clone --depth 1 git@github.com:gisce/oorq.git -b api_v5 $ROOT_DIR_SRC/oorq
git clone --depth 1 git@github.com:gisce/spawn_oop.git $ROOT_DIR_SRC/spawn_oop
git clone --depth 1 git@github.com:gisce/poweremail.git $ROOT_DIR_SRC/poweremail2
git clone --depth 1 git@github.com:gisce/openerp-sentry.git -b v5_legacy $ROOT_DIR_SRC/openerp-sentry
git clone --depth 1 git@github.com:gisce/ws_transactions.git $ROOT_DIR_SRC/ws_transactions
git clone --depth 1 git@github.com:gisce/ir_attachment_mongodb.git $ROOT_DIR_SRC/ir_attachment_mongodb
git clone --depth 1 git@github.com:gisce/mongodb_backend.git -b gisce $ROOT_DIR_SRC/mongodb_backend
git clone --depth 1 git@github.com:gisce/poweremail-modules.git $ROOT_DIR_SRC/poweremail-modules
git clone --depth 1 git@github.com:gisce/crm_poweremail.git $ROOT_DIR_SRC/crm_poweremail
git clone --depth 1 https://$GITHUB_TOKEN@github.com/gisce/libFacturacioATR.git $ROOT_DIR_SRC/libFacturacioATR
git clone --depth 1 git@github.com:gisce/ooop.git $ROOT_DIR_SRC/ooop
- 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 .
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 --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

0 comments on commit 5af4bdc

Please sign in to comment.