driazati commented on a change in pull request #9534:
URL: https://github.com/apache/tvm/pull/9534#discussion_r762260719



##########
File path: tests/scripts/ci.py
##########
@@ -0,0 +1,159 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+import sys
+import multiprocessing
+import os
+import click
+import getpass
+import contextlib
+import subprocess
+from pathlib import Path
+from typing import List, Dict, Any
+
+REPO_ROOT = Path(__file__).resolve().parent.parent.parent
+NPROC = multiprocessing.cpu_count()
+
+
+class col:
+    BLUE = "\033[94m"
+    CYAN = "\033[96m"
+    GREEN = "\033[92m"
+    YELLOW = "\033[93m"
+    RED = "\033[91m"
+    RESET = "\033[0m"
+    BOLD = "\033[1m"
+    UNDERLINE = "\033[4m"
+
+
+def print_color(color: str, msg: str, **kwargs: Any) -> None:
+    if hasattr(sys.stdout, "isatty") and sys.stdout.isatty():
+        print(col.BOLD + color + msg + col.RESET, **kwargs)
+    else:
+        print(msg, **kwargs)
+
+
+def clean_exit(msg: str) -> None:
+    print_color(col.RED, msg, file=sys.stderr)
+    exit(1)
+
+
+def cmd(commands: List[Any], **kwargs: Any):
+    commands = [str(s) for s in commands]
+    command_str = " ".join(commands)
+    print_color(col.BLUE, command_str)
+    proc = subprocess.run(commands, **kwargs)
+    if proc.returncode != 0:
+        raise RuntimeError(f"Command failed: '{command_str}'")
+
+
+def cleanup():
+    # chown the directories back to the current user in case Docker generated
+    # files with a different user ID

Review comment:
       I wasn't in the docker group, fixed that locally so `sudo` isn't 
required anymore and added a check in the script




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to