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

Added version check and prepare release #168

Merged
merged 7 commits into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from 5 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
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"
1 change: 1 addition & 0 deletions doc/changes/changelog.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
21 changes: 11 additions & 10 deletions doc/changes/changes_0.7.0.md
Original file line number Diff line number Diff line change
@@ -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

kaklakariada marked this conversation as resolved.
Show resolved Hide resolved
### 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

- #144: Updated Cryptography to version 41.0.7

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.

3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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 = [
Expand Down 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
50 changes: 50 additions & 0 deletions scripts/check_release_version.py
Original file line number Diff line number Diff line change
@@ -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:
kaklakariada marked this conversation as resolved.
Show resolved Hide resolved
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")
Loading