Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change: Include changes from pre-releases in non pre-releases #957

Merged
merged 1 commit into from
Jan 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
12 changes: 12 additions & 0 deletions pontos/release/create.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,18 @@ async def async_run( # type: ignore[override]
tag_name=f"{self.git_tag_prefix}{release_series}.*"
if release_series
else None,
# include changes from pre-releases in release changelog for
# non pre-release changes
ignore_pre_releases=release_type
not in [
ReleaseType.ALPHA,
ReleaseType.BETA,
ReleaseType.RELEASE_CANDIDATE,
]
# but not when using a release series because then we might not
# be able to determine the last release if there are only
# pre-releases in the series yet
and not release_series,
)
except PontosError as e:
last_release_version = None
Expand Down
55 changes: 54 additions & 1 deletion tests/release/test_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,13 @@ def test_release_patch(
token=token, # type: ignore[arg-type]
)

get_last_release_version_mock.assert_called_once_with(
parse_version=PEP440VersioningScheme.parse_version,
git_tag_prefix="v",
tag_name=None,
ignore_pre_releases=True,
)

git_instance_mock.push.assert_has_calls(
[
call(follow_tags=True, remote=None),
Expand Down Expand Up @@ -517,6 +524,13 @@ def test_release_calendar(
token=token, # type: ignore[arg-type]
)

get_last_release_version_mock.assert_called_once_with(
parse_version=PEP440VersioningScheme.parse_version,
git_tag_prefix="v",
tag_name=None,
ignore_pre_releases=True,
)

git_instance_mock.push.assert_has_calls(
[
call(follow_tags=True, remote=None),
Expand Down Expand Up @@ -625,6 +639,13 @@ def test_release_minor(
token=token, # type: ignore[arg-type]
)

get_last_release_version_mock.assert_called_once_with(
parse_version=PEP440VersioningScheme.parse_version,
git_tag_prefix="v",
tag_name=None,
ignore_pre_releases=True,
)

git_instance_mock.push.assert_has_calls(
[
call(follow_tags=True, remote=None),
Expand Down Expand Up @@ -730,6 +751,13 @@ def test_release_major(
token=token, # type: ignore[arg-type]
)

get_last_release_version_mock.assert_called_once_with(
parse_version=PEP440VersioningScheme.parse_version,
git_tag_prefix="v",
tag_name=None,
ignore_pre_releases=True,
)

git_instance_mock.push.assert_has_calls(
[
call(follow_tags=True, remote=None),
Expand Down Expand Up @@ -833,6 +861,13 @@ def test_release_alpha(
token=token, # type: ignore[arg-type]
)

get_last_release_version_mock.assert_called_once_with(
parse_version=PEP440VersioningScheme.parse_version,
git_tag_prefix="v",
tag_name=None,
ignore_pre_releases=False,
)

git_instance_mock.push.assert_has_calls(
[
call(follow_tags=True, remote=None),
Expand Down Expand Up @@ -938,6 +973,13 @@ def test_release_beta(
token=token, # type: ignore[arg-type]
)

get_last_release_version_mock.assert_called_once_with(
parse_version=PEP440VersioningScheme.parse_version,
git_tag_prefix="v",
tag_name=None,
ignore_pre_releases=False,
)

git_instance_mock.push.assert_has_calls(
[
call(follow_tags=True, remote=None),
Expand Down Expand Up @@ -1043,6 +1085,13 @@ def test_release_release_candidate(
token=token, # type: ignore[arg-type]
)

get_last_release_version_mock.assert_called_once_with(
parse_version=PEP440VersioningScheme.parse_version,
git_tag_prefix="v",
tag_name=None,
ignore_pre_releases=False,
)

git_instance_mock.push.assert_has_calls(
[
call(follow_tags=True, remote=None),
Expand Down Expand Up @@ -2715,7 +2764,11 @@ def test_release_series(
token=token, # type: ignore[arg-type]
)

self.assertEqual(released, CreateReleaseReturnValue.SUCCESS)
self.assertEqual(
released,
CreateReleaseReturnValue.SUCCESS,
f"Invalid return value for {r}",
)
self.assertEqual(
create_api_mock.call_args.args[1],
f"v{r.expected_release_version}",
Expand Down