Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
76ae6e5
17.0 - Initial setup
legalsylvain Nov 8, 2023
9d08c2c
[INIT] Adapt to V17
legalsylvain Nov 8, 2023
99e52e4
[INIT] Realy disable .github/workflows/test.yml because the openupgra…
legalsylvain Nov 8, 2023
3ab840d
[MIG] openupgrade_scripts: scaffolding the 17.0 module
StefanRijnhart Feb 2, 2024
4c50ce2
[BOT] post-merge updates
OCA-git-bot Feb 27, 2024
15ab0a7
[FIX] define openupgradelib git url in test-requirements.txt
legalsylvain Feb 28, 2024
d2bb4f8
[BOT] post-merge updates
OCA-git-bot Feb 28, 2024
c194c22
[IMP] openupgrade_framework: pre-commit auto fixes and enable
royle-vietnam May 14, 2024
931800c
[MIG] openupgrade_framework v17
daiduongnguyen-odoo May 22, 2024
7b9bfd4
[INIT] 18.0: Replace version numbers.
legalsylvain Sep 30, 2024
f5c787f
[FIX] Don't execute regular tests
pedrobaeza Oct 11, 2024
53f1dab
[OU-ADD] enable tests, add decorator to make them convenient to use
hbrunn Nov 18, 2024
5e13a6d
[OU-FIX] apply doodba's patch to fix building gevent
hbrunn Nov 18, 2024
6fbacaf
[OU-ADD] explicitly disable loading demo data
hbrunn Nov 18, 2024
d20d530
[OU-ADD] enable coverage/codecov
hbrunn Nov 30, 2024
182b169
[ADD] install openupgradelib from github
hbrunn Jan 20, 2025
127fb34
[IMP] copier and github workflows
MiquelRForgeFlow Feb 13, 2025
a1a1f7b
[BOT] post-merge updates
OCA-git-bot Mar 21, 2025
5ab2d73
[ADD] update analysis bot
hbrunn Mar 24, 2025
0c7d80e
[IMP] pin random github actions to their SHA commit
hbrunn Mar 31, 2025
2537be8
[IMP] analysis bot: reword commit message and PR title
hbrunn May 26, 2025
8e80961
[ADD] install phonenumbers in ci as it's a hard dependency for
hbrunn May 26, 2025
ec9adae
[FIX] github workflow: cbor2 issues
MiquelRForgeFlow Aug 11, 2025
0e0223e
[UPD] 19.0: Replace version numbers.
hbrunn Oct 3, 2025
e50d5a6
[FIX] 19.0: pre-commit
hbrunn Oct 3, 2025
53089ef
[IMP] run test migration in the same cases as standard tests
hbrunn Oct 3, 2025
5c60cd8
[IMP] download test database from current repository
hbrunn Oct 3, 2025
9e685a4
[ADD] .prettierignore from v18
hbrunn Oct 3, 2025
dfaf7f7
[IMP] CI: skip tests after test migration if there are no modules
hbrunn Dec 25, 2025
a1ec565
[UPD] README.rst
OCA-git-bot Dec 25, 2025
ab09ac3
[FIX] install dependencies for v18
hbrunn Nov 7, 2025
95fdc1a
[FIX] pin setuptools to v81.0
hbrunn Feb 9, 2026
c22fe77
[FIX] cbor2 patch not necessary any more
hbrunn Mar 30, 2026
a76cf65
[ADD] funding options
thomaspaulb Mar 30, 2026
a469751
[IMP] allow to generate test databases manually
hbrunn Sep 26, 2025
1919e3b
[UPD] add v19 database generation
hbrunn Sep 26, 2025
331e265
[IMP] add a github workflow that generates test databases used in CI
hbrunn Sep 12, 2025
c2cee3f
[IMP] ignore upgrade_general_log.txt when looking for changed modules
hbrunn Sep 26, 2025
0b04fd9
[FIX] generate-{analysis,testdb}: pin version of google-auth
hbrunn Feb 2, 2026
97befb9
[ADD] code import from https://github.com/grap/openupgrade-extra-tools
legalsylvain Jun 23, 2026
85a90d0
[ADD] check dependency action
hbrunn Jun 23, 2026
f617a1b
[IMP] check_dependency: don't set blocked label
hbrunn Jul 7, 2026
4e3b48e
[IMP] point to the v20 crowdfunding
hbrunn Sep 8, 2026
a4c0b4f
[UPD] 20.0: Replace version numbers.
hbrunn Sep 29, 2026
c56c4ee
[INIT] 20.0: Initialize apriori.py file.
hbrunn Sep 29, 2026
b6b9c37
[FIX] : pre-commit
hbrunn Sep 29, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
custom: ["https://www.odoo-community.org/crowdfunding/oca-open-upgrade-v20-8", "https://dir.floss.fund/view/funding/@odoo-community.org"]
17 changes: 17 additions & 0 deletions .github/actions/check-pr-dependency/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: 'Check PR dependencies'
description: 'List PR dependencies in comment, set labels Dependency OK, Blocked by dependency'
inputs:
version:
description: 'OpenUpgrade version'
required: true
branding:
icon: 'git-merge'
color: 'yellow'
runs:
using: "composite"
steps:
- name: 'Run check'
run: |
pip install -r ${{ github.action_path }}/requirements.txt
python ${{ github.action_path }}/check_dependency.py --version ${{ inputs.version }} --repo ${{ github.repository }} --github-login ${{ github.actor }}
shell: sh
162 changes: 162 additions & 0 deletions .github/actions/check-pr-dependency/check_dependency.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
import argparse
import os
import re
from pathlib import Path

from github import Auth, Github
from github.PullRequestReview import PullRequestReview

import tools

parser = argparse.ArgumentParser()
parser.add_argument('--version', nargs='+')
parser.add_argument('--repo', default='OCA/OpenUpgrade')
parser.add_argument('--github-login', default='ocabot')
args = parser.parse_args()

auth = None
if os.environ.get('GITHUB_TOKEN'):
auth = Auth.Token(os.environ.get('GITHUB_TOKEN'))

g = Github(auth=auth)
repo = g.get_repo(args.repo)

# #######################
# Custom Function
# #######################
def module_ok(module_name):
return module_coverage[module_name] in ["nothing_to_do", "done"] or opened_prs.get(module_name) == pr_number

def _extract_migration_comment(migration_message):
if not migration_message:
return "", "", ""
text_reg = (
r"(?P<before>(\r|\n|.)*)"
r"<dependency>"
"(?P<current_text>(\n|.)*)"
r"<\/dependency>"
r"(?P<after>(\r|\n|.)*)"
)
res = re.match(text_reg, migration_message.body)
if not res:
return "", "", ""
groups = res.groupdict()
return groups["before"], groups["current_text"], groups["after"]


def _get_comment_or_review(pr, content):
comments = [x for x in pr.get_issue_comments() if content in x.body]
if comments:
return comments[0]
reviews = [x for x in pr.get_reviews() if content in x.body]
return reviews and reviews[0] or False


# ####################################
# Main Script
# ####################################

for current_version in map(float, args.version):
tools._logger.info(f"*************************************************")
tools._logger.info(f"Update Dependencies for Version {current_version}")
tools._logger.info(f"*************************************************")

# Get Opened PRs
done_prs, opened_prs = tools._get_prs(repo, current_version)

# Get Done modules
module_coverage = tools._get_module_coverage(repo, current_version)


for module_name, pr_number in opened_prs.items():
tools._logger.info(f"Handle PR #{pr_number} for module '{module_name}'")
manifest = tools._get_manifest_module(repo, current_version, module_name)
if not manifest:
tools._logger.info(f"the module {module_name} disappeared in the new version.")
continue

depends = manifest.get("depends")
pr = repo.get_pull(pr_number)

migration_message = _get_comment_or_review(pr, "ocabot migration")
current_labels = [x.name for x in pr.labels]
new_labels = current_labels.copy()

log_message = f"PR #{pr_number} for {module_name}:"
if all([module_ok(x) for x in depends]):
# all dependencies are OK, mark the PR as OK.
label_to_remove = "Blocked by dependency"
label_to_add = "Dependency OK"
else:
# mark the PR as blocked
label_to_remove = "Dependency OK"
label_to_add = "Blocked by dependency"

if label_to_remove in new_labels:
log_message += f" Remove '{label_to_remove}'"
new_labels.remove(label_to_remove)

if label_to_add not in new_labels:
log_message += f" Set '{label_to_add}'"
new_labels.append(label_to_add)

if new_labels != current_labels:
tools._logger.info(log_message)
pr.set_labels(*new_labels)

if not migration_message:
tools._logger.warning(f"Migration message not found in {pr.number}")
continue

before_text, current_text, after_text = _extract_migration_comment(
migration_message
)

dep_modules_ok = [x for x in depends if x in done_prs]
dep_modules_pending = [x for x in depends if x in opened_prs]
dep_modules_ko = [
x for x in depends if x not in dep_modules_ok + dep_modules_pending
]
new_text = ""
for dep_module in dep_modules_ok:
new_text += f"\n- {dep_module} : #{done_prs[dep_module]}"
for dep_module in dep_modules_pending:
new_text += f"\n- {dep_module} : #{opened_prs[dep_module]}"
for dep_module in dep_modules_ko:
new_text += f"\n- {dep_module} : TODO"
if module_ok(dep_module):
tools._logger.error(f"{dep_module} not found in the issue 'Migration to version {current_version}'")


if new_text:
new_text = "Depends on : \n" + new_text

new_body = ""
if not current_text and new_text:
tools._logger.info(
f"PR#{pr.number} - {pr.title}: ADDING Text in migration message."
)
if migration_message.user.login != args.github_login:
tools._logger.warning(
f"The message has been written by @{migration_message.user.login}"
)
new_body = (
migration_message.body + "\n\n<dependency>" + new_text + "</dependency>"
)
elif new_text != current_text:
tools._logger.info(
f"PR#{pr.number} - {pr.title}: Replacing text in migration message."
)
if migration_message.user.login != args.github_login:
tools._logger.warning(
f"The message has been written by @{migration_message.user.login}"
)
new_body = (
before_text + "<dependency>" + new_text + "</dependency>" + after_text
)

if new_body:
if type(migration_message) is PullRequestReview:
tools._logger.warning("Unable to edit the PR due to PyGithub limitation.")
continue
migration_message.edit(new_body)
1 change: 1 addition & 0 deletions .github/actions/check-pr-dependency/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PyGithub
90 changes: 90 additions & 0 deletions .github/actions/check-pr-dependency/tools.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
import logging
import re
import sys
import urllib

logging.basicConfig(
level=logging.INFO,
format="[%(asctime)s] {%(filename)s:%(lineno)d} %(levelname)s - %(message)s",
handlers=[logging.StreamHandler(stream=sys.stdout)],
)

_logger = logging.getLogger()


def _get_prs(repo, version):
opened_prs = {}
done_prs = {}

line_reg = (
r"- \[(?P<done> |x)\] (\(del\) )?(\(new\) )?"
r"(?P<module_name>\w+).*(pull\/|#)(?P<pr_number>\d+)"
)
issue_title = f"Migration to version {version:.1f}"

_logger.info(f"Get PRs referenced in '{issue_title}' ...")
# Get main issue to have PRs numbers
for issue in repo.get_issues():
if issue.title == issue_title:
for line in issue.body.split("\n"):
if not line.startswith("- ["):
continue
res = re.match(line_reg, line)
if not res:
_logger.debug(f"Unable to parse correctly '{line}'")
continue
groups = res.groupdict()
pr_number = int(groups["pr_number"])
if groups["done"] == "x":
done_prs[groups["module_name"]] = pr_number
else:
opened_prs[groups["module_name"]] = pr_number
_logger.info(
f">> found {len(done_prs)} done PRs" f" and {len(opened_prs)} Opened PRs"
)
return done_prs, opened_prs


def _get_module_coverage(repo, version):
file_name = f"modules{(version - 1) * 10:.0f}-{(version) * 10:.0f}.rst"
url = (
f"https://raw.githubusercontent.com/OCA/OpenUpgrade"
f"/{version:.1f}/docsource/"
f"{file_name}"
)
module_coverage = {}
_logger.info(f"Get and parse {file_name} to know coverage state ...")
page = urllib.request.urlopen(url).read().decode()
for line in page.split("\n"):
line = line.replace("|del|", "").replace("|new|", "")
if not line.startswith("|"):
continue
res = line.split("|")
module_name = res[1].strip()
status = res[2].strip()
if module_name == "Module":
continue
if status == "":
module_coverage[module_name] = "to_do"
elif status == "Nothing to do":
module_coverage[module_name] = "nothing_to_do"
elif status.startswith("Done"):
module_coverage[module_name] = "done"
else:
continue
# TODO:fix me
raise Exception("Status '%s' has not been analyzed." % (status))
_logger.info(f">> found {len(module_coverage)} modules.")
return module_coverage


def _get_manifest_module(repo, version, module_name):
url = (
f"https://raw.githubusercontent.com/odoo/"
f"odoo/{version:.1f}/addons/{module_name}/__manifest__.py"
)
try:
page = urllib.request.urlopen(url).read().decode()
except urllib.error.HTTPError:
return
return eval(page)
19 changes: 19 additions & 0 deletions .github/workflows/check_pr_dependency.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Check PR dependencies

on:
issues:
types: [edited]

jobs:
check_dependency:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
if: ${{ github.event.issue.state == 'open' && startsWith( github.event.issue.title, 'Migration to version ' ) }}
- name: Check dependency
if: ${{ github.event.issue.state == 'open' && startsWith( github.event.issue.title, 'Migration to version ' ) }}
uses: ./.github/actions/check-pr-dependency
with:
version: ${{ github.event.issue.milestone.title }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
69 changes: 69 additions & 0 deletions .github/workflows/documentation-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# On each push in 20.0 branch,
# AND if the coverage file changed,
# build documentation branch and commit the changes
# so that the changes are visible on the website
# https://oca.github.io/OpenUpgrade/

name: Build and commit documentation

on:
push:
paths: ["docsource/modules190-200.rst"]

jobs:
documentation-commit:
runs-on: ubuntu-latest
steps:
- name: Check out OpenUpgrade Documentation
uses: actions/checkout@v2
with:
ref: "documentation"

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Check out Odoo
uses: actions/checkout@v2
with:
repository: odoo/odoo
ref: "20.0"
fetch-depth: 1
path: odoo
- 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: |
export PIP_CONSTRAINT=pip-constraint.txt
echo 'setuptools < 82.0.0' > pip-constraint.txt
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
pip install -q -r odoo/requirements.txt
pip install -r ./requirements.txt
- name: OpenUpgrade Docs
run: |
# try to build the documentation
sh ./build_openupgrade_docs
- name: Commit changes
uses: EndBug/add-and-commit@a94899bca583c204427a224a7af87c02f9b325d5 #v9
with:
add: "docs"
default_author: github_actions
message: "[UPD] HTML documentation"
Loading
Loading