actions/synchronize
Some checks failed
/ alpine (push) Successful in 45s
/ debian (push) Failing after 1m3s
/ ubuntu (push) Failing after 1m4s
/ arch (push) Successful in 1m42s
/ opensuse (push) Successful in 2m27s
/ fedora (push) Successful in 9m32s
/ alma (push) Failing after 1m40s
/ rocky (push) Failing after 2m28s
Some checks failed
/ alpine (push) Successful in 45s
/ debian (push) Failing after 1m3s
/ ubuntu (push) Failing after 1m4s
/ arch (push) Successful in 1m42s
/ opensuse (push) Successful in 2m27s
/ fedora (push) Successful in 9m32s
/ alma (push) Failing after 1m40s
/ rocky (push) Failing after 2m28s
This commit is contained in:
parent
f9c8cbc59e
commit
588bf5c6c4
3 changed files with 51 additions and 8 deletions
|
@ -10,7 +10,7 @@ from rwx import fs
|
||||||
from rwx.log import stream as log
|
from rwx.log import stream as log
|
||||||
from rwx.ps import run
|
from rwx.ps import run
|
||||||
|
|
||||||
from spcd import cmd
|
from spcd import act, cmd
|
||||||
from spcd.ci import project, projects
|
from spcd.ci import project, projects
|
||||||
from spcd.shell import env
|
from spcd.shell import env
|
||||||
from spcd.util import browse, cat, split, step
|
from spcd.util import browse, cat, split, step
|
||||||
|
@ -131,12 +131,17 @@ def main(main_file: Path) -> None:
|
||||||
path, *arguments = sys.argv
|
path, *arguments = sys.argv
|
||||||
name = Path(path).name
|
name = Path(path).name
|
||||||
if name == "__main__.py":
|
if name == "__main__.py":
|
||||||
list_environment_variables()
|
if arguments:
|
||||||
clone_project_branch()
|
name, *arguments = arguments
|
||||||
set_ssh()
|
f = getattr(act, name)
|
||||||
install_actions(main_file)
|
f(*arguments)
|
||||||
install_commands(main_file)
|
else:
|
||||||
install_python_packages()
|
list_environment_variables()
|
||||||
|
clone_project_branch()
|
||||||
|
set_ssh()
|
||||||
|
install_actions(main_file)
|
||||||
|
install_commands(main_file)
|
||||||
|
install_python_packages()
|
||||||
else:
|
else:
|
||||||
f = getattr(cmd, name.replace("-", "_"))
|
f = getattr(cmd, name.replace("-", "_"))
|
||||||
f(*arguments)
|
f(*arguments)
|
||||||
|
|
38
spcd/act.py
Normal file
38
spcd/act.py
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
"""Actions available for workflows."""
|
||||||
|
|
||||||
|
import os
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
from rwx import ps
|
||||||
|
|
||||||
|
from spcd.ci import project, projects
|
||||||
|
from spcd.shell import env
|
||||||
|
|
||||||
|
|
||||||
|
def synchronize(
|
||||||
|
source: str | None = None, target: str | None = None
|
||||||
|
) -> None:
|
||||||
|
"""Synchronize output towards a target.
|
||||||
|
|
||||||
|
:param source: where to deploy from
|
||||||
|
:type source: str | None
|
||||||
|
:param target: where to deploy to
|
||||||
|
:type target: str | None
|
||||||
|
"""
|
||||||
|
if not target:
|
||||||
|
user = "cd"
|
||||||
|
host = env.SPCD_PROJECT_PATH
|
||||||
|
root = (
|
||||||
|
Path(os.sep) / user / projects.group / project.name / project.branch
|
||||||
|
)
|
||||||
|
target = f"{user}@{host}:{root}"
|
||||||
|
if not source:
|
||||||
|
source = "out"
|
||||||
|
ps.run(
|
||||||
|
"rsync",
|
||||||
|
"--archive",
|
||||||
|
"--delete-before",
|
||||||
|
"--verbose",
|
||||||
|
f"{source}/",
|
||||||
|
f"{target}/",
|
||||||
|
)
|
|
@ -5,4 +5,4 @@ inputs:
|
||||||
runs:
|
runs:
|
||||||
using: composite
|
using: composite
|
||||||
steps:
|
steps:
|
||||||
- run: echo "synchronize"
|
- run: python3 -m "spcd" "synchronize"
|
||||||
|
|
Loading…
Reference in a new issue