From a0f635d134a57b95c2014c86dbec0849890a6a6d Mon Sep 17 00:00:00 2001 From: MarleneKress79789 Date: Tue, 19 Dec 2023 13:24:14 +0100 Subject: [PATCH 1/6] [CodeBuild] add version check and prepare release --- .github/workflows/check_version.yaml | 14 ++++++++++++++ doc/changes/changelog.md | 1 + doc/changes/changes_0.7.0.md | 21 +++++++++++---------- poetry.lock | 14 +++++++++++++- pyproject.toml | 3 ++- 5 files changed, 41 insertions(+), 12 deletions(-) create mode 100644 .github/workflows/check_version.yaml diff --git a/.github/workflows/check_version.yaml b/.github/workflows/check_version.yaml new file mode 100644 index 00000000..c3fd7505 --- /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: ./scripts/build/check_release.sh \ No newline at end of file diff --git a/doc/changes/changelog.md b/doc/changes/changelog.md index 232f6f79..a63fa416 100644 --- a/doc/changes/changelog.md +++ b/doc/changes/changelog.md @@ -1,5 +1,6 @@ # Changelog +* [0.7.0](changes_0.7.0.md) * [0.6.0](changes_0.6.0.md) * [0.5.0](changes_0.5.0.md) * [0.4.0](changes_0.4.0.md) diff --git a/doc/changes/changes_0.7.0.md b/doc/changes/changes_0.7.0.md index 0f3fef39..4295d8ed 100644 --- a/doc/changes/changes_0.7.0.md +++ b/doc/changes/changes_0.7.0.md @@ -1,24 +1,25 @@ -# Transformers Extension 0.7.0, released T.B.D +# Transformers Extension 0.7.0, released 2023-12-19 -Code name: T.B.D +Code name: Split SLC actions ## Summary -T.B.D +In this Release split 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 -### Bug Fixes + - #151: Made the container uploading and language registration two separate actions + - #167: Added version check workflow ### Refactorings - #144: Extracted base_model_udf.load_models into separate class - - -### Documentation - - + - #159: Refactored LanguageContainer Deployer to make it reusable by other extensions ### Security - - #144: Updated Cryptography to version 41.0.7 \ No newline at end of file + + - #144: Updated Cryptography to version 41.0.7 + \ No newline at end of file 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 777da56f..51a87c42 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "exasol-transformers-extension" -version = "0.5.0" +version = "0.7.0" description = "An Exasol extension to use state-of-the-art pretrained machine learning models via the transformers api." authors = [ @@ -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" From f54ba3e1dc97254d952cdbfc679376b852a6e9fa Mon Sep 17 00:00:00 2001 From: MarleneKress79789 Date: Tue, 19 Dec 2023 13:29:45 +0100 Subject: [PATCH 2/6] [CodeBuild] actually commit the version check script --- .github/workflows/check_version.yaml | 2 +- scripts/check_release_version.py | 50 ++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 scripts/check_release_version.py diff --git a/.github/workflows/check_version.yaml b/.github/workflows/check_version.yaml index c3fd7505..c08f4f5e 100644 --- a/.github/workflows/check_version.yaml +++ b/.github/workflows/check_version.yaml @@ -11,4 +11,4 @@ jobs: fetch-depth: 0 - uses: ./.github/actions/prepare_poetry_env - name: Check Release - run: ./scripts/build/check_release.sh \ No newline at end of file + run: ./scripts/check_release.sh \ No newline at end of file diff --git a/scripts/check_release_version.py b/scripts/check_release_version.py new file mode 100644 index 00000000..3bde41a6 --- /dev/null +++ b/scripts/check_release_version.py @@ -0,0 +1,50 @@ +import re +from pathlib import Path + +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 poetry_version > 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 From 02b8d0c82cfaa4244ee394fc786ba6ab77a995c9 Mon Sep 17 00:00:00 2001 From: MarleneKress79789 Date: Tue, 19 Dec 2023 13:31:34 +0100 Subject: [PATCH 3/6] [CodeBuild] fix path --- .github/workflows/check_version.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check_version.yaml b/.github/workflows/check_version.yaml index c08f4f5e..87943032 100644 --- a/.github/workflows/check_version.yaml +++ b/.github/workflows/check_version.yaml @@ -11,4 +11,4 @@ jobs: fetch-depth: 0 - uses: ./.github/actions/prepare_poetry_env - name: Check Release - run: ./scripts/check_release.sh \ No newline at end of file + run: ./scripts/check_release_version.sh \ No newline at end of file From 71f6f5d8c7f8579cdbbbbc7c050a9cb5f29a74be Mon Sep 17 00:00:00 2001 From: MarleneKress79789 Date: Tue, 19 Dec 2023 14:13:41 +0100 Subject: [PATCH 4/6] [CodeBuild] fix script call --- .github/workflows/check_version.yaml | 2 +- scripts/check_release_version.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/check_version.yaml b/.github/workflows/check_version.yaml index 87943032..90d1e90b 100644 --- a/.github/workflows/check_version.yaml +++ b/.github/workflows/check_version.yaml @@ -11,4 +11,4 @@ jobs: fetch-depth: 0 - uses: ./.github/actions/prepare_poetry_env - name: Check Release - run: ./scripts/check_release_version.sh \ No newline at end of file + run: poetry run python3 -u "./scripts/check_release.py" \ No newline at end of file diff --git a/scripts/check_release_version.py b/scripts/check_release_version.py index 3bde41a6..5a2a67f5 100644 --- a/scripts/check_release_version.py +++ b/scripts/check_release_version.py @@ -23,7 +23,7 @@ def get_poetry_version(): def get_change_log_version(): # Path overloads __truediv__ - with open(Path(__file__).parent / ".." / ".." / "doc" / "changes" / "changelog.md") as changelog: + 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 From f9c9660be2fc294d9ab4a4bbf26471f92e18d099 Mon Sep 17 00:00:00 2001 From: MarleneKress79789 Date: Tue, 19 Dec 2023 14:21:31 +0100 Subject: [PATCH 5/6] [CodeBuild] copy paste error again --- .github/workflows/check_version.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check_version.yaml b/.github/workflows/check_version.yaml index 90d1e90b..e4d044b4 100644 --- a/.github/workflows/check_version.yaml +++ b/.github/workflows/check_version.yaml @@ -11,4 +11,4 @@ jobs: fetch-depth: 0 - uses: ./.github/actions/prepare_poetry_env - name: Check Release - run: poetry run python3 -u "./scripts/check_release.py" \ No newline at end of file + run: poetry run python3 -u "./scripts/check_release_version.py" \ No newline at end of file From f48be2871b6a8a580317f18d8de53a0c980b930c Mon Sep 17 00:00:00 2001 From: MarleneKress79789 Date: Wed, 20 Dec 2023 12:18:51 +0100 Subject: [PATCH 6/6] [CodeBuild] changes from code review --- doc/changes/changes_0.7.0.md | 4 ++-- scripts/check_release_version.py | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/doc/changes/changes_0.7.0.md b/doc/changes/changes_0.7.0.md index 9388e81a..c2e53c99 100644 --- a/doc/changes/changes_0.7.0.md +++ b/doc/changes/changes_0.7.0.md @@ -1,11 +1,11 @@ -# Transformers Extension 0.7.0, released 2023-12-19 +# Transformers Extension 0.7.0, released 2023-12-20 Code name: Split SLC actions ## Summary -In this Release split the container uploading and registration into two separate actions. Additionally, +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 diff --git a/scripts/check_release_version.py b/scripts/check_release_version.py index 5a2a67f5..edf63400 100644 --- a/scripts/check_release_version.py +++ b/scripts/check_release_version.py @@ -1,6 +1,8 @@ import re from pathlib import Path +from packaging import version + from git import Repo import toml @@ -41,7 +43,7 @@ def get_change_log_version(): # 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 poetry_version > latest_tag: + if not version.parse(poetry_version) > version.parse(latest_tag): raise ValueError("Poetry version needs to be updated!") if changelog_version != poetry_version: