[Changelog/release notes] Fix and add custom templates for autotag script (#3408)

* Update custom templates

* Add custom templates

* Fix custom template for hipfort

* Fix custom template for hipify

* Fix custom template for rvs
This commit is contained in:
Sam Wu
2024-07-10 09:35:33 -06:00
committed by GitHub
parent 7f715fa474
commit becbe5e3ae
4 changed files with 93 additions and 8 deletions

View File

@@ -1,2 +1,2 @@
from .defaults import TEMPLATES, PROCESSORS
from .custom_templates import hipfort, mivisionx, rpp
from .custom_templates import hipfort, hipify, mivisionx, rpp, rvs

View File

@@ -5,10 +5,10 @@ from util.defaults import TEMPLATES, PROCESSORS
TEMPLATES['hipfort'] = (
(
r"## hipfort (?P<lib_version>\d+\.\d+(?:\.\d+))?"
r"(?P<for_rocm> for ROCm )?"
r"(?P<rocm_version>(?(for_rocm)\d+\.\d+(?:\.\d+)?|.*))?"
r"( \(Unreleased\))?"
r"## hipfort"
r"(?: (?P<lib_version>\d+\.\d+(?:\.\d+))?)?"
r"(?: for ROCm (?P<rocm_version>\d+\.\d+(?:\.\d+)?))?"
r"(?: \(Unreleased\))?"
r"\n"
r"(?P<body>(?:(?!## ).*(?:(?!\n## )\n|(?=\n## )))*)"
)
@@ -21,19 +21,20 @@ def hipfort_processor(data: ReleaseLib, template: str, _, __) -> bool:
changelog = changelog.decoded_content.decode()
pattern = re.compile(template)
match = pattern.search(changelog)
lib_version = match["lib_version"]
lib_version = match["rocm_version"]
data.message = (
f"hipfort for ROCm"
f" {data.full_version}"
)
data.lib_version = lib_version
data.notes = f"""{match["body"]}"""
data.lib_version = lib_version
change_pattern = re.compile(
r"^#+ +(?P<type>[^\n]+)$\n*(?P<change>(^(?!#).*\n*)*)",
re.RegexFlag.MULTILINE
)
for match in change_pattern.finditer(data.notes):
data.data.changes[match["type"]] = match["change"]

View File

@@ -0,0 +1,42 @@
import re
from util.release_data import ReleaseLib
from util.defaults import TEMPLATES, PROCESSORS
TEMPLATES['HIPIFY'] = (
(
r"## HIPIFY"
r"(?: (?P<lib_version>\d+\.\d+(?:\.\d+))?)?"
r"(?: for ROCm (?P<rocm_version>\d+\.\d+(?:\.\d+)?))?"
r"(?: ?\(Unreleased\))?"
r"\n"
r"(?P<body>(?:(?!## ).*(?:(?!\n## )\n|(?=\n## )))*)"
)
)
def hipify_processor(data: ReleaseLib, template: str, _, __) -> bool:
"""Processor for releases."""
changelog = data.repo.get_contents("CHANGELOG.md", data.commit)
changelog = changelog.decoded_content.decode()
pattern = re.compile(template)
match = pattern.search(changelog)
lib_version = match["rocm_version"]
data.message = (
f"HIPIFY for ROCm"
f" {data.full_version}"
)
data.notes = f"""{match["body"]}"""
data.lib_version = lib_version
change_pattern = re.compile(
r"^#+ +(?P<type>[^\n]+)$\n*(?P<change>(^(?!#).*\n*)*)",
re.RegexFlag.MULTILINE
)
for match in change_pattern.finditer(data.notes):
data.data.changes[match["type"]] = match["change"]
return True
PROCESSORS['HIPIFY'] = hipify_processor

View File

@@ -0,0 +1,42 @@
import re
from util.release_data import ReleaseLib
from util.defaults import TEMPLATES, PROCESSORS
TEMPLATES['ROCmValidationSuite'] = (
(
r"## RVS"
r"(?: (?P<lib_version>\d+\.\d+(?:\.\d+))?)?"
r"(?: for ROCm (?P<rocm_version>\d+\.\d+(?:\.\d+)?))?"
r"(?: ?\(Unreleased\))?"
r"\n"
r"(?P<body>(?:(?!## ).*(?:(?!\n## )\n|(?=\n## )))*)"
)
)
def rvs_processor(data: ReleaseLib, template: str, _, __) -> bool:
"""Processor for releases."""
changelog = data.repo.get_contents("CHANGELOG.md", data.commit)
changelog = changelog.decoded_content.decode()
pattern = re.compile(template)
match = pattern.search(changelog)
lib_version = match["rocm_version"]
data.message = (
f"RVS for ROCm"
f" {data.full_version}"
)
data.lib_version = lib_version
data.notes = f"""{match["body"]}"""
change_pattern = re.compile(
r"^#+ +(?P<type>[^\n]+)$\n*(?P<change>(^(?!#).*\n*)*)",
re.RegexFlag.MULTILINE
)
for match in change_pattern.finditer(data.notes):
data.data.changes[match["type"]] = match["change"]
return True
PROCESSORS['ROCmValidationSuite'] = rvs_processor