Skip to content

Commit

Permalink
#167: Added version check and prepare release (#168)
Browse files Browse the repository at this point in the history
* add version check and prepare release
  • Loading branch information
MarleneKress79789 authored Dec 20, 2023
1 parent 237e4ae commit fe25840
Show file tree
Hide file tree
Showing 5 changed files with 88 additions and 11 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/check_version.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Check if versions are consistent

on: pull_request

jobs:
check-version-numbers:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: ./.github/actions/prepare_poetry_env
- name: Check Release
run: poetry run python3 -u "./scripts/check_release_version.py"
18 changes: 8 additions & 10 deletions doc/changes/changes_0.7.0.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,26 @@
# Transformers Extension 0.7.0, released T.B.D
# Transformers Extension 0.7.0, released 2023-12-20

Code name: T.B.D
Code name: Split SLC actions


## Summary

T.B.D
This release splits the container uploading and registration into two separate actions. Additionally,
a workflow for checking the correctness of the version number in multiple places was added. Apart from that there
are some refactorings for better usability and the Cryptography dependency version has been upgraded to 41.0.7

### Features

- #151: Made the container uploading and language registration two separate actions
- #167: Added version check workflow
- #143: Added HuggingfaceTransfer class with save_pretrained for saving model locally
- #152: Made the container uploading and language registration two separate actions

### Bug Fixes

- n/a

### Refactorings

- #144: Extracted base_model_udf.load_models into separate class

### Documentation
- #159: Refactored LanguageContainer Deployer to make it reusable by other extensions

- n/a

### Security

Expand Down
14 changes: 13 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ tenacity = "^8.2.2"
pytest = "^7.2.0"
exasol-udf-mock-python = "^0.1.0"
exasol-script-languages-container-tool = "^0.18.1"
toml = "^0.10.2"

[[tool.poetry.source]]
name = "torch"
Expand Down
52 changes: 52 additions & 0 deletions scripts/check_release_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import re
from pathlib import Path

from packaging import version

from git import Repo
import toml


def get_git_version():
repo = Repo()
assert not repo.bare
tag_strings = [t.name for t in repo.tags]
tag_strings.sort(reverse=True)

latest_tag = tag_strings[0].strip()
assert len(latest_tag) > 0
return latest_tag


def get_poetry_version():
parsed_toml = toml.load('pyproject.toml')
return parsed_toml["tool"]["poetry"]["version"].strip()


def get_change_log_version():
# Path overloads __truediv__
with open(Path(__file__).parent / ".." / "doc" / "changes" / "changelog.md") as changelog:
changelog_str = changelog.read()
# Search for the FIRST pattern like: "* [0.5.0](changes_0.5.0.md)" in the changelog file.
# Note that we encapsulate the [(0.5.0)] with parenthesis, which tells re to return the matching string as group
version_match = re.search(r"\* \[([0-9]+.[0-9]+.[0-9]+)]\(\S+\)", changelog_str)
return version_match.groups()[0]


if __name__ == '__main__':
poetry_version = get_poetry_version()
latest_tag = get_git_version()
changelog_version = get_change_log_version()
print(f'Changelog version: "{changelog_version}"')
print(f'Current version: "{poetry_version}"')
print(f'Latest git tag: "{latest_tag}"')

# We expect that the current version in pyproject.toml is always greater than the latest tag.
# Thus we avoid creating a release without having the version number updated.
if not version.parse(poetry_version) > version.parse(latest_tag):
raise ValueError("Poetry version needs to be updated!")

if changelog_version != poetry_version:
raise ValueError("Poetry version differs from Changelog version!")

print("Everything looks good")

0 comments on commit fe25840

Please sign in to comment.