lint
Some checks failed
/ alpine (push) Failing after 22s
/ debian (push) Failing after 1m17s
/ ubuntu (push) Failing after 1m38s
/ arch (push) Failing after 37s
/ opensuse (push) Failing after 1m50s
/ fedora (push) Failing after 3m28s
/ alma (push) Failing after 4m10s
/ rocky (push) Failing after 6m12s
Some checks failed
/ alpine (push) Failing after 22s
/ debian (push) Failing after 1m17s
/ ubuntu (push) Failing after 1m38s
/ arch (push) Failing after 37s
/ opensuse (push) Failing after 1m50s
/ fedora (push) Failing after 3m28s
/ alma (push) Failing after 4m10s
/ rocky (push) Failing after 6m12s
This commit is contained in:
parent
128c2ef986
commit
dfd4219191
4 changed files with 17 additions and 14 deletions
|
@ -18,7 +18,7 @@ dependencies = ["rwx"]
|
|||
description = "Shell to Python Continuous Deployment"
|
||||
dynamic = ["version"]
|
||||
keywords = []
|
||||
license-files = { paths = ["license.md"] }
|
||||
license-files = ["license.md"]
|
||||
name = "spcd"
|
||||
readme = "readme.md"
|
||||
requires-python = ">= 3.11"
|
||||
|
|
|
@ -16,6 +16,7 @@ from spcd.shell import env
|
|||
from spcd.util import browse, cat, split, step
|
||||
|
||||
COMMANDS_PREFIX = "spcd-"
|
||||
ENTRY_POINT = "__main__.py"
|
||||
|
||||
|
||||
def clone_project_branch() -> None:
|
||||
|
@ -50,7 +51,7 @@ def install_actions() -> None:
|
|||
name = "action.yaml"
|
||||
root = project.root / "act"
|
||||
vpy = Path(env.SPCD_PYTHON_VENV_BINARIES) / "python"
|
||||
for action in ["action", "synchronize"]:
|
||||
for action in ("action", "synchronize"):
|
||||
log.info(action)
|
||||
directory = root / action
|
||||
fs.make_directory(directory)
|
||||
|
@ -91,12 +92,12 @@ def install_commands(path: Path) -> None:
|
|||
"""
|
||||
step("Install commands")
|
||||
user = Path("/usr/local/bin")
|
||||
for command in [
|
||||
for command in (
|
||||
"browse-workspace",
|
||||
"build-project",
|
||||
"check-project",
|
||||
"synchronize",
|
||||
]:
|
||||
):
|
||||
log.info(command)
|
||||
(user / f"{COMMANDS_PREFIX}{command}").symlink_to(path)
|
||||
|
||||
|
@ -147,8 +148,7 @@ def main(main_file: Path) -> None:
|
|||
if env.SPCD_PYTHON_VENV_BINARIES not in paths:
|
||||
environ["PATH"] = pathsep.join([env.SPCD_PYTHON_VENV_BINARIES, *paths])
|
||||
path, *arguments = sys.argv
|
||||
name = Path(path).name
|
||||
if name == "__main__.py":
|
||||
if (name := Path(path).name) == ENTRY_POINT:
|
||||
if arguments:
|
||||
name, *arguments = arguments
|
||||
f = getattr(act, name)
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
"""Actions available for workflows."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
from ast import literal_eval
|
||||
from pathlib import Path
|
||||
|
|
17
spcd/cmd.py
17
spcd/cmd.py
|
@ -1,6 +1,8 @@
|
|||
"""Commands available for workflows."""
|
||||
|
||||
import os
|
||||
from __future__ import annotations
|
||||
|
||||
from os import sep
|
||||
from pathlib import Path
|
||||
|
||||
from rwx import ps
|
||||
|
@ -17,7 +19,7 @@ def spcd_browse_workspace() -> None:
|
|||
|
||||
def spcd_build_project() -> None:
|
||||
"""Perform the actual building process."""
|
||||
for extension in ["py", "sh"]:
|
||||
for extension in ("py", "sh"):
|
||||
path = project.root / f"build.{extension}"
|
||||
if path.exists():
|
||||
ps.run(str(path))
|
||||
|
@ -31,7 +33,8 @@ def spcd_check_project() -> None:
|
|||
|
||||
|
||||
def spcd_synchronize(
|
||||
source: str | None = None, target: str | None = None
|
||||
source: str | None = None,
|
||||
target: str | None = None,
|
||||
) -> None:
|
||||
"""Synchronize output towards a target.
|
||||
|
||||
|
@ -43,9 +46,7 @@ def spcd_synchronize(
|
|||
if not target:
|
||||
user = "cd"
|
||||
host = env.SPCD_PROJECT_PATH
|
||||
root = (
|
||||
Path(os.sep) / user / projects.group / project.name / project.branch
|
||||
)
|
||||
root = Path(sep) / user / projects.group / project.name / project.branch
|
||||
target = f"{user}@{host}:{root}"
|
||||
if not source:
|
||||
source = "out"
|
||||
|
@ -54,6 +55,6 @@ def spcd_synchronize(
|
|||
"--archive",
|
||||
"--delete-before",
|
||||
"--verbose",
|
||||
f"{source}/",
|
||||
f"{target}/",
|
||||
f"{source}{sep}",
|
||||
f"{target}{sep}",
|
||||
)
|
||||
|
|
Loading…
Add table
Reference in a new issue