-
Notifications
You must be signed in to change notification settings - Fork 31
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
Apply new versioning scheme #398
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# Copyright 2024 Advanced Micro Devices, Inc. | ||
# | ||
# Licensed under the Apache License v2.0 with LLVM Exceptions. | ||
# See https://llvm.org/LICENSE.txt for license information. | ||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
|
||
# This scripts grabs the X.Y.Z[.dev]` version identifier from a | ||
# `version_info.json` and writes the corresponding | ||
# `X.Y.ZrcYYYYMMDD` version identifier to `version_rc_info.json`. | ||
|
||
import argparse | ||
from pathlib import Path | ||
import json | ||
from datetime import datetime | ||
|
||
from packaging.version import Version | ||
|
||
|
||
parser = argparse.ArgumentParser() | ||
parser.add_argument("path", type=Path) | ||
args = parser.parse_args() | ||
|
||
VERSION_INFO_FILE = args.path / "version_info.json" | ||
VERSION_INFO_RC_FILE = args.path / "version_info_rc.json" | ||
|
||
|
||
def load_version_info(): | ||
with open(VERSION_INFO_FILE, "rt") as f: | ||
return json.load(f) | ||
|
||
|
||
def write_version_info(): | ||
with open(VERSION_INFO_RC_FILE, "w") as f: | ||
json.dump(version_info_rc, f, indent=2) | ||
f.write("\n") | ||
|
||
|
||
version_info = load_version_info() | ||
|
||
PACKAGE_VERSION = version_info.get("package-version") | ||
PACKAGE_BASE_VERSION = Version(PACKAGE_VERSION).base_version | ||
PACKAGE_RC_VERSION = PACKAGE_BASE_VERSION + "rc" + datetime.today().strftime("%Y%m%d") | ||
|
||
version_info_rc = {"package-version": PACKAGE_RC_VERSION} | ||
|
||
write_version_info() | ||
|
||
print(PACKAGE_RC_VERSION) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Local-only config options | ||
version_info_rc.json |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,15 +14,22 @@ | |
|
||
# Setup and get version information. | ||
VERSION_INFO_FILE = os.path.join(SETUPPY_DIR, "version_info.json") | ||
VERSION_INFO_RC_FILE = os.path.join(SETUPPY_DIR, "version_info_rc.json") | ||
|
||
|
||
def load_version_info(): | ||
with open(VERSION_INFO_FILE, "rt") as f: | ||
def load_version_info(version_file): | ||
with open(version_file, "rt") as f: | ||
return json.load(f) | ||
|
||
|
||
version_info = load_version_info() | ||
PACKAGE_VERSION = version_info["package-version"] | ||
try: | ||
version_info = load_version_info(VERSION_INFO_RC_FILE) | ||
except FileNotFoundError: | ||
print("version_info_rc.json not found. Default to dev build") | ||
version_info = load_version_info(VERSION_INFO_FILE) | ||
Comment on lines
+25
to
+29
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, interesting choice to have two different files. Did you consider other approaches? I can think of a few:
Multiple ways to do it, and what you have works. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think there are even more:
With regards to the ones you listed:
But I am happy to iterate in a follow up but this one should also be compatible with what we will need for IREE. |
||
|
||
PACKAGE_VERSION = version_info.get("package-version") | ||
print(f"Using PACKAGE_VERSION: '{PACKAGE_VERSION}'") | ||
|
||
setup( | ||
version=f"{PACKAGE_VERSION}", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
{ | ||
"package-version": "0.1.dev3" | ||
"package-version": "3.0.0.dev" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
# Local-only config options | ||
version_info.json | ||
version_info_rc.json |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"package-version": "3.0.0.dev" | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you test this workflow? Should be possible with
workflow_dispatch
over at https://github.com/marbre/SHARK-Platform/actions/workflows/build_packages.yml... which reminds me, we may want to disable it in forks somehow. I tested at https://github.com/ScottTodd/SHARK-Platform/actions/workflows/build_packages.yml, generating these: https://github.com/ScottTodd/SHARK-Platform/releases/tag/dev-wheels
I see that several forks are running the action too, which is failing because of the missing token: https://github.com/nithinsubbiah/sharktank/actions/workflows/build_packages.yml but some runs did succeed at one point: https://github.com/nithinsubbiah/sharktank/releases/tag/dev-wheels
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not yet till now: https://github.com/marbre/SHARK-Platform/actions/runs/11615896057
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks promising :)
https://github.com/marbre/SHARK-Platform/actions/runs/11615896057/job/32347586648#step:4:1434