mirror of
https://github.com/cmz0228/hysteria-dev.git
synced 2025-06-08 21:39:53 +00:00
ci: test subcommand for hyperbole
This commit is contained in:
parent
81a98e1e5a
commit
6bcb00a0cc
25
hyperbole.py
25
hyperbole.py
@ -310,6 +310,25 @@ def cmd_tidy():
|
|||||||
print("Failed to sync go work")
|
print("Failed to sync go work")
|
||||||
|
|
||||||
|
|
||||||
|
def cmd_test(module=None):
|
||||||
|
if not check_build_env():
|
||||||
|
return
|
||||||
|
|
||||||
|
if module:
|
||||||
|
print("Testing %s..." % module)
|
||||||
|
try:
|
||||||
|
subprocess.check_call(["go", "test", "-v", "./..."], cwd=module)
|
||||||
|
except Exception:
|
||||||
|
print("Failed to test %s" % module)
|
||||||
|
else:
|
||||||
|
for dir in MODULE_SRC_DIRS:
|
||||||
|
print("Testing %s..." % dir)
|
||||||
|
try:
|
||||||
|
subprocess.check_call(["go", "test", "-v", "./..."], cwd=dir)
|
||||||
|
except Exception:
|
||||||
|
print("Failed to test %s" % dir)
|
||||||
|
|
||||||
|
|
||||||
def cmd_clean():
|
def cmd_clean():
|
||||||
shutil.rmtree(BUILD_DIR, ignore_errors=True)
|
shutil.rmtree(BUILD_DIR, ignore_errors=True)
|
||||||
|
|
||||||
@ -350,6 +369,10 @@ def main():
|
|||||||
# Tidy
|
# Tidy
|
||||||
p_cmd.add_parser("tidy", help="Tidy the go modules")
|
p_cmd.add_parser("tidy", help="Tidy the go modules")
|
||||||
|
|
||||||
|
# Test
|
||||||
|
p_test = p_cmd.add_parser("test", help="Test the code")
|
||||||
|
p_test.add_argument("module", nargs="?", help="Module to test")
|
||||||
|
|
||||||
# Clean
|
# Clean
|
||||||
p_cmd.add_parser("clean", help="Clean the build directory")
|
p_cmd.add_parser("clean", help="Clean the build directory")
|
||||||
|
|
||||||
@ -368,6 +391,8 @@ def main():
|
|||||||
cmd_mockgen()
|
cmd_mockgen()
|
||||||
elif args.command == "tidy":
|
elif args.command == "tidy":
|
||||||
cmd_tidy()
|
cmd_tidy()
|
||||||
|
elif args.command == "test":
|
||||||
|
cmd_test(args.module)
|
||||||
elif args.command == "clean":
|
elif args.command == "clean":
|
||||||
cmd_clean()
|
cmd_clean()
|
||||||
elif args.command == "about":
|
elif args.command == "about":
|
||||||
|
Loading…
x
Reference in New Issue
Block a user