forked from OCA/OpenUpgrade
-
Notifications
You must be signed in to change notification settings - Fork 0
163 lines (160 loc) · 5.75 KB
/
test.yml
File metadata and controls
163 lines (160 loc) · 5.75 KB
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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
# 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: Test OpenUpgrade migration
on:
push:
branches: ["18.0*"]
pull_request:
jobs:
test:
runs-on: ubuntu-22.04
env:
DB: "openupgrade"
DB_HOST: "localhost"
DB_PASSWORD: "odoo"
DB_PORT: 5432
DB_USERNAME: "odoo"
DOWNLOADS: https://github.com/OCA/OpenUpgrade/releases/download/databases
ODOO: "./odoo/odoo-bin"
PGHOST: "localhost"
PGPASSWORD: "odoo"
PGUSER: "odoo"
OPENUPGRADE_USE_DEMO: "yes"
services:
postgres:
image: postgres:14.0
env:
POSTGRES_USER: odoo
POSTGRES_PASSWORD: odoo
POSTGRES_DB: odoo
ports:
- 5432:5432
steps:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Sleep for 10 seconds
run: sleep 10s
- name: DB Creation
run: createdb $DB
- name: DB Restore
run: |
wget -q -O- $DOWNLOADS/17.0.psql | pg_restore -d $DB --no-owner
psql $DB -c "UPDATE ir_module_module SET demo=False"
- name: Check out Odoo
uses: actions/checkout@v4
with:
repository: odoo/odoo
ref: "18.0"
fetch-depth: 1
path: odoo
- name: Check out previous Odoo
uses: actions/checkout@v4
with:
repository: odoo/odoo
ref: "17.0"
fetch-depth: 1
path: odoo-old
- name: Check out OpenUpgrade
uses: actions/checkout@v4
with:
path: openupgrade
- name: Configuration
run: |
sudo apt update
sudo apt install \
expect \
expect-dev \
libevent-dev \
libldap2-dev \
libsasl2-dev \
libxml2-dev \
libxslt1-dev \
nodejs \
python3-lxml \
python3-passlib \
python3-psycopg2 \
python3-serial \
python3-simplejson \
python3-werkzeug \
python3-yaml \
unixodbc-dev
- name: Requirements Installation
run: |
sed -i -E "s/(gevent==)21\.8\.0( ; sys_platform != 'win32' and python_version == '3.10')/\122.10.2\2/;s/(greenlet==)1.1.2( ; sys_platform != 'win32' and python_version == '3.10')/\12.0.2\2/" odoo/requirements.txt
sed -i -E "s/(^cbor2==)5\.4\.2/\15.6.2/" odoo/requirements.txt
pip install -q -r odoo/requirements.txt
pip install -r ./openupgrade/requirements.txt
pip install -U git+https://github.com/oca/openupgradelib
# this is for v16 l10n_eg_edi_eta which crashes without it
pip install asn1crypto
pip install coverage
# this is for account_peppol
pip install phonenumbers
- name: Test data
run: |
if test -n "$(ls openupgrade/openupgrade_scripts/scripts/*/tests/data*.py 2> /dev/null)"; then
for snippet in openupgrade/openupgrade_scripts/scripts/*/tests/data*.py; do
odoo-old/odoo-bin shell -d $DB < $snippet
done
fi
- name: OpenUpgrade test
run: |
# select modules and perform the upgrade
MODULES_OLD=$(\
sed -n '/^+========/,$p' \
openupgrade/docsource/modules170-180.rst \
| grep "Done\|Partial\|Nothing" \
| grep -v "theme_" \
| sed -rn 's/((^\| *\|del\| *)|^\| *)([0-9a-z_]*)[ \|].*/\3/g p' \
| sed '/^\s*$/d' \
| paste -d, -s)
MODULES_NEW=$(\
sed -n '/^+========/,$p' \
openupgrade/docsource/modules170-180.rst \
| grep "Done\|Partial\|Nothing" \
| grep -v "theme_" \
| sed -rn 's/((^\| *\|new\| *)|^\| *)([0-9a-z_]*)[ \|].*/\3/g p' \
| sed '/^\s*$/d' \
| paste -d, -s)
if [ -z "$MODULES_NEW" ]; then
echo "No modules to test yet"
exit
fi
REQUEST="update ir_module_module set state='uninstalled' \
where name not in ('$(echo $MODULES_OLD | sed -e "s/,/','/g")')"
echo Set the modules as not installable if they are not in the following list : $MODULES_OLD
echo Running $REQUEST
psql $DB -c "$REQUEST"
ADDONS_PATHS="\
$GITHUB_WORKSPACE/odoo/addons \
$GITHUB_WORKSPACE/odoo/odoo/addons \
$GITHUB_WORKSPACE/openupgrade"
echo Execution of Openupgrade with the update of the following modules : $MODULES_NEW
# Silence redundant logs from unlinking records (1 line is enough)
# to prevent log overflow
coverage run \
--source=$GITHUB_WORKSPACE/openupgrade/openupgrade_scripts/scripts \
$ODOO \
--addons-path=`echo $ADDONS_PATHS | awk -v OFS="," '$1=$1'` \
--database=$DB \
--db_host=$DB_HOST \
--db_password=$DB_PASSWORD \
--db_port=$DB_PORT \
--db_user=$DB_USERNAME \
--load=base,web,openupgrade_framework \
--test-enable \
--test-tags openupgrade \
--log-handler odoo.models.unlink:WARNING \
--stop-after-init \
--without-demo=$MODULES_NEW \
--update=$MODULES_NEW
- name: Generate coverage.xml
run: coverage xml
- uses: codecov/codecov-action@v4
with:
files: coverage.xml
token: ${{ secrets.CODECOV_TOKEN }}