Skip to content

Commit a2233ab

Browse files
committed
Add a simple workflow runner
1 parent c43a9b3 commit a2233ab

1 file changed

Lines changed: 21 additions & 1 deletion

File tree

x.py

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ def _workflow_test():
230230
},
231231
],
232232
},
233-
"build": {
233+
"test": {
234234
"runs-on": "ubuntu-latest",
235235
"steps": [
236236
{"uses": ACTION_CHECKOUT},
@@ -365,6 +365,26 @@ def check():
365365
_sh(command)
366366

367367

368+
@cmd()
369+
@arg("path")
370+
@arg("job", nargs="?")
371+
def run_workflow(path, job):
372+
import json
373+
374+
with open(path, "rt") as fobj:
375+
workflow = json.load(fobj)
376+
377+
if not job:
378+
print(sorted(workflow["jobs"]))
379+
return
380+
381+
for step in workflow["jobs"][job]["steps"]:
382+
if "run" not in step:
383+
print(step)
384+
else:
385+
_sh(step["run"])
386+
387+
368388
@cmd(help="Run the serde_arrow_example")
369389
@arg("--backtrace", action="store_true", default=False)
370390
def serde_arrow_example(backtrace=False):

0 commit comments

Comments
 (0)