summaryrefslogtreecommitdiff
path: root/rola-devtools/scripts/check-all.py
blob: cd2ddf13cd0efff93034df65f38736d1dffaee1d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/env python3

import subprocess
import sys
from pathlib import Path

script_dir = Path(__file__).resolve().parent
root_dir = script_dir.parent.parent

steps = [
    ("cargo check --workspace", [
        "cargo", "check", "--workspace",
    ]),
    ("cargo clippy --workspace -- -D warnings", [
        "cargo", "clippy", "--workspace", "--", "-D", "warnings",
    ]),
    ("cargo build --workspace --release", [
        "cargo", "build", "--workspace", "--release",
    ]),
    ("dotnet restore", [
        "dotnet", "restore", "rola-desktop.sln",
    ]),
    ("dotnet build", [
        "dotnet", "build", "rola-desktop.sln", "--nologo",
    ]),
]

ok = True
for label, cmd in steps:
    print(f"\nSTEP - \"{label}\": ", flush=True)
    result = subprocess.run(cmd, cwd=root_dir)
    if result.returncode != 0:
        print(f"  [FAILED] Failed (exit code {result.returncode})", flush=True)
        ok = False
        break
    print(f"  [SUCCESS] Passed", flush=True)

sys.exit(0 if ok else 1)