mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-12-06 07:48:50 +08:00
Run_actions quit on failed action
This commit is contained in:
1 parent
0734dfc63c
commit
31a465c62f
1 file changed
+23
-4
@@ -1,29 +1,48 @@
|
|||||||
"""Simple yaml debugger"""
|
"""Simple yaml debugger"""
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import sys
|
||||||
|
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
LOCAL_TESTS = ["Run Black", "Python Pylint", "Test with pytest"]
|
LOCAL_TESTS = ["Run Black", "Python Pylint", "Test with pytest"]
|
||||||
|
|
||||||
|
|
||||||
|
def run_command(command):
|
||||||
|
"""Run a command kill actions if it fails"""
|
||||||
|
ret_code = subprocess.call(command, shell=True)
|
||||||
|
if ret_code != 0:
|
||||||
|
print(f"\033[31mError: `{curr_command}` failed. Exiting...\033[0m")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
with open(".github/workflows/code_checks.yml", "rb") as f:
|
with open(".github/workflows/code_checks.yml", "rb") as f:
|
||||||
my_dict = yaml.safe_load(f)
|
my_dict = yaml.safe_load(f)
|
||||||
steps = my_dict["jobs"]["build"]["steps"]
|
steps = my_dict["jobs"]["build"]["steps"]
|
||||||
|
|
||||||
|
print_green = lambda x: print(f"\033[32m{x}\033[0m")
|
||||||
|
|
||||||
for step in steps:
|
for step in steps:
|
||||||
if "name" in step and step["name"] in LOCAL_TESTS:
|
if "name" in step and step["name"] in LOCAL_TESTS:
|
||||||
compressed = step["run"].replace("\n", ";").replace("\\", "")
|
compressed = step["run"].replace("\n", ";").replace("\\", "")
|
||||||
curr_command = f"{compressed}"
|
curr_command = f"{compressed}"
|
||||||
|
|
||||||
print("*" * 100)
|
print("*" * 100)
|
||||||
print(f"Running {curr_command}")
|
print_green(f"Running: {curr_command}")
|
||||||
subprocess.call(curr_command, shell=True)
|
run_command(curr_command)
|
||||||
else:
|
else:
|
||||||
print("*" * 100)
|
print("*" * 100)
|
||||||
print(f"Skipping {step}")
|
print(f"Skipping {step}")
|
||||||
|
|
||||||
# Add checks for building documentation
|
# Add checks for building documentation
|
||||||
subprocess.call("cd docs/; make html; cd ../", shell=True)
|
print_green("Building Documentation")
|
||||||
|
run_command("cd docs/; make html; cd ../")
|
||||||
|
|
||||||
# Add licensing to all pyrad files
|
# Add licensing to all pyrad files
|
||||||
subprocess.call("./scripts/licensing/license_headers.sh", shell=True)
|
print_green("Add licensing headers")
|
||||||
|
run_command("./scripts/licensing/license_headers.sh")
|
||||||
|
|
||||||
|
print("\n")
|
||||||
|
print_green("=" * 100)
|
||||||
|
print_green("ALL CHECKS PASSED")
|
||||||
|
print_green("=" * 100)
|
||||||
Reference in new issue
Block a user