Build: Add mini validation during GUI build

This commit is contained in:
Mykola Grymalyuk
2023-01-06 14:33:40 -07:00
parent f4d6ef1741
commit 3e8963c372
2 changed files with 29 additions and 0 deletions

View File

@@ -85,6 +85,8 @@ class create_binary:
self.move_launcher()
self.patch_load_command()
self.add_commit_data()
self.post_flight_cleanup()
self.mini_validate()
def build_binary(self):
if Path(f"./dist/OpenCore-Patcher.app").exists():
@@ -266,5 +268,31 @@ class create_binary:
print(mv_output.stderr.decode('utf-8'))
raise Exception("Move failed")
def post_flight_cleanup(self):
# Remove ./dist/OpenCore-Patcher
path = "./dist/OpenCore-Patcher"
print(f" - Removing {path}")
rm_output = subprocess.run(
["rm", "-rf", path],
stdout=subprocess.PIPE, stderr=subprocess.PIPE
)
if rm_output.returncode != 0:
print(f" - Remove failed: {path}")
print(rm_output.stderr.decode('utf-8'))
raise Exception(f"Remove failed: {path}")
def mini_validate(self):
# Ensure binary can start
# Only build a single config, TUI CI will do in-depth validation
print(" - Validating binary")
validate_output = subprocess.run(
["./dist/OpenCore-Patcher.app/Contents/MacOS/OpenCore-Patcher", "--build", "--model", "MacPro3,1"],
stdout=subprocess.PIPE, stderr=subprocess.PIPE
)
if validate_output.returncode != 0:
print(" - Validation failed")
print(validate_output.stderr.decode('utf-8'))
raise Exception("Validation failed")
if __name__ == "__main__":
create_binary()