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

Top level "no validation" #264

Merged
merged 4 commits into from
Dec 22, 2023
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
11 changes: 6 additions & 5 deletions qgispluginci/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ def cli():
version=__version__,
)

parser.add_argument(
"--no-validation",
action="store_true",
help="Turn off validation of the version to be released or packaged",
)

subparsers = parser.add_subparsers(
title="commands", description="qgis-plugin-ci command", dest="command"
)
Expand Down Expand Up @@ -71,11 +77,6 @@ def cli():
action="append",
help="An additional asset path to add. Can be specified multiple times.",
)
package_parser.add_argument(
"--no-validation",
action="store_true",
help="Turn off validation of `release version`",
)

# changelog
changelog_parser = subparsers.add_parser(
Expand Down
11 changes: 5 additions & 6 deletions qgispluginci/parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,23 +252,22 @@ def validate_args(args: Namespace):
Raise an exception just in case:
- the user didn't opt-out of validation using the `--no-validation` flag; and
- the value of `release_version` matches no supported pattern.
In any case, warn the user if the value of `release_version` doesn't match the semver pattern.
"""
if not hasattr(args, "release_version") or not args.release_version:
return

if args.no_validation:
logging.warning("Disabled release version validation.")
return

patterns = Parameters.get_release_version_patterns()
semver_compliance = re.match(patterns.pop("semver"), args.release_version)

if not semver_compliance:
logging.warning(
f"Be aware that '{args.release_version}' is not a semver-compliant version."
f"Be aware that '{args.release_version}' is not a semver-compliant version. It might still comply with acceptable practices."
)

if args.no_validation:
logging.warning("Disabled release version validation.")
return

if semver_compliance or any(
re.match(other_pattern, args.release_version)
for other_pattern in patterns.values()
Expand Down