Skip to content

Commit

Permalink
parameters: Allow 'latest' as a valid release value (#263)
Browse files Browse the repository at this point in the history
This is a follow-up of 582278d 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.
  • Loading branch information
Guts authored Dec 22, 2023
2 parents f94c7f4 + d8361c9 commit 16f3c9c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions qgispluginci/parameters.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 10 additions & 1 deletion test/test_release.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Expand All @@ -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()
Expand Down

0 comments on commit 16f3c9c

Please sign in to comment.