-
-
Notifications
You must be signed in to change notification settings - Fork 644
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Write directly to relevant notes file in changelog.py (#19303)
This updates `changelog.py` to write the (non-internal) changes to the relevant release notes file directly, rather than requiring a human to copy-paste it in. For now, the file is just mutated, without committing. The internal changes are still printed for the human to deal with. For instance, `pants run src/python/pants_release/changelog.py -- --prior 2.18.0.dev1 --new 2.18.0.dev2` adds a new section to `src/python/pants/notes/2.18.x.md`: ```diff diff --git a/src/python/pants/notes/2.18.x.md b/src/python/pants/notes/2.18.x.md index e648a4525c..d6668a24b1 100644 --- a/src/python/pants/notes/2.18.x.md +++ b/src/python/pants/notes/2.18.x.md @@ -1,5 +1,35 @@ # 2.18.x Release Series +## 2.18.0.dev2 (Jun 14, 2023) + +### New Features + +* Include complete platforms for FaaS environments for more reliable building ([#19253](#19253)) + +* Add experimental support for Rustfmt ([#18842](#18842)) + +* Helm deployment chart field ([#19234](#19234)) + +### Plugin API Changes + +* Replace `include_special_cased_deps` flag with `should_traverse_deps_predicate` ([#19272](#19272)) + +### Bug Fixes + +* Raise an error if isort can't read a config file ([#19294](#19294)) + +* Improve handling of additional files in Helm unit tests ([#19263](#19263)) + +* Add taplo to the release ([#19258](#19258)) + +* Handle `from foo import *` wildcard imports in Rust dep inference parser ([#19249](#19249)) + +* Support usage of `scala_artifact` addresses in `scalac_plugin` targets ([#19205](#19205)) + +### Performance + +* `scandir` returns `Stat`s relative to its directory. ([#19246](#19246)) + ## 2.18.0.dev1 (Jun 02, 2023) ### New Features ``` This also moves it into the new `pants_release` root, adds some basic tests, and has it fetch the relevant branch directly, rather than prompting the user to do so. It also pulls out a `git.py` support module with helpers for exec-ing `git` as an external process. The commits are individually reviewable. This is a step towards automating more of the "start release" process, per #19279. After this core refactoring of the functionality, I think the next step is to combine it with the CONTRIBUTORS update and version bumping, and then after that string it all together on CI so that starting a release is fully automated.
- Loading branch information
Showing
6 changed files
with
253 additions
and
154 deletions.
There are no files selected for viewing
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 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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
# Copyright 2023 Pants project contributors (see CONTRIBUTORS.md). | ||
# Licensed under the Apache License, Version 2.0 (see LICENSE). | ||
|
||
from __future__ import annotations | ||
|
||
import datetime | ||
|
||
import pytest | ||
from packaging.version import Version | ||
from pants_release.changelog import Category, Entry, ReleaseInfo, format_notes, splice | ||
|
||
|
||
@pytest.mark.parametrize( | ||
("raw_version", "slug", "branch"), | ||
[ | ||
("2.0.0.dev0", "2.0.x", "main"), | ||
("2.0.0.dev1", "2.0.x", "main"), | ||
("2.0.0a0", "2.0.x", "main"), | ||
("2.0.0a1", "2.0.x", "2.0.x"), | ||
("2.0.0rc0", "2.0.x", "2.0.x"), | ||
("2.0.0rc1", "2.0.x", "2.0.x"), | ||
("2.0.0", "2.0.x", "2.0.x"), | ||
("2.0.1a0", "2.0.x", "2.0.x"), | ||
("2.1234.5678.dev0", "2.1234.x", "main"), | ||
("2.1234.5678.a0", "2.1234.x", "2.1234.x"), | ||
("2.1234.5678.a1", "2.1234.x", "2.1234.x"), | ||
("2.1234.5678rc0", "2.1234.x", "2.1234.x"), | ||
("2.1234.5678", "2.1234.x", "2.1234.x"), | ||
], | ||
) | ||
def test_releaseinfo_determine(raw_version: str, slug: str, branch: str) -> None: | ||
version = Version(raw_version) | ||
expected = ReleaseInfo(version=version, slug=slug, branch=branch) | ||
|
||
computed = ReleaseInfo.determine(version) | ||
assert computed == expected | ||
|
||
|
||
@pytest.mark.parametrize("category", [*(c for c in Category if c is not Category.Internal), None]) | ||
def test_format_notes_external(category: None | Category) -> None: | ||
release_info = ReleaseInfo(version=Version("2.1234.0.dev0"), slug="2.1234.x", branch="main") | ||
entries = [Entry(category=category, text="some entry")] | ||
date = datetime.date(9999, 8, 7) | ||
heading = "Uncategorized" if category is None else category.heading() | ||
|
||
formatted = format_notes(release_info, entries, date) | ||
|
||
assert formatted.internal == "" | ||
# we're testing the exact formatting, so no softwrap/dedent: | ||
assert ( | ||
formatted.external | ||
== f"""\ | ||
## 2.1234.0.dev0 (Aug 07, 9999) | ||
### {heading} | ||
some entry""" | ||
) | ||
|
||
|
||
def test_format_notes_internal() -> None: | ||
release_info = ReleaseInfo(version=Version("2.1234.0.dev0"), slug="2.1234.x", branch="main") | ||
entries = [Entry(category=Category.Internal, text="some entry")] | ||
date = datetime.date(9999, 8, 7) | ||
|
||
formatted = format_notes(release_info, entries, date) | ||
|
||
assert formatted.external == "## 2.1234.0.dev0 (Aug 07, 9999)" | ||
# we're testing the exact formatting, so no softwrap/dedent: | ||
assert ( | ||
formatted.internal | ||
== """\ | ||
### Internal (put these in a PR comment for review, not the release notes) | ||
some entry""" | ||
) | ||
|
||
|
||
@pytest.mark.parametrize( | ||
("existing_contents", "expected"), | ||
[ | ||
pytest.param( | ||
"# 2.1234.x Release series\n", | ||
"# 2.1234.x Release series\n\nNEW SECTION\n", | ||
id="defaults to end of file", | ||
), | ||
pytest.param( | ||
"# 2.1234.x Release series\n\n## 2.1234.5678rc9\nEXISTING1## 2.1234.0.dev0\nEXISTING2", | ||
"# 2.1234.x Release series\n\nNEW SECTION\n\n## 2.1234.5678rc9\nEXISTING1## 2.1234.0.dev0\nEXISTING2", | ||
id="finds the first release-like section", | ||
), | ||
pytest.param( | ||
"# 2.1234.x Release series\n\n## What's new\n\n---\n\n## 2.1234.5678rc9\nEXISTING1", | ||
"# 2.1234.x Release series\n\n## What's new\n\n---\n\nNEW SECTION\n\n## 2.1234.5678rc9\nEXISTING1", | ||
id="ignores 'What's new'", | ||
), | ||
pytest.param( | ||
"# 2.1234.x Release series\n\n### 2.1234\nEXISTING\n", | ||
"# 2.1234.x Release series\n\n### 2.1234\nEXISTING\n\nNEW SECTION\n", | ||
id="ignores unexpected heading depth", | ||
), | ||
], | ||
) | ||
def test_splice(existing_contents: str, expected: str) -> None: | ||
assert splice(existing_contents, "NEW SECTION") == expected |
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
Oops, something went wrong.