-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Progress on #130 and #294. With this, every package has its own `version_info.json` which defaults to a dev build (`X.Y.Z.dev`). Based on this version information the version identifier for a release candate can be computed (`X.Y.ZrcYYYYMMDD`) which is written to corresponding `version_info_rc.json` files. This PR further adapt the build packages workflow to make use of the script and apply the new versioning scheme. Even though sharktank packages are not yet build, the workflow already generates the rc version numbers for sharttank and shortfin.
- Loading branch information
Showing
8 changed files
with
98 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Local-only config options | ||
version_info_rc.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"package-version": "3.0.0.dev" | ||
} |