Improve release note creation
The main changes are:
- "Stack-aware" release notes when passing a json configuration as shown below (closes #30 (closed))
- automatic preamble with dependencies
- collects "highlights" from dependencies (useful for application projects)
- A more sophisticated default template using the features above and category labels (in addition to grouping by type of change)
- Adds a quick and dirty integration test, taking about 30 seconds (clone some projects, runs the script (query the GitLab API) and checks some of the output)
To try it out:
cd
$VIRTUAL_ENV/clone_venv release_notes_venv
unset LBENV_SOURCED
source ~/release_notes_venv/bin/LbEnv.sh -r $MYSITEROOT
pip install git+https://gitlab.cern.ch/lhcb-core/LbDevTools.git@release-notes
lb-gen-release-notes --help
Assuming your stack is cloned in the directory ~/stack
Put a JSON file with the definition of stack to be released (e.g. ~/stack/release_versions.json
,
format is ["last released version", "version to be released", ["dependency1", "dependency2"]]
)
{
"LCG": ["96b with ROOT 6.18.04", "96b with ROOT 6.18.04", []],
"Gaudi": ["v33r0", "v33r0", ["LCG"]],
"LHCb": ["v50r6", "v51r0", ["Gaudi"]],
"Lbcom": ["v30r6", "v31r0", ["LHCb"]],
"Rec": ["v30r6", "v31r0", ["Lbcom"]],
"Brunel": ["v60r6", "v61r0", ["Rec"]],
"Phys": ["v30r6", "v31r0", ["Rec"]],
"Moore": ["v50r0", "v51r0", ["Phys"]],
"Analysis": ["v30r6", "v31r0", ["Phys"]],
"Stripping": ["v15r1", "v15r2", ["Phys"]],
"DaVinci": ["v50r6", "v51r0", ["Analysis", "Stripping"]]
}
Run the command
cd ~/stack/Rec
~/release_notes_venv/bin/lb-gen-release-notes -s ../release_versions.json
An example template is the following:
{% set categories = [
'selection', 'hlt1', 'hlt2', 'Configuration',
'Decoding', 'Tracking', 'PV finding', 'Muon', 'Calo', 'RICH', 'Jets',
'PID', 'Composites', 'Filters', 'Functors',
'Event model', 'Persistency',
'MC checking', 'Monitoring', 'Luminosity',
'Core', 'Conditions', 'Utilities',
'Simulation', 'Tuples', 'Accelerators',
'Flavour tagging',
'Build',
] -%}
{% set used_mrs = [] -%}
{% set used_dep_mrs = [] -%}
{% set highlight_mrs = select_mrs(dep_mrs, ['highlight']) -%}
{% macro section(labels, mrs=merge_requests, used=used_mrs, indent='', highlight='highlight') -%}
{% for mr in order_by_label(select_mrs(mrs, labels, used), categories) -%}
{% set mr_labels = categories|select("in", mr.labels)|list -%}
{{indent}}- {% if mr_labels %}{{mr_labels|map('label_ref')|join(' ')}} | {% endif -%}
{{mr.title|sentence}}, {{mr|mr_ref(project_fullname)}} (@{{mr.author.username}}){% if mr.issue_refs %} [{{mr.issue_refs|join(',')}}]{% endif %}{% if highlight in mr.labels %} :star:{% endif %}
{# {{mr.description|mdindent(2)}} -#}
{% endfor -%}
{% endmacro -%}
{{date}} {{project}} {{version}}
===
This version uses
{{project_deps[:-1]|join(',\n')}} and
{{project_deps|last}}.
This version is released on `master` branch.
Built relative to {{project}} {{project_prev_tag}}, with the following changes:
### New features ~"new feature"
{{ section(['new feature']) -}}
- Upstream project highlights :star:
{{ section(['new feature'], mrs=highlight_mrs, used=used_dep_mrs, indent=' ', highlight=None) -}}
### Fixes ~"bug fix" ~workaround
{{ section(['bug fix', 'workaround']) -}}
- Upstream project highlights :star:
{{ section(['bug fix', 'workaround'], mrs=highlight_mrs, used=used_dep_mrs, indent=' ', highlight=None) -}}
### Enhancements ~enhancement
{{ section(['enhancement']) -}}
- Upstream project highlights :star:
{{ section(['enhancement'], mrs=highlight_mrs, used=used_dep_mrs, indent=' ', highlight=None) -}}
### Code cleanups and changes to tests ~modernisation ~cleanup ~testing
{{ section(['cleanup', 'modernisation', 'testing']) -}}
- Upstream project highlights :star:
{{ section(['cleanup'], mrs=highlight_mrs, used=used_dep_mrs, indent=' ', highlight=None) -}}
### Documentation ~Documentation
{# Collect documentation independently, may lead to repeated entries -#}
{{ section(['Documentation'], used=None) -}}
{# Mark as used such documentation does not appear under Other -#}
{% set dummy = section(['Documentation']) -%}
### Other
{{ section([[]]) -}}
Edited by Rosen Matev