Skip to content

Commit

Permalink
fix SLC upload and added version check(copied from TE)
Browse files Browse the repository at this point in the history
  • Loading branch information
MarleneKress79789 committed Jan 18, 2024
1 parent 4ff43df commit 24f8175
Show file tree
Hide file tree
Showing 7 changed files with 261 additions and 112 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"
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,4 @@ jobs:
uses: shogo82148/actions-upload-release-asset@v1
with:
upload_url: ${{ github.event.inputs.upload_url }}
asset_path: $RELEASE_DIR/*
asset_path: ${{ env.RELEASE_DIR }}/*
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.8.0](changes_0.8.0.md)
* [0.7.0](changes_0.7.0.md)
* [0.6.0](changes_0.6.0.md)
* [0.5.0](changes_0.5.0.md)
Expand Down
23 changes: 23 additions & 0 deletions doc/changes/changes_0.8.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# SageMaker Extension 0.8.0, released T.B.D

Code name: T.B.D

## Summary

T.B.D

### Features

n/a

### Bug Fixes

- #107: Fixed SLC upload in CI workflow and added version check script and workflow

### Documentation

n/a

### Refactoring

n/a
277 changes: 167 additions & 110 deletions poetry.lock

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "exasol-sagemaker-extension"
version = "0.7.0"
version = "0.8.0"
description = "Exasol SageMaker Integration"

license = "MIT"
Expand Down Expand Up @@ -41,6 +41,8 @@ exasol-bucketfs = "^0.6.0"
poethepoet = "^0.13.1"
localstack-client = "^1.25"
boto3 = "^1.20.40"
toml = "^0.10.2"
gitpython = "^3.1.41"

[build-system]
requires = ["poetry-core>=1.0.0"]
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 24f8175

Please sign in to comment.