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"
|
description = "Shell to Python Continuous Deployment"
|
||||||
dynamic = ["version"]
|
dynamic = ["version"]
|
||||||
keywords = []
|
keywords = []
|
||||||
license-files = { paths = ["license.md"] }
|
license-files = ["license.md"]
|
||||||
name = "spcd"
|
name = "spcd"
|
||||||
readme = "readme.md"
|
readme = "readme.md"
|
||||||
requires-python = ">= 3.11"
|
requires-python = ">= 3.11"
|
||||||
|
|
|
@ -16,6 +16,7 @@ from spcd.shell import env
|
||||||
from spcd.util import browse, cat, split, step
|
from spcd.util import browse, cat, split, step
|
||||||
|
|
||||||
COMMANDS_PREFIX = "spcd-"
|
COMMANDS_PREFIX = "spcd-"
|
||||||
|
ENTRY_POINT = "__main__.py"
|
||||||
|
|
||||||
|
|
||||||
def clone_project_branch() -> None:
|
def clone_project_branch() -> None:
|
||||||
|
@ -50,7 +51,7 @@ def install_actions() -> None:
|
||||||
name = "action.yaml"
|
name = "action.yaml"
|
||||||
root = project.root / "act"
|
root = project.root / "act"
|
||||||
vpy = Path(env.SPCD_PYTHON_VENV_BINARIES) / "python"
|
vpy = Path(env.SPCD_PYTHON_VENV_BINARIES) / "python"
|
||||||
for action in ["action", "synchronize"]:
|
for action in ("action", "synchronize"):
|
||||||
log.info(action)
|
log.info(action)
|
||||||
directory = root / action
|
directory = root / action
|
||||||
fs.make_directory(directory)
|
fs.make_directory(directory)
|
||||||
|
@ -91,12 +92,12 @@ def install_commands(path: Path) -> None:
|
||||||
"""
|
"""
|
||||||
step("Install commands")
|
step("Install commands")
|
||||||
user = Path("/usr/local/bin")
|
user = Path("/usr/local/bin")
|
||||||
for command in [
|
for command in (
|
||||||
"browse-workspace",
|
"browse-workspace",
|
||||||
"build-project",
|
"build-project",
|
||||||
"check-project",
|
"check-project",
|
||||||
"synchronize",
|
"synchronize",
|
||||||
]:
|
):
|
||||||
log.info(command)
|
log.info(command)
|
||||||
(user / f"{COMMANDS_PREFIX}{command}").symlink_to(path)
|
(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:
|
if env.SPCD_PYTHON_VENV_BINARIES not in paths:
|
||||||
environ["PATH"] = pathsep.join([env.SPCD_PYTHON_VENV_BINARIES, *paths])
|
environ["PATH"] = pathsep.join([env.SPCD_PYTHON_VENV_BINARIES, *paths])
|
||||||
path, *arguments = sys.argv
|
path, *arguments = sys.argv
|
||||||
name = Path(path).name
|
if (name := Path(path).name) == ENTRY_POINT:
|
||||||
if name == "__main__.py":
|
|
||||||
if arguments:
|
if arguments:
|
||||||
name, *arguments = arguments
|
name, *arguments = arguments
|
||||||
f = getattr(act, name)
|
f = getattr(act, name)
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
"""Actions available for workflows."""
|
"""Actions available for workflows."""
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import os
|
import os
|
||||||
from ast import literal_eval
|
from ast import literal_eval
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
17
spcd/cmd.py
17
spcd/cmd.py
|
@ -1,6 +1,8 @@
|
||||||
"""Commands available for workflows."""
|
"""Commands available for workflows."""
|
||||||
|
|
||||||
import os
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from os import sep
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from rwx import ps
|
from rwx import ps
|
||||||
|
@ -17,7 +19,7 @@ def spcd_browse_workspace() -> None:
|
||||||
|
|
||||||
def spcd_build_project() -> None:
|
def spcd_build_project() -> None:
|
||||||
"""Perform the actual building process."""
|
"""Perform the actual building process."""
|
||||||
for extension in ["py", "sh"]:
|
for extension in ("py", "sh"):
|
||||||
path = project.root / f"build.{extension}"
|
path = project.root / f"build.{extension}"
|
||||||
if path.exists():
|
if path.exists():
|
||||||
ps.run(str(path))
|
ps.run(str(path))
|
||||||
|
@ -31,7 +33,8 @@ def spcd_check_project() -> None:
|
||||||
|
|
||||||
|
|
||||||
def spcd_synchronize(
|
def spcd_synchronize(
|
||||||
source: str | None = None, target: str | None = None
|
source: str | None = None,
|
||||||
|
target: str | None = None,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Synchronize output towards a target.
|
"""Synchronize output towards a target.
|
||||||
|
|
||||||
|
@ -43,9 +46,7 @@ def spcd_synchronize(
|
||||||
if not target:
|
if not target:
|
||||||
user = "cd"
|
user = "cd"
|
||||||
host = env.SPCD_PROJECT_PATH
|
host = env.SPCD_PROJECT_PATH
|
||||||
root = (
|
root = Path(sep) / user / projects.group / project.name / project.branch
|
||||||
Path(os.sep) / user / projects.group / project.name / project.branch
|
|
||||||
)
|
|
||||||
target = f"{user}@{host}:{root}"
|
target = f"{user}@{host}:{root}"
|
||||||
if not source:
|
if not source:
|
||||||
source = "out"
|
source = "out"
|
||||||
|
@ -54,6 +55,6 @@ def spcd_synchronize(
|
||||||
"--archive",
|
"--archive",
|
||||||
"--delete-before",
|
"--delete-before",
|
||||||
"--verbose",
|
"--verbose",
|
||||||
f"{source}/",
|
f"{source}{sep}",
|
||||||
f"{target}/",
|
f"{target}{sep}",
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Reference in a new issue