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

[supfix/OPT-1130] to support/1.23 #375

Merged
merged 1 commit into from
May 27, 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
2 changes: 1 addition & 1 deletion startleft/startleft/_version/local_scheme.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def choose_strategy_by_branch(branch_name: str) -> callable:
:param branch_name: The name of the branch for which the version is being calculated
:return: The callable for the version strategy calculation
"""
if branch_name == 'main' or 'release/' in branch_name:
if branch_name == 'main' or 'release/' in branch_name or 'support/' in branch_name:
return _no_local_version_strategy
else:
return _node_strategy
Expand Down
4 changes: 3 additions & 1 deletion startleft/startleft/_version/version_scheme.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@ def choose_strategy_by_branch(branch_name: str, exact: bool) -> callable:
:param branch_name: The name of the branch for which the version is being calculated
:return: The callable for the version strategy calculation
"""
if branch_name == 'main' or 'release/' in branch_name or __is_tag_commit(branch_name, exact):
if branch_name == 'main' or 'release/' in branch_name or 'support/' in branch_name or __is_tag_commit(branch_name, exact):
return _tag_version_strategy
elif 'hotfix/' in branch_name:
return _patch_version_dev_commit_strategy
elif 'supfix/' in branch_name:
return _patch_version_dev_commit_strategy
elif 'bugfix' in branch_name:
return _tag_version_dev_commit_strategy
else:
Expand Down
4 changes: 4 additions & 0 deletions startleft/tests/unit/_version/test_local_scheme.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ class TestLocalScheme:
('hotfix/XXX-000', '_node_strategy'),
('release/1.5.0', '_no_local_version_strategy'),
('bugfix/XXX-000', '_node_strategy'),
('support/1.19', '_no_local_version_strategy'),
('supfix/XXX-000', '_node_strategy'),
('dev', '_node_strategy'),
('feature/XXX-000', '_node_strategy'),
('UNKNOWN_BRANCH_PATTERN', '_node_strategy'),
Expand All @@ -38,6 +40,8 @@ def test_strategy_by_branch(self, branch, expected_strategy):
param(RELEASE_VERSION_BUGFIX, '', id='test_release_version_bugfix'),
# BUGFIX
param(BUGFIX_VERSION, '+g6cda015', id='test_bugfix_version'),
# SUPFIX
param(SUPFIX_VERSION, '+g6cda015', id='test_supfix_version'),
# DEV
param(DEV_RTP_VERSION, '+g17d9f68', id='test_dev_rtp_version'),
param(DEV_RP_VERSION, '+g3e49113', id='test_dev_rp_version'),
Expand Down
7 changes: 7 additions & 0 deletions startleft/tests/unit/_version/test_version_scheme.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ class TestVersionScheme:
('hotfix/XXX-000', '_patch_version_dev_commit_strategy'),
('release/1.5.0', '_tag_version_strategy'),
('bugfix/XXX-000', '_tag_version_dev_commit_strategy'),
('support/1.19', '_tag_version_strategy'),
('supfix/XXX-000', '_patch_version_dev_commit_strategy'),
('dev', '_minor_version_dev_commit_strategy'),
('feature/XXX-000', '_minor_version_dev_commit_strategy'),
('UNKNOWN_BRANCH_PATTERN', '_minor_version_dev_commit_strategy'),
Expand Down Expand Up @@ -60,6 +62,11 @@ def test_detached_head(self, exact: bool, expected_strategy):
param(RELEASE_VERSION_BUGFIX, '1.6.0rc1', id='test_release_version_bugfix'),
# BUGFIX
param(BUGFIX_VERSION, '1.6.0rc1.dev1', id='test_bugfix_version'),
# SUPPORT
param(SUPPORT_VERSION_NO_SUPFIX, '1.19.0', id='test_support_version_no_supfix'),
param(SUPPORT_VERSION_SUPFIX, '1.19.1', id='test_support_version_supfix'),
# SUPFIX
param(SUPFIX_VERSION, '1.19.1.dev1', id='test_supfix_version'),
# DEV
param(DEV_RTP_VERSION, '1.7.0.dev19', id='test_dev_rtp_version'),
param(DEV_RTP_NO_DISTANCE_VERSION, '1.7.0', id='test_dev_rtp_no_distance_version'),
Expand Down
19 changes: 19 additions & 0 deletions startleft/tests/unit/_version/version_mocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,25 @@
BUGFIX_VERSION = Mock(
branch='bugfix/XXX-000', tag='1.6.0rc1', distance=1, exact=False, node='g6cda015')


###########
# SUPPORT #
###########

SUPPORT_VERSION_NO_SUPFIX = Mock(
branch='support/1.19', tag='1.19.0', distance=None, exact=True, node='g05febfb'
)

SUPPORT_VERSION_SUPFIX = Mock(
branch='support/1.19', tag='1.19.1', distance=3, exact=False, node='ga1d748e'
)

##########
# SUPFIX #
##########
SUPFIX_VERSION = Mock(
branch='supfix/XXX-000', tag='1.19.0', distance=1, exact=False, node='g6cda015')

#######
# DEV #
#######
Expand Down
Loading