-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
49 changed files
with
6,903 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"deno.enable": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"tasks": { | ||
"dev": "deno run --watch main.ts" | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { gql } from "npm:[email protected]"; | ||
export { gql }; | ||
export { ClientError, GraphQLClient } from "npm:[email protected]"; | ||
import * as env from "jsr:@tsirysndr/[email protected]"; | ||
export { env }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
import { dag } from "./sdk/client.gen.ts"; | ||
|
||
async function main() { | ||
Deno.env.set("FLUENTCI_SESSION_PORT", "6880"); | ||
Deno.env.set("FLUENTCI_SESSION_TOKEN", "token"); | ||
|
||
const demo = await dag | ||
.pipeline("demo") | ||
.withWorkdir("./") | ||
.withExec(["echo", "hello"]) | ||
.withExec(["echo", "hello world"]) | ||
.withExec(["echo", "hello again"]) | ||
.stdout(); | ||
|
||
console.log(demo); | ||
|
||
const nix = await dag | ||
.pipeline("nix-demo") | ||
.nix() | ||
.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); | ||
|
||
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); | ||
} | ||
|
||
// Learn more at https://deno.land/manual/examples/module_metadata#concepts | ||
if (import.meta.main) { | ||
await main(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { createGQLClient } from "./client.ts"; | ||
import { Context } from "./context.ts"; | ||
import { env } from "../deps.ts"; | ||
|
||
/** | ||
* @hidden | ||
* | ||
* Initialize a default client context from environment. | ||
*/ | ||
export function initDefaultContext(): Context { | ||
let ctx = new Context(); | ||
|
||
// Prefer FLUENTCI_SESSION_PORT if set | ||
const daggerSessionPort = env.get("FLUENTCI_SESSION_PORT"); | ||
if (daggerSessionPort) { | ||
const sessionToken = env.get("FLUENTCI_SESSION_TOKEN"); | ||
if (!sessionToken) { | ||
throw new Error( | ||
"FLUENTCI_SESSION_TOKEN must be set when using FLUENTCI_SESSION_PORT" | ||
); | ||
} | ||
|
||
ctx = new Context({ | ||
client: createGQLClient(Number(daggerSessionPort), sessionToken), | ||
}); | ||
} else { | ||
throw new Error("FLUENTCI_SESSION_PORT must be set"); | ||
} | ||
|
||
return ctx; | ||
} |
Oops, something went wrong.