39 lines
851 B
Python
39 lines
851 B
Python
|
|
from __future__ import annotations
|
||
|
|
|
||
|
|
import subprocess
|
||
|
|
|
||
|
|
QA_COMMANDS: tuple[tuple[str, ...], ...] = (
|
||
|
|
(
|
||
|
|
"tailwindcss",
|
||
|
|
"-i",
|
||
|
|
"./repub/static/app.tailwind.css",
|
||
|
|
"-o",
|
||
|
|
"./repub/static/app.css",
|
||
|
|
),
|
||
|
|
("black", "repub/", "tests/"),
|
||
|
|
("flake8", "repub/", "tests/"),
|
||
|
|
("pyright",),
|
||
|
|
("pytest",),
|
||
|
|
)
|
||
|
|
|
||
|
|
QA_FINAL_COMMANDS: tuple[tuple[str, ...], ...] = QA_COMMANDS + (
|
||
|
|
("nix", "fmt"),
|
||
|
|
("nix", "flake", "check"),
|
||
|
|
)
|
||
|
|
|
||
|
|
|
||
|
|
def _run_commands(commands: tuple[tuple[str, ...], ...]) -> int:
|
||
|
|
for command in commands:
|
||
|
|
result = subprocess.run(command, check=False)
|
||
|
|
if result.returncode != 0:
|
||
|
|
return result.returncode
|
||
|
|
return 0
|
||
|
|
|
||
|
|
|
||
|
|
def qa_entrypoint() -> int:
|
||
|
|
return _run_commands(QA_COMMANDS)
|
||
|
|
|
||
|
|
|
||
|
|
def qa_final_entrypoint() -> int:
|
||
|
|
return _run_commands(QA_FINAL_COMMANDS)
|