Skip to content

Commit

Permalink
Merge pull request #9 from fluent-ci-templates/feat/pipeline-args
Browse files Browse the repository at this point in the history
feat: handle pipeline arguments
  • Loading branch information
tsirysndr authored Nov 8, 2023
2 parents 0534608 + 8c39741 commit c6972c4
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 20 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ llvmCov(src: String!): String
You can also use this pipeline programmatically:

```ts
import { build, test } from "https://pkg.fluentci.io/rust_pipeline@v0.6.3/mod.ts";
import { build, test } from "https://pkg.fluentci.io/rust_pipeline@v0.7.0/mod.ts";

await test();
await build();
Expand Down
2 changes: 1 addition & 1 deletion ci.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {
build,
test,
} from "https://pkg.fluentci.io/rust_pipeline@v0.6.3/mod.ts";
} from "https://pkg.fluentci.io/rust_pipeline@v0.7.0/mod.ts";

await test();
await build();
7 changes: 7 additions & 0 deletions deno.lock

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

2 changes: 2 additions & 0 deletions deps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ export {
join,
resolve,
} from "https://deno.land/std@0.203.0/path/mod.ts";
export { parse } from "https://deno.land/std@0.205.0/flags/mod.ts";
export { snakeCase, camelCase } from "https://cdn.skypack.dev/lodash";

export * as FluentGitlabCI from "https://deno.land/x/fluent_gitlab_ci@v0.4.2/mod.ts";
export * as FluentGithubActions from "https://deno.land/x/fluent_github_actions@v0.2.1/mod.ts";
Expand Down
16 changes: 15 additions & 1 deletion src/dagger/runner.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
import pipeline from "./pipeline.ts";
import { parse, camelCase, snakeCase } from "../../deps.ts";

await pipeline(".", Deno.args);
const args = parse(Deno.args.map((x) => x.split(" ")).flat());

if (!Array.isArray(Deno.args)) {
for (const param of Object.keys(args)
.filter((x) => x !== "_")
.map((x) => snakeCase(x).toUpperCase())) {
Deno.env.set(param, args[camelCase(param)]);
}
}

await pipeline(
".",
Array.isArray(Deno.args) ? Deno.args : (args._ as string[])
);
19 changes: 2 additions & 17 deletions src/github/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,15 @@ export function generateYaml(): Workflow {
branches: ["main"],
};

const setupDagger = `\
curl -L https://dl.dagger.io/dagger/install.sh | DAGGER_VERSION=0.8.1 sh
sudo mv bin/dagger /usr/local/bin
dagger version`;

const test: JobSpec = {
"runs-on": "ubuntu-latest",
steps: [
{
uses: "actions/checkout@v2",
},
{
uses: "denoland/setup-deno@v1",
with: {
"deno-version": "v1.37",
},
},
{
name: "Setup Fluent CI CLI",
run: "deno install -A -r https://cli.fluentci.io -n fluentci",
},
{
name: "Setup Dagger",
run: setupDagger,
name: "Setup Fluent CI",
uses: "fluentci-io/setup-fluentci@v1",
},
{
name: "Run Tests and Build",
Expand Down

0 comments on commit c6972c4

Please sign in to comment.