Compare commits

..

38 commits
dev ... main

Author SHA1 Message Date
f1f3503c95
system/latest,previous
Some checks failed
/ alpine (push) Successful in 43s
/ debian (push) Failing after 1m1s
/ ubuntu (push) Failing after 1m22s
/ arch (push) Successful in 1m38s
/ opensuse (push) Successful in 2m30s
/ fedora (push) Successful in 8m13s
/ alma (push) Failing after 1m44s
/ rocky (push) Failing after 2m20s
2024-11-08 04:59:10 +01:00
7f5b6ebbf9
readme/managed
Some checks failed
/ alpine (push) Successful in 50s
/ debian (push) Failing after 1m8s
/ ubuntu (push) Failing after 1m21s
/ arch (push) Successful in 1m55s
/ opensuse (push) Successful in 2m37s
/ fedora (push) Successful in 8m3s
/ alma (push) Failing after 1m46s
/ rocky (push) Failing after 2m33s
2024-11-07 22:34:26 +01:00
beadc87c94
default−required
Some checks failed
/ alpine (push) Successful in 46s
/ debian (push) Failing after 1m3s
/ ubuntu (push) Failing after 1m2s
/ arch (push) Successful in 1m35s
/ opensuse (push) Successful in 2m30s
/ fedora (push) Successful in 8m50s
/ alma (push) Failing after 1m36s
/ rocky (push) Failing after 22m16s
2024-10-21 22:31:16 +02:00
8f6b4772a2
double
Some checks failed
/ alpine (push) Successful in 46s
/ debian (push) Successful in 1m14s
/ ubuntu (push) Successful in 1m22s
/ opensuse (push) Blocked by required conditions
/ fedora (push) Blocked by required conditions
/ alma (push) Blocked by required conditions
/ rocky (push) Blocked by required conditions
/ arch (push) Has been cancelled
2024-10-21 22:22:48 +02:00
07398c07ab
quote
Some checks failed
/ alpine (push) Successful in 47s
/ debian (push) Successful in 1m14s
/ arch (push) Blocked by required conditions
/ opensuse (push) Blocked by required conditions
/ fedora (push) Blocked by required conditions
/ alma (push) Blocked by required conditions
/ rocky (push) Blocked by required conditions
/ ubuntu (push) Has been cancelled
2024-10-21 22:20:14 +02:00
8e48406c81
default
Some checks failed
/ alpine (push) Successful in 47s
/ debian (push) Successful in 1m15s
/ arch (push) Blocked by required conditions
/ opensuse (push) Blocked by required conditions
/ fedora (push) Blocked by required conditions
/ alma (push) Blocked by required conditions
/ rocky (push) Blocked by required conditions
/ ubuntu (push) Has been cancelled
2024-10-21 22:17:32 +02:00
9b735fe556
4
Some checks failed
/ alpine (push) Successful in 44s
/ debian (push) Successful in 1m17s
/ ubuntu (push) Successful in 1m24s
/ opensuse (push) Blocked by required conditions
/ fedora (push) Blocked by required conditions
/ alma (push) Blocked by required conditions
/ rocky (push) Blocked by required conditions
/ arch (push) Has been cancelled
2024-10-21 22:13:12 +02:00
5112abf37e
−log
Some checks failed
/ alpine (push) Successful in 44s
/ debian (push) Successful in 1m15s
/ ubuntu (push) Successful in 1m25s
/ arch (push) Successful in 1m34s
/ alma (push) Blocked by required conditions
/ rocky (push) Blocked by required conditions
/ opensuse (push) Has been cancelled
/ fedora (push) Has been cancelled
2024-10-21 22:05:25 +02:00
ef00f4aa97
inputs
Some checks failed
/ alpine (push) Successful in 44s
/ debian (push) Failing after 1m5s
/ ubuntu (push) Failing after 1m2s
/ arch (push) Successful in 1m43s
/ opensuse (push) Successful in 2m30s
/ fedora (push) Successful in 12m30s
/ alma (push) Failing after 1m36s
/ rocky (push) Failing after 14m58s
2024-10-21 17:25:39 +02:00
a0c36dba7c
log
Some checks failed
/ alpine (push) Successful in 44s
/ debian (push) Failing after 1m5s
/ ubuntu (push) Failing after 1m5s
/ arch (push) Successful in 1m40s
/ opensuse (push) Successful in 3m1s
/ fedora (push) Successful in 9m50s
/ alma (push) Failing after 1m35s
/ rocky (push) Failing after 36m11s
2024-10-21 16:07:33 +02:00
ff7c6b17d8
lower,valueerror
Some checks failed
/ alpine (push) Successful in 42s
/ debian (push) Failing after 1m2s
/ ubuntu (push) Failing after 1m7s
/ arch (push) Successful in 1m40s
/ opensuse (push) Successful in 2m30s
/ alma (push) Blocked by required conditions
/ rocky (push) Blocked by required conditions
/ fedora (push) Has been cancelled
2024-10-21 15:59:45 +02:00
776421884b
removeprefix
All checks were successful
/ alpine (push) Successful in 42s
/ debian (push) Successful in 1m15s
/ ubuntu (push) Successful in 2m0s
/ arch (push) Successful in 1m38s
/ opensuse (push) Successful in 1m46s
/ fedora (push) Successful in 4m39s
/ alma (push) Successful in 3m26s
/ rocky (push) Successful in 15m23s
2024-10-21 15:19:39 +02:00
e6d631994e
action 2024-10-21 14:58:34 +02:00
7dc9f06e47
parse_inputs 2024-10-21 14:55:43 +02:00
aff3a8180a
useless 2024-10-21 14:54:39 +02:00
eb8fd0b651
ruff/format
Some checks failed
/ alpine (push) Successful in 42s
/ debian (push) Failing after 1m9s
/ ubuntu (push) Failing after 1m2s
/ arch (push) Successful in 1m39s
/ opensuse (push) Successful in 2m34s
/ fedora (push) Successful in 8m42s
/ alma (push) Failing after 1m35s
/ rocky (push) Failing after 8m0s
2024-10-20 22:53:31 +02:00
493f50bdd0
arg3
Some checks failed
/ alpine (push) Successful in 42s
/ debian (push) Failing after 1m2s
/ ubuntu (push) Failing after 1m4s
/ arch (push) Successful in 1m40s
/ opensuse (push) Successful in 2m29s
/ fedora (push) Successful in 8m29s
/ alma (push) Failing after 1m37s
/ rocky (push) Failing after 37m6s
2024-10-20 20:32:33 +02:00
6046ebe441
prefix
Some checks failed
/ alpine (push) Successful in 45s
/ debian (push) Failing after 1m3s
/ ubuntu (push) Failing after 1m2s
/ arch (push) Successful in 1m39s
/ opensuse (push) Successful in 2m30s
/ fedora (push) Successful in 8m52s
/ alma (push) Failing after 1m37s
/ rocky (push) Has been cancelled
2024-10-20 20:11:09 +02:00
aeeb047b36
fix
Some checks failed
/ alpine (push) Successful in 45s
/ debian (push) Successful in 1m14s
/ ubuntu (push) Successful in 1m30s
/ arch (push) Successful in 1m33s
/ opensuse (push) Successful in 1m40s
/ rocky (push) Blocked by required conditions
/ fedora (push) Has been cancelled
/ alma (push) Has been cancelled
2024-10-20 19:58:18 +02:00
c7c0d7c7d7
action
Some checks failed
/ alpine (push) Failing after 26s
/ debian (push) Failing after 1m4s
/ ubuntu (push) Failing after 1m27s
/ arch (push) Failing after 1m25s
/ opensuse (push) Failing after 2m16s
/ fedora (push) Failing after 8m20s
/ alma (push) Failing after 1m41s
/ rocky (push) Failing after 10m41s
2024-10-20 19:12:47 +02:00
c77674afa4
inputs 2024-10-20 18:54:47 +02:00
886fcf3673
action 2024-10-20 18:52:16 +02:00
924e44a9d9
lint 2024-10-20 18:50:50 +02:00
c481b2168c
unquote
Some checks failed
/ alpine (push) Failing after 46s
/ debian (push) Failing after 1m5s
/ ubuntu (push) Failing after 1m1s
/ arch (push) Failing after 1m37s
/ opensuse (push) Failing after 2m28s
/ fedora (push) Failing after 9m17s
/ alma (push) Failing after 1m38s
/ rocky (push) Failing after 2m46s
2024-10-15 22:11:32 +02:00
a4c2272b2f
cat
Some checks failed
/ alpine (push) Failing after 46s
/ debian (push) Failing after 1m4s
/ ubuntu (push) Failing after 1m1s
/ fedora (push) Blocked by required conditions
/ alma (push) Blocked by required conditions
/ rocky (push) Blocked by required conditions
/ opensuse (push) Has been cancelled
/ arch (push) Has been cancelled
2024-10-15 21:56:46 +02:00
44423ef2ee
act/vpy
Some checks failed
/ alpine (push) Failing after 42s
/ debian (push) Failing after 1m18s
/ ubuntu (push) Failing after 1m23s
/ arch (push) Failing after 1m30s
/ alma (push) Blocked by required conditions
/ rocky (push) Blocked by required conditions
/ opensuse (push) Has been cancelled
/ fedora (push) Has been cancelled
2024-10-15 21:49:29 +02:00
588bf5c6c4
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
2024-10-15 19:41:40 +02:00
f9c8cbc59e
−mapping
Some checks failed
/ alpine (push) Successful in 46s
/ debian (push) Failing after 1m3s
/ ubuntu (push) Failing after 1m2s
/ arch (push) Successful in 1m38s
/ opensuse (push) Successful in 2m40s
/ fedora (push) Successful in 13m58s
/ alma (push) Failing after 1m43s
/ rocky (push) Failing after 2m28s
2024-10-15 08:38:57 +02:00
192692ec8a
read,write
Some checks failed
/ alpine (push) Successful in 44s
/ debian (push) Successful in 1m14s
/ ubuntu (push) Successful in 1m23s
/ opensuse (push) Blocked by required conditions
/ fedora (push) Blocked by required conditions
/ alma (push) Blocked by required conditions
/ rocky (push) Blocked by required conditions
/ arch (push) Has been cancelled
2024-10-15 08:34:48 +02:00
12f235af81
ls
Some checks failed
/ alpine (push) Successful in 46s
/ debian (push) Failing after 1m3s
/ ubuntu (push) Failing after 1m2s
/ arch (push) Successful in 1m34s
/ opensuse (push) Successful in 2m49s
/ fedora (push) Successful in 8m23s
/ alma (push) Failing after 1m36s
/ rocky (push) Failing after 2m10s
2024-10-14 23:49:02 +02:00
3001e6ec30
mkdir
Some checks failed
/ alpine (push) Failing after 45s
/ debian (push) Failing after 1m4s
/ ubuntu (push) Failing after 1m1s
/ arch (push) Failing after 1m39s
/ opensuse (push) Failing after 2m44s
/ alma (push) Has been cancelled
/ rocky (push) Has been cancelled
/ fedora (push) Has been cancelled
2024-10-14 23:41:31 +02:00
dbb27ac0ef
browse/target,source
Some checks failed
/ alpine (push) Successful in 44s
/ debian (push) Successful in 1m16s
/ ubuntu (push) Successful in 1m22s
/ arch (push) Successful in 1m48s
/ opensuse (push) Successful in 1m57s
/ rocky (push) Blocked by required conditions
/ fedora (push) Has been cancelled
/ alma (push) Has been cancelled
2024-10-14 23:27:57 +02:00
2ddbc2d090
project.root
Some checks failed
/ alpine (push) Successful in 44s
/ debian (push) Failing after 1m3s
/ ubuntu (push) Failing after 1m1s
/ arch (push) Successful in 1m37s
/ opensuse (push) Successful in 2m44s
/ fedora (push) Successful in 8m43s
/ alma (push) Failing after 1m38s
/ rocky (push) Failing after 3m10s
2024-10-14 23:03:12 +02:00
3f41f0c6b1
target
Some checks failed
/ alpine (push) Successful in 45s
/ debian (push) Successful in 1m14s
/ ubuntu (push) Successful in 1m22s
/ opensuse (push) Blocked by required conditions
/ fedora (push) Blocked by required conditions
/ alma (push) Blocked by required conditions
/ rocky (push) Blocked by required conditions
/ arch (push) Has been cancelled
2024-10-14 22:58:43 +02:00
9cb23cfff1
source,target
Some checks failed
/ alpine (push) Failing after 25s
/ debian (push) Failing after 1m1s
/ ubuntu (push) Failing after 1m7s
/ opensuse (push) Blocked by required conditions
/ fedora (push) Blocked by required conditions
/ alma (push) Blocked by required conditions
/ rocky (push) Blocked by required conditions
/ arch (push) Has been cancelled
2024-10-14 22:55:39 +02:00
3e494bc354
act
Some checks failed
/ alpine (push) Successful in 42s
/ debian (push) Successful in 1m14s
/ ubuntu (push) Successful in 1m27s
/ arch (push) Successful in 1m35s
/ opensuse (push) Successful in 1m40s
/ rocky (push) Blocked by required conditions
/ fedora (push) Has been cancelled
/ alma (push) Has been cancelled
2024-10-14 22:43:07 +02:00
52835704bf
sync/context 2024-10-14 22:18:47 +02:00
bc1d047359
actions/synchronize 2024-10-14 22:14:23 +02:00
4 changed files with 124 additions and 31 deletions

View file

@ -54,9 +54,10 @@ Picture it…
* [X] installing Git to clone * [X] installing Git to clone
* [X] this project * [X] this project
* [X] its parent framework * [X] its parent framework
* [X] installing both Python * [X] installing Python
* [X] system environment * [X] system environment
* [X] virtual environment * [X] virtual environment
* [ ] managed version
* [X] generating a Python module to switch context * [X] generating a Python module to switch context
#### Python #### Python
@ -95,30 +96,16 @@ Handle project workflows in a unified way:
* [ ] SourceHut * [ ] SourceHut
* whatever the Operating System container * whatever the Operating System container
* [X] Alma | System | Latest | Previous |
* [X] 9 |:---------|:---------------------------|:---------------------------|
* [X] 8 | Alma | * [X] 9 | * [X] 8 |
* [X] Alpine | Alpine | * [X] 3.20 | * [X] 3.19 |
* [X] 3.20 | Arch | * [X] 20240818 (.0.255804) | * [X] 20240101 (.0.204074) |
* [X] 3.19 | Debian | * [X] Bookworm (12) | * [ ] Bullseye (11) |
* [X] Arch | Fedora | * [X] 40 | * [X] 39 |
* [X] 20240818 (.0.255804) | OpenSUSE | * [ ] 15.6 | * [ ] 15.5 |
* [X] 20240101 (.0.204074) | Rocky | * [X] 9 | * [X] 8 |
* [X] Debian | Ubuntu | * [X] Noble (24.04) | * [ ] Jammy (22.04) |
* [X] Bookworm (12)
* [ ] Bullseye (11)
* [X] Fedora
* [X] 40
* [X] 39
* [ ] OpenSUSE
* [ ] 15.6
* [ ] 15.5
* [X] Rocky
* [X] 9
* [X] 8
* [X] Ubuntu
* [X] Noble (24.04)
* [ ] Jammy (22.04)
### Environment variables ### Environment variables

View file

@ -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
@ -44,6 +44,45 @@ def clone_project_branch() -> None:
) )
def install_actions() -> None:
"""Make actions usable in workflows."""
step("Install actions")
name = "action.yaml"
root = project.root / "act"
vpy = Path(env.SPCD_PYTHON_VENV_BINARIES) / "python"
for action in ["action", "synchronize"]:
log.info(action)
directory = root / action
fs.make_directory(directory)
match action:
case "action":
inputs = """\
arg_1:
required: true
arg_2:
required: true
arg_3:
required: true
arg_4:
default: '"placeholder"'
"""
case "synchronize":
inputs = """\
source:
default: out
required: false
"""
yaml = f"""\
runs:
using: composite
steps:
- run: {vpy} -m spcd {action}
inputs:
{inputs}"""
fs.write(directory / name, yaml)
cat(directory / name)
def install_commands(path: Path) -> None: def install_commands(path: Path) -> None:
"""Make commands callable in the operating system. """Make commands callable in the operating system.
@ -110,9 +149,15 @@ 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":
if arguments:
name, *arguments = arguments
f = getattr(act, name)
f(*arguments)
else:
list_environment_variables() list_environment_variables()
clone_project_branch() clone_project_branch()
set_ssh() set_ssh()
install_actions()
install_commands(main_file) install_commands(main_file)
install_python_packages() install_python_packages()
else: else:

60
spcd/act.py Normal file
View file

@ -0,0 +1,60 @@
"""Actions available for workflows."""
import os
from ast import literal_eval
from pathlib import Path
from rwx import ps
from rwx.log import stream as log
from spcd.ci import project, projects
from spcd.shell import env
PREFIX = "INPUT_"
def action() -> None:
"""Display action inputs."""
for variable, value in parse_inputs().items():
log.info("%s = %s", variable, value)
def parse_inputs() -> dict[str, object]:
"""Parse inputs as a dictionary.
:return: name & value pairs
:rtype: dict[str, object]
"""
inputs = {}
for variable, value in sorted(projects.environment.items()):
if variable.startswith(PREFIX):
name = variable.removeprefix(PREFIX).lower()
inputs[name] = literal_eval(value)
return inputs
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}/",
)

View file

@ -27,6 +27,7 @@ def spcd_build_project() -> None:
def spcd_check_project() -> None: def spcd_check_project() -> None:
"""Check the project for anything wrong.""" """Check the project for anything wrong."""
ps.run("ruff", "check") ps.run("ruff", "check")
ps.run("ruff", "format", "--diff")
def spcd_synchronize( def spcd_synchronize(