Add qa command entrypoints
This commit is contained in:
parent
f3f4badaa2
commit
e796e09d14
4 changed files with 111 additions and 5 deletions
38
repub/qa.py
Normal file
38
repub/qa.py
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
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)
|
||||
Loading…
Add table
Add a link
Reference in a new issue