-
-
Notifications
You must be signed in to change notification settings - Fork 37
/
flow.cue
134 lines (117 loc) · 2.21 KB
/
flow.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
package hof
_force: bool | *false @tag(force,type=bool)
_print: bool | *false @tag(print,type=bool)
watchBuild: {
@flow(watch/build)
// have to localize this task in a flow for it to work
RR: RepoRoot
root: RR.out
dirs: ["cmd", "flow", "lib", "gen"]
watch: {
@task(os.Watch)
globs: [ for d in dirs {"\(root)/\(d)/**/*.go"}]
handler: {
event?: _
compile: {
@task(os.Exec)
cmd: ["go", "install", "\(root)/cmd/hof"]
env: {
CGO_ENABLE: "0"
}
exitcode: _
}
now: {
dep: compile.exitcode
n: string @task(gen.Now)
s: "\(n) (\(dep))"
}
alert: {
@task(os.Stdout)
dep: now.s
text: "hof rebuilt \(now.s)\n"
}
}
}
}
_flow: {
diff: GitDiff & {
if _print {
@print()
}
ref: "_dev"
}
_shouldi: ShouldI & { files: diff.files }
}
_cond: {
shouldi: yes: bool | *false
stdout: string
stderr: string
if _force || shouldi.yes {
@task(os.Exec)
if _print {
@print()
}
}
}
diff: F=_flow & {
@flow(diff)
print: {
@task(os.Stdout)
text: F.diff.stdout
}
}
build: F= _flow & {
@flow(build)
gha: {
_cond
shouldi: F._shouldi & { globs: ["ci/gha"] }
run: "make workflow"
}
gen: {
_cond
shouldi: F._shouldi & { globs: ["design/"] }
run: "hof gen hof.cue"
}
cli: {
_cond
#after: { $gen: F.gen }
shouldi: F._shouldi & { globs: ["go.*", "cmd/", "flow", "lib/", "schema/", "script/"] }
run: "go install ./cmd/hof"
}
docs: {
[string]: {
dir: "docs"
#after: { $cli: F.cli }
_cond
}
schemas: {
shouldi: F._shouldi & { globs: ["schema/"] }
run: "make schemas"
}
gen: {
shouldi: F._shouldi & { globs: ["docs/", "schema/", "flow/tasks/*/*.cue"] }
run: "make gen"
}
cmdhelp: {
shouldi: F._shouldi & { globs: ["cmd/"] }
run: "make cmdhelp"
}
highlight: {
shouldi: F._shouldi & { globs: ["docs/code/"] }
run: "make highlight"
#after: { $gen: gen, $schemas: schemas }
}
}
}
images: F=_flow & {
@flow(images)
_reg: "ghcr.io/hofstadter-io"
for _,tool in ["black", "csharpier", "prettier"] {
(tool): {
_cond
dir: "formatters/tools/\(tool)"
shouldi: F._shouldi & { globs: [dir] }
run: "docker build -t \(_reg)/\(tool):dirty -f Dockerfile.debian ."
}
}
}