-
Notifications
You must be signed in to change notification settings - Fork 0
148 lines (144 loc) · 6.76 KB
/
som_generation_integration_config.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
# 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