From d8361c987bd94f72971f47866627ccd07b7c39b3 Mon Sep 17 00:00:00 2001 From: Jean Felder Date: Fri, 22 Dec 2023 12:17:32 +0100 Subject: [PATCH] parameters: Allow 'latest' as a valid release value This is a follow-up of 582278d11d94e1efb72acb0bbec0cd0b0dd3bcee which introduced support to check for correct release version patterns. This only allows semvar related values. However, the `package` command uses the `latest` version by default. This means that the command `qgis-plugin-ci package` now fails because `latest` pattern is not allowed. This issue is fixed by adding `^latest$` to the allowed patterns in version check. --- qgispluginci/parameters.py | 1 + test/test_release.py | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) mode change 100644 => 100755 qgispluginci/parameters.py mode change 100644 => 100755 test/test_release.py diff --git a/qgispluginci/parameters.py b/qgispluginci/parameters.py old mode 100644 new mode 100755 index b0eeaf06..eb94a438 --- a/qgispluginci/parameters.py +++ b/qgispluginci/parameters.py @@ -244,6 +244,7 @@ def get_release_version_patterns() -> Dict[str, re.Pattern]: "v3": r"^v\d+\.\d+\.\d+$", # See https://github.com/semver/semver/blob/master/semver.md#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string "semver": r"^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$", + "latest": r"^latest$", } @staticmethod diff --git a/test/test_release.py b/test/test_release.py old mode 100644 new mode 100755 index acdb0705..9015afb1 --- a/test/test_release.py +++ b/test/test_release.py @@ -208,7 +208,15 @@ def test_release_changelog(self): self.assertEqual(0, len(re.findall(r"commitSha1=\d+", str(data)))) def test_release_version_valid_invalid(self): - valid_tags = ["v1.1.1", "v1.1", "1.0.1", "1.1", "1.0.0-alpha", "1.0.0-dev"] + valid_tags = [ + "v1.1.1", + "v1.1", + "1.0.1", + "1.1", + "1.0.0-alpha", + "1.0.0-dev", + "latest", + ] invalid_tags = ["1", "v1", ".", ".1"] expected_valid_results = { "v1.1.1": ["v3"], @@ -217,6 +225,7 @@ def test_release_version_valid_invalid(self): "1.1": ["simple"], "1.0.0-alpha": ["semver"], "1.0.0-dev": ["semver"], + "latest": ["latest"], } valid_results = {tag: [] for tag in valid_tags} patterns = Parameters.get_release_version_patterns()