Skip to content

Commit

Permalink
[sdk/rescript] update example
Browse files Browse the repository at this point in the history
  • Loading branch information
tsirysndr committed Aug 17, 2024
1 parent 924eb06 commit ca39869
Show file tree
Hide file tree
Showing 6 changed files with 88 additions and 4 deletions.
2 changes: 1 addition & 1 deletion sdk/rescript/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ bun run res:build
fluentci-engine run -- deno run -A src/Demo.res.mjs
```

See [fluentci-engine](https://github.com/fluentc-io/fluentci-engine) and [fluentci](https://github.com/fluentci-io/fluentci) for more information.
See [fluentci-engine](https://github.com/fluentci-io/fluentci-engine) and [fluentci](https://github.com/fluentci-io/fluentci) for more information.
Binary file modified sdk/rescript/demo/bun.lockb
Binary file not shown.
1 change: 1 addition & 0 deletions sdk/rescript/demo/deno.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions sdk/rescript/demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@
"@fluentci/sdk": "npm:@jsr/fluentci__sdk@0.4.1",
"@rescript/core": "1.5.2",
"rescript": "11.1.3",
"rescript-fluentci": "^0.1.0"
"rescript-fluentci": "^0.1.2"
}
}
}
83 changes: 83 additions & 0 deletions sdk/rescript/demo/src/Demo.res.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
// Generated by ReScript, PLEASE EDIT WITH CARE

import * as Sdk from "jsr:@fluentci/sdk";

var secret = Sdk.dag.setSecret("GITHUB", "my-github-token");

console.log(await secret.plaintext());

var secretDemo = await Sdk.dag.pipeline("secret-demo").withSecretVariable("GITHUB", secret).withExec(["echo $GITHUB"]).stdout();

console.log("Secret demo: " + secretDemo);

var cache = Sdk.dag.cache("pixi");

console.log("cacheId: " + await cache.id());

var ping = Sdk.dag.pipeline("demo").nix({
impure: true
}).withWorkdir("nix-demo").withExec([
"ping",
"fluentci.io"
]).asService("ping_service");

console.log("Ping service: " + await ping.id());

var pingGithub = Sdk.dag.pipeline("ping-github").pkgx().withPackages(["ping"]).withExec([
"ping",
"github.com"
]).asService("ping_github");

var stdout = await Sdk.dag.pipeline("demo").pkgx().withPackages(["ping"]).withService(ping).withService(pingGithub).withExec([
"sleep",
"15"
]).withExec([
"ls",
"-ltr",
".fluentci"
]).withExec([
"cat",
".fluentci/process-compose.yaml"
]).stdout();

console.log("Stdout: " + stdout);

var mise = await Sdk.dag.pipeline("mise-demo").mise().withWorkdir("./mise-demo").withExec([
"mise",
"--version"
]).withExec([
"which",
"bun"
]).stdout();

console.log("Mise: " + mise);

var git = await Sdk.dag.git("https://github.com/tsirysndr/me").branch("main").tree().withExec(["pwd"]).stdout();

console.log("Git: " + git);

var gitEntries = await Sdk.dag.git("https://github.com/tsirysndr/me").branch("main").tree().entries();

console.log("Git entries: ");

console.log(gitEntries);

var dir = await Sdk.dag.directory(".").entries();

console.log("Directory entries at '.': ");

console.log(dir);

export {
secret ,
secretDemo ,
cache ,
ping ,
pingGithub ,
stdout ,
mise ,
git ,
gitEntries ,
dir ,
}
/* secret Not a pure module */
2 changes: 1 addition & 1 deletion sdk/rescript/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rescript-fluentci",
"version": "0.1.0",
"version": "0.1.2",
"description": "FluentCI SDK for Rescript",
"scripts": {
"res:build": "rescript",
Expand Down

0 comments on commit ca39869

Please sign in to comment.