Skip to content

Commit

Permalink
Merge pull request #5 from fluent-ci-templates/feat/pipeline-args
Browse files Browse the repository at this point in the history
ci: always run example workflow
  • Loading branch information
tsirysndr authored Nov 9, 2023
2 parents dd3f556 + 3e1b96a commit 62dc41e
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 43 deletions.
12 changes: 2 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,8 @@ jobs:
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: |
curl -L https://dl.dagger.io/dagger/install.sh | DAGGER_VERSION=0.8.8 sh
sudo mv bin/dagger /usr/local/bin
dagger version
- name: Setup Fluent CI
uses: fluentci-io/setup-fluentci@v1
- name: Run Dagger Pipelines
run: fluentci run deno_pipeline fmt lint test
- name: Upload Coverage
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ on:
push:
branches:
- main
paths:
- example/**
- .github/workflows/example.yml
jobs:
tests:
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ test(src: String!): String
You can also use this pipeline programmatically:

```ts
import { check, test, build } from "https://pkg.fluentci.io/gradle_pipeline@v0.4.1/mod.ts";
import { check, test, build } from "https://pkg.fluentci.io/gradle_pipeline@v0.5.0/mod.ts";

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

await check();
await test();
Expand Down
5 changes: 5 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 @@ -26,6 +26,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
12 changes: 2 additions & 10 deletions fixtures/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,7 @@ jobs:
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: |
curl -L https://dl.dagger.io/dagger/install.sh | DAGGER_VERSION=0.8.1 sh
sudo mv bin/dagger /usr/local/bin
dagger version
- name: Setup Fluent CI
uses: fluentci-io/setup-fluentci@v1
- name: Run Dagger Pipelines
run: fluentci run gradle_pipeline
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 build: 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 Dagger Pipelines",
Expand Down

0 comments on commit 62dc41e

Please sign in to comment.