forked from xxf098/actionflow
-
Notifications
You must be signed in to change notification settings - Fork 0
/
workflow.cue
85 lines (74 loc) · 2.69 KB
/
workflow.cue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
package main
import (
"github.com/xxf098/actionflow"
"github.com/xxf098/actionflow/core"
)
#GoTest: core.#Exec & {
fileName: string
actionName: string
test: string
cmd: ["sh", "-c", """
cp ../testcues/\(fileName).cue ./
./flow do \(actionName)
\(test)
rm *.cue
"""]
}
#TestFunc: core.#Exec & {
name: string
cmd: ["sh", "-c", """
go test -run \(name)
"""]
}
funcs: ["TestWriteFile", "TestWriteFile1", "TestWriteFile2", "TestExec", "TestRun", "TestRm1",
"TestMkDir1", "TestMkDirs", "TestMkDirParent", "TestMkdir", "TestGitPull", "TestWorkDir",
"TestArgs", "TestOutput", "TestAll", "TestStep", "TestStdout", "TestReadfile", "TestKeep", "TestKeep1", "TestKeep2"]
actionflow.#Plan & {
actions: {
setup: core.#Step & {
uses: "actions/setup-go@v3"
with: {
"go-version": "1.19"
"cache": true
}
}
build: core.#Exec & {
cmd: ["sh", "-c", """
go mod tidy
make flow
"""]
}
testKeep: #GoTest & {
fileName: "keep",
actionName: "keepFile",
test: "test -f testkeep/foo.txt && test -f testkeep/foo1.txt"
}
rmWokflow: core.#Rm & { path: "./workflow.cue" }
testAll: core.#All & {
@$rmWokflow()
max: 1
tasks: [
#GoTest & { fileName: "writefile", actionName: "hello", test: "test -f hello-fileName.txt" },
#GoTest & { fileName: "exec", actionName: "touch", test: "test -f ./hello.txt" },
#GoTest & { fileName: "exec/output", actionName: "save", test: "test -f ./output.txt" },
#GoTest & { fileName: "exec/run", actionName: "save", test: "test -f ./runoutput.txt" },
#GoTest & { fileName: "exec/env", actionName: "verifyEnv", test: "" },
#GoTest & { fileName: "exec/workdir", actionName: "verify", test: "" },
#GoTest & { fileName: "then", actionName: "mkdirWrite", test: "test -f ./test/foo4" },
#GoTest & { fileName: "mkdir_parents", actionName: "writeChecker", test: "test -f ./test/baz/foo" },
#GoTest & { fileName: "all", actionName: "writeAll", test: "test -f ./testt/foo1 && test -f ./testt/foo2" },
#GoTest & { fileName: "each", actionName: "writeEach", test: "test -f ./testy/foo3 && test -f ./testy/foo4" },
#GoTest & { fileName: "git", actionName: "actionflow", test: "test -f ./actionflow/go.mod && test -f ./actionflow/workflow.cue" },
#GoTest & { fileName: "stdout", actionName: "print", test: "" },
#GoTest & { fileName: "api", actionName: "print", test: "" },
#GoTest & { fileName: "deps", actionName: "read", test: "" },
#GoTest & { fileName: "deps1", actionName: "all", test: "" },
#GoTest & { fileName: "mkdirs", actionName: "zero", test: "test -d zero/world && test -d yellow" },
]
}
testFuncs: core.#All & {
max: 1
tasks: [ for f in funcs { #TestFunc & { name: f } } ]
}
}
}