-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathmain.ts
209 lines (162 loc) · 4.27 KB
/
main.ts
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
import { dag } from "../src/client.gen.ts";
async function main() {
if (!Deno.env.has("FLUENTCI_SESSION_PORT")) {
Deno.env.set("FLUENTCI_SESSION_PORT", "6880");
Deno.env.set("FLUENTCI_SESSION_TOKEN", "token");
}
const secret = dag.setSecret("DEMO", "12345");
console.log(await secret.plaintext());
const secretDemo = await dag
.pipeline("secret-demo")
.withSecretVariable("DEMO", secret)
.withExec(["echo", "$DEMO"])
.stdout();
console.log("secretDemo: ", secretDemo);
const cache = dag.cache("pixi");
console.log("cacheId: ", await cache.id());
const ping = dag
.pipeline("demo")
.nix()
.withWorkdir("nix-demo")
.withExec(["ping", "fluentci.io"])
.asService("ping_fluentci");
const pingGh = dag
.pipeline("demo")
.pkgx()
.withPackages(["ping"])
.withExec(["ping", "github.com"])
.asService("ping_gh");
const stdout = await dag
.pipeline("demo")
.withService(ping)
.withService(pingGh)
.withExec(["sleep", "15"])
.withExec(["ls", "-ltr", ".fluentci"])
.stdout();
console.log(stdout);
const demo = await dag
.pipeline("demo")
.withWorkdir("./")
.withExec(["echo", "hello"])
.withExec(["echo", "hello world"])
.withExec(["echo", "hello again"])
.stdout();
console.log(demo);
const hermit = await dag
.hermit()
.withWorkdir("./hermit-demo")
.withPackages(["jq"])
.withExec(["which", "jq"])
.stdout();
console.log(hermit);
const envhub = await dag
.pipeline("envhub-demo")
.envhub()
.use("github:tsirysndr/dotfiles-example")
.withExec(["envhub", "--version"])
.withExec(["which", "hello"])
.stdout();
console.log(envhub);
const pixi = await dag
.pipeline("pixi-demo")
.pixi()
.withWorkdir("./pixi-demo")
.withCache("./.pixi", cache)
.withExec(["pixi", "--version"])
.withExec(["which", "php"])
.stdout();
console.log(pixi);
const zip = await dag.directory("./flox-demo").zip().path();
console.log(zip);
const tarCzvf = await dag.directory("./flox-demo").tarCzvf().path();
console.log(tarCzvf);
const unzip = await dag
.file("./flox-demo.zip")
.unzip("./flox-demo-output-zip")
.entries();
console.log(unzip);
const tarXzvf = await dag
.file("./flox-demo.tar.gz")
.tarXzvf("./flox-demo-output-tar")
.entries();
console.log(tarXzvf);
const md5 = await dag.file("./flox-demo.tar.gz").md5();
console.log(md5);
const sha256 = await dag.file("./flox-demo.tar.gz").sha256();
console.log(sha256);
/*
await dag
.pipeline("clean")
.withWorkdir("./")
.withExec([
"rm",
"-rf",
"flox-demo-output-zip",
"flox-demo-output-tar",
"flox-demo.zip",
"flox-demo.tar.gz",
])
.stdout();
*/
const mise = await dag
.pipeline("mise-demo")
.mise()
.withWorkdir("./mise-demo")
.withExec(["mise", "--version"])
.withExec(["which", "bun"])
.stdout();
console.log(mise);
const pkgx = await dag
.pipeline("pkgx-demo")
.pkgx()
.withWorkdir("./pkgx-demo")
.withExec(["pkgx", "--version"])
.withExec(["which", "deno"])
.stdout();
console.log(pkgx);
const git = await dag
.git("https://github.com/tsirysndr/me")
.branch("main")
.tree()
.withExec(["pwd"])
.stdout();
console.log(git);
const gitEntries = await dag
.git("https://github.com/tsirysndr/me")
.branch("main")
.tree()
.entries();
console.log(gitEntries);
const dir = await dag.directory(".").entries();
console.log(dir);
const nix = await dag
.pipeline("nix-demo")
.nix({
impure: true,
})
.withWorkdir("./nix-demo")
.withExec(["nix", "--version"])
.withExec(["which", "deno"])
.stdout();
console.log(nix);
const devbox = await dag
.pipeline("devbox-demo")
.devbox()
.withWorkdir("./devbox-demo")
.withExec(["devbox", "version"])
.withExec(["which", "jq"])
.stdout();
console.log(devbox);
const flox = await dag
.pipeline("flox-demo")
.flox()
.withWorkdir("./flox-demo")
.withExec(["flox", "--version"])
.withExec(["which", "jq"])
.stdout();
console.log(flox);
}
// Learn more at https://deno.land/manual/examples/module_metadata#concepts
if (import.meta.main) {
await main();
}