Skip to content

Commit

Permalink
Merge pull request #11 from iosis-tech/makefile
Browse files Browse the repository at this point in the history
makefile.toml
  • Loading branch information
Okm165 authored Apr 26, 2024
2 parents d8c2419 + 507595e commit 891db11
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 44 deletions.
38 changes: 38 additions & 0 deletions Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,41 @@ args = ["build"]
workspace = false
command = "cargo"
args = ["nextest", "run", "--workspace", "${@}"]

[tasks.python-requirements-install]
workspace = false
command = "pip"
args = ["install", "-r", "requirements.txt"]

[tasks.python-bootloader-install]
workspace = false
command = "pip"
args = ["install", "cairo/"]

[tasks.stone-prover-clone]
workspace = false
ignore_errors = true
command = "git"
args = ["clone", "https://github.com/starkware-libs/stone-prover.git"]

[tasks.stone-prover-build]
workspace = false
dependencies = ["stone-prover-clone"]
script = ["cd stone-prover && docker build --tag prover ."]

[tasks.stone-prover-install]
workspace = false
dependencies = ["stone-prover-build"]
script = [
"container_id=$(docker create prover)",
"docker cp -L ${container_id}:/bin/cpu_air_prover $HOME/.local/bin",
"docker cp -L ${container_id}:/bin/cpu_air_verifier $HOME/.local/bin",
]

[tasks.setup]
workspace = false
dependencies = [
"python-requirements-install",
"python-bootloader-install",
"stone-prover-install",
]
2 changes: 1 addition & 1 deletion compile.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import os
from install import log_and_run
from utils import log_and_run

if __name__ == "__main__":
current_dir = os.getcwd()
Expand Down
42 changes: 0 additions & 42 deletions install.py

This file was deleted.

2 changes: 1 addition & 1 deletion run.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from install import log_and_run
from utils import log_and_run

if __name__ == "__main__":
log_and_run([
Expand Down
17 changes: 17 additions & 0 deletions utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import subprocess

def log_and_run(commands, description, cwd=None):
from colorama import Fore, Style

full_command = " && ".join(commands)
try:
print(f"{Fore.YELLOW}Starting: {description}...{Style.RESET_ALL}")
print(f"{Fore.CYAN}Command: {full_command}{Style.RESET_ALL}")
result = subprocess.run(
full_command, shell=True, check=True, cwd=cwd, text=True
)
print(f"{Fore.GREEN}Success: {description} completed!\n{Style.RESET_ALL}")
except subprocess.CalledProcessError as e:
print(
f"{Fore.RED}Error running command '{full_command}': {e}\n{Style.RESET_ALL}"
)

0 comments on commit 891db11

Please sign in to comment.