diff --git a/.github/workflows/check_version.yaml b/.github/workflows/check_version.yaml new file mode 100644 index 00000000..e4d044b4 --- /dev/null +++ b/.github/workflows/check_version.yaml @@ -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" \ No newline at end of file diff --git a/doc/changes/changes_0.7.0.md b/doc/changes/changes_0.7.0.md index 831981f9..c2e53c99 100644 --- a/doc/changes/changes_0.7.0.md +++ b/doc/changes/changes_0.7.0.md @@ -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 diff --git a/poetry.lock b/poetry.lock index 87464f1b..5447cb8f 100644 --- a/poetry.lock +++ b/poetry.lock @@ -2027,6 +2027,18 @@ dev = ["tokenizers[testing]"] docs = ["setuptools_rust", "sphinx", "sphinx_rtd_theme"] testing = ["black (==22.3)", "datasets", "numpy", "pytest", "requests"] +[[package]] +name = "toml" +version = "0.10.2" +description = "Python Library for Tom's Obvious, Minimal Language" +category = "dev" +optional = false +python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*" +files = [ + {file = "toml-0.10.2-py2.py3-none-any.whl", hash = "sha256:806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b"}, + {file = "toml-0.10.2.tar.gz", hash = "sha256:b3bda1d108d5dd99f4a20d24d9c348e91c4db7ab1b749200bded2f839ccbe68f"}, +] + [[package]] name = "tomli" version = "2.0.1" @@ -2367,4 +2379,4 @@ testing = ["big-O", "jaraco.functools", "jaraco.itertools", "more-itertools", "p [metadata] lock-version = "2.0" python-versions = "^3.8.0" -content-hash = "bae6534475146fc2a89b432f91c9ccea5caeeebf468748ac4fd464ab3de591e7" +content-hash = "155ee12ea40608b861bd3bb5299abaf5ab130c9b1cd9087f54c8859824abe707" diff --git a/pyproject.toml b/pyproject.toml index 3d39bbc2..51a87c42 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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" diff --git a/scripts/check_release_version.py b/scripts/check_release_version.py new file mode 100644 index 00000000..edf63400 --- /dev/null +++ b/scripts/check_release_version.py @@ -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") \ No newline at end of file