CLI - Update version to include revision hash and date (#427)
Update version to include revision hash and date in "{last tag}+g{git hash}.d{date}" format, here're the examples: * exact tag: 0.6.0 * commit after tag: 0.6.0+gcbb1b34 * commit after tag with local changes: 0.6.0+gcbb1b34.d20221028
This commit is contained in:
Родитель
7a27732e97
Коммит
d7bb8303fb
|
@ -10,6 +10,7 @@ outputs/
|
|||
|
||||
# Git
|
||||
**/.git
|
||||
!/.git
|
||||
**/.gitmodules
|
||||
**/.dockerignore
|
||||
.github/
|
||||
|
|
|
@ -130,6 +130,7 @@ ADD third_party third_party
|
|||
RUN make -C third_party cuda
|
||||
|
||||
ADD . .
|
||||
RUN python3 -m pip install .[nvworker] && \
|
||||
RUN python3 -m pip install --no-cache-dir .[nvworker] && \
|
||||
make cppbuild && \
|
||||
make postinstall
|
||||
make postinstall && \
|
||||
rm -rf .git
|
||||
|
|
|
@ -126,6 +126,8 @@ ADD third_party third_party
|
|||
RUN make -C third_party rocm
|
||||
|
||||
ADD . .
|
||||
RUN python3 -m pip install .[amdworker] && \
|
||||
RUN python3 -m pip install --upgrade setuptools && \
|
||||
python3 -m pip install --no-cache-dir .[amdworker] && \
|
||||
make cppbuild && \
|
||||
make postinstall
|
||||
make postinstall && \
|
||||
rm -rf .git
|
||||
|
|
|
@ -141,6 +141,7 @@ ADD third_party third_party
|
|||
RUN make ROCBLAS_BRANCH=release/rocm-rel-5.1 -C third_party rocm
|
||||
|
||||
ADD . .
|
||||
RUN python3 -m pip install .[amdworker] && \
|
||||
RUN python3 -m pip install --no-cache-dir .[amdworker] && \
|
||||
make cppbuild && \
|
||||
make postinstall
|
||||
make postinstall && \
|
||||
rm -rf .git
|
||||
|
|
17
setup.py
17
setup.py
|
@ -18,9 +18,9 @@ from setuptools import setup, find_packages, Command
|
|||
import superbench
|
||||
|
||||
try:
|
||||
pkg_resources.require(['pip>=18'])
|
||||
pkg_resources.require(['pip>=18', 'setuptools>=45'])
|
||||
except (pkg_resources.VersionConflict, pkg_resources.DistributionNotFound):
|
||||
print('Try upgrade pip to latest version, for example, python3 -m pip install --upgrade pip')
|
||||
print('Try upgrade pip/setuptools to latest version, for example, python3 -m pip install --upgrade pip setuptools')
|
||||
raise
|
||||
|
||||
here = pathlib.Path(__file__).parent.resolve()
|
||||
|
@ -48,7 +48,7 @@ class Formatter(Command):
|
|||
|
||||
def run(self):
|
||||
"""Fromat the code using yapf."""
|
||||
errno = os.system('python3 -m yapf --in-place --recursive --exclude .git .')
|
||||
errno = os.system('python3 -m yapf --in-place --recursive --exclude .git --exclude .eggs .')
|
||||
sys.exit(0 if errno == 0 else 1)
|
||||
|
||||
|
||||
|
@ -76,7 +76,7 @@ class Linter(Command):
|
|||
errno = os.system(
|
||||
' && '.join(
|
||||
[
|
||||
'python3 -m yapf --diff --recursive --exclude .git .',
|
||||
'python3 -m yapf --diff --recursive --exclude .git --exclude .eggs .',
|
||||
'python3 -m mypy .',
|
||||
'python3 -m flake8',
|
||||
]
|
||||
|
@ -139,10 +139,19 @@ setup(
|
|||
keywords='benchmark, AI systems',
|
||||
packages=find_packages(exclude=['tests']),
|
||||
python_requires='>=3.6, <4',
|
||||
use_scm_version={
|
||||
'local_scheme': 'node-and-date',
|
||||
'version_scheme': lambda _: superbench.__version__,
|
||||
'fallback_version': f'{superbench.__version__}+unknown',
|
||||
},
|
||||
setup_requires=[
|
||||
'setuptools_scm',
|
||||
],
|
||||
install_requires=[
|
||||
'ansible_base>=2.10.9;os_name=="posix"',
|
||||
'ansible_runner>=2.0.0rc1',
|
||||
'colorlog>=6.7.0',
|
||||
'importlib_metadata',
|
||||
'jinja2>=2.10.1',
|
||||
'joblib>=1.0.1',
|
||||
'jsonlines>=2.0.0',
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
"""SuperBench CLI command handler."""
|
||||
|
||||
from pathlib import Path
|
||||
from importlib_metadata import version, PackageNotFoundError
|
||||
|
||||
from knack.util import CLIError
|
||||
from omegaconf import OmegaConf
|
||||
|
@ -170,11 +171,14 @@ def process_runner_arguments(
|
|||
|
||||
|
||||
def version_command_handler():
|
||||
"""Print the current SuperBench tool version.
|
||||
"""Print the current SuperBench tool version in "{last tag}+g{git hash}.d{date}" format.
|
||||
|
||||
Returns:
|
||||
str: current SuperBench tool version.
|
||||
"""
|
||||
try:
|
||||
return version('superbench')
|
||||
except PackageNotFoundError:
|
||||
return superbench.__version__
|
||||
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
import io
|
||||
import contextlib
|
||||
from functools import wraps
|
||||
from knack.testsdk import ScenarioTest, StringCheck, NoneCheck, JMESPathCheck
|
||||
from knack.testsdk import ScenarioTest, StringContainCheck, NoneCheck, JMESPathCheck
|
||||
from pathlib import Path
|
||||
|
||||
import superbench
|
||||
|
@ -51,7 +51,7 @@ class SuperBenchCLIScenarioTest(ScenarioTest):
|
|||
|
||||
def test_sb_version(self):
|
||||
"""Test sb version."""
|
||||
self.cmd('sb version', checks=[StringCheck(superbench.__version__)])
|
||||
self.cmd('sb version', checks=[StringContainCheck(superbench.__version__)])
|
||||
|
||||
def test_sb_deploy(self):
|
||||
"""Test sb deploy."""
|
||||
|
|
Загрузка…
Ссылка в новой задаче