Merge pull request #4213 from sergiocorato/14.0-fix-pre-commit #176
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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: | |
- "14.0" | |
- "14.0-ocabot-*" | |
pull_request: | |
branches: | |
- "14.0*" | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
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" | |
steps: | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.7 | |
- name: Configure Postgres | |
uses: harmon758/postgresql-action@v1 | |
with: | |
postgresql version: "10" | |
postgresql user: ${DB_USERNAME} | |
postgresql password: ${DB_PASSWORD} | |
- name: Wait / Sleep | |
uses: jakejarvis/wait-action@v0.1.0 | |
with: | |
time: "10s" | |
- name: DB Creation | |
run: createdb $DB | |
- name: DB Restore | |
run: | | |
# psql -d $DB -c "DROP SCHEMA IF EXISTS PUBLIC;" | |
wget -q -O- $DOWNLOADS/13.0.psql | pg_restore -d $DB --no-owner | |
# TODO: create test data in Odoo 13.0 which does not support yml | |
# anymore | |
# Roundtrip to previous release to update the test database with | |
# additional test data | |
# - git fetch --depth 2 origin 13.0 | |
# - git reset --hard `git ls-remote \ | |
# | grep refs/heads/13.0 \ | |
# | awk '{print $1}'` | |
# - pip install -q -r requirements.txt | |
# Line below may fail quite often due to Travis bug: | |
# - git reset -q --hard $TRAVIS_COMMIT | |
# Install Python requirements of target release | |
- name: Check out Odoo | |
uses: actions/checkout@v2 | |
with: | |
repository: odoo/odoo | |
ref: "14.0" | |
fetch-depth: 1 | |
path: odoo | |
- name: Check out OpenUpgrade | |
uses: actions/checkout@v2 | |
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 | |
- name: Requirements Installation | |
run: | | |
sudo npm install -g less less-plugin-clean-css | |
pip install -q -r odoo/requirements.txt | |
pip install --ignore-installed \ | |
git+https://github.com/OCA/openupgradelib.git@master | |
# select modules and perform the upgrade | |
- name: OpenUpgrade test | |
run: | | |
MODULES_OLD=base,$(\ | |
sed -n '/^+========/,$p' \ | |
openupgrade/docsource/modules130-140.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=base,$(\ | |
sed -n '/^+========/,$p' \ | |
openupgrade/docsource/modules130-140.rst \ | |
| grep "Done\|Partial\|Nothing" \ | |
| grep -v "theme_" \ | |
| sed -rn 's/((^\| *\|new\| *)|^\|)([0-9a-z_]*) *\|.*$/\3/g p' \ | |
| sed '/^\s*$/d' \ | |
| paste -d, -s) | |
psql $DB -c "update ir_module_module set state='uninstalled' \ | |
where name not in ('$(echo $MODULES_OLD | sed -e "s/,/','/g")')" | |
ADDONS_PATHS="\ | |
$GITHUB_WORKSPACE/odoo/addons \ | |
$GITHUB_WORKSPACE/odoo/odoo/addons \ | |
$GITHUB_WORKSPACE/openupgrade" | |
echo Testing modules $MODULES_NEW | |
# Silence redundant logs from unlinking records (1 line is enough) | |
# to prevent log overflow | |
OPENUPGRADE_TESTS=1 $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 \ | |
--log-handler odoo.models.unlink:WARNING \ | |
--stop-after-init \ | |
--update=$MODULES_NEW |