Skip to content

Commit

Permalink
Tests on prerelease and semver check (#119)
Browse files Browse the repository at this point in the history
Fix bug for semver check with the poetry syntax of pre release versions and test the pre-releases/ branches
  • Loading branch information
renaudjester committed Aug 29, 2024
1 parent d1359b1 commit 84d2dd3
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 11 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ name: Run tests

on:
pull_request:
branches: [ "main", "copernicusmarine-toolbox-v2" ]
branches:
- "main"
- "copernicusmarine-toolbox-v2"
- "pre-releases/**"

jobs:
tests:
Expand Down
27 changes: 17 additions & 10 deletions copernicusmarine/core_functions/versions_verifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,23 @@ def _check_version(function_name: str, staging: bool):
function_name
]:
required_version = marine_data_store_versions[service]
if not semver.Version.parse(client_version).match(
required_version
):
logger.debug(
f"Client version {client_version} is not compatible with "
f"{service}. Service needs version {required_version}."
)
logger.error(
f"Client version {client_version} is not compatible with current "
"backend service. Please update to the latest client version."
try:
if not semver.Version.parse(client_version).match(
required_version
):
logger.debug(
f"Client version {client_version} is not compatible with "
f"{service}. Service needs version {required_version}."
)
logger.error(
f"Client version {client_version} is not "
f"compatible with current backend service. "
f"Please update to the latest client version."
)
except ValueError:
logger.warning(
f"Using a pre-release or a non-official version "
f"of the client. Client version: {client_version}"
)

@staticmethod
Expand Down

0 comments on commit 84d2dd3

Please sign in to comment.