Skip to content

Commit

Permalink
Merge pull request #4 from fluent-ci-templates/chore/default-exports
Browse files Browse the repository at this point in the history
update default exports
  • Loading branch information
tsirysndr authored Sep 16, 2023
2 parents 5114d14 + cc56914 commit 5d5f74b
Show file tree
Hide file tree
Showing 7 changed files with 168 additions and 17 deletions.
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,8 @@ dagger run fluentci codecov_pipeline
You can also use this pipeline programmatically:

```typescript
import { Client, connect } from "https://esm.sh/@dagger.io/dagger@0.8.1";
import { Dagger } from "https://deno.land/x/codecov_pipeline/mod.ts";

const { upload } = Dagger;
import { Client, connect } from "https://sdk.fluentci.io/v0.1.7/mod.ts";
import { upload } from "https://deno.land/x/codecov_pipeline/mod.ts";

function pipeline(src = ".") {
connect(async (client: Client) => {
Expand Down
151 changes: 150 additions & 1 deletion deno.lock

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion import_map.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{
"imports": {
"@dagger.io/dagger": "https://esm.sh/v128/*@dagger.io/dagger@0.8.1",
"@fluentci.io/dagger": "https://sdk.fluentci.io/v0.1.7/mod.ts",
"@dagger.io/dagger": "https://esm.sh/v128/*@dagger.io/dagger@0.8.4",
"graphql-tag": "https://esm.sh/v128/graphql-tag@2.12.6",
"graphql-request": "https://esm.sh/v128/graphql-request@6.1.0",
"fluent_gitlab_ci": "https://deno.land/x/fluent_gitlab_ci@v0.4.2/mod.ts",
"fluent_github_actions": "https://deno.land/x/fluent_github_actions@v0.2.1/mod.ts",
"fluent_circleci": "https://deno.land/x/fluent_circleci@v0.2.5/mod.ts",
Expand Down
4 changes: 1 addition & 3 deletions mod.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
import * as Dagger from "./src/dagger/index.ts";

export { Dagger };
export * from "./src/dagger/index.ts";
8 changes: 4 additions & 4 deletions src/dagger/jobs.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { Client } from "@dagger.io/dagger";
import Client from "@fluentci.io/dagger";

export enum Job {
upload = "upload",
}

export const exclude = [".devbox", "node_modules", ".fluentci"];

export const upload = async (client: Client, src = ".") => {
const context = client.host().directory(src);
if (!Deno.env.get("CODECOV_TOKEN")) {
Expand All @@ -24,9 +26,7 @@ export const upload = async (client: Client, src = ".") => {
])
.withExec(["chmod", "a+x", "codecov"])
.withExec(["mv", "codecov", "/usr/local/bin/codecov"])
.withDirectory("/app", context, {
exclude: [".devbox", "node_modules", ".fluentci"],
})
.withDirectory("/app", context, { exclude })
.withWorkdir("/app")
.withEnvVariable("CODECOV_TOKEN", Deno.env.get("CODECOV_TOKEN")!)
.withEnvVariable("CODECOV_URL", Deno.env.get("CODECOV_URL") || "")
Expand Down
9 changes: 6 additions & 3 deletions src/dagger/pipeline.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import { Client, connect } from "@dagger.io/dagger";
import Client, { connect, uploadContext } from "@fluentci.io/dagger";
import * as jobs from "./jobs.ts";

const { upload, runnableJobs } = jobs;
const { upload, runnableJobs, exclude } = jobs;

export default function pipeline(_src = ".", args: string[] = []) {
export default async function pipeline(src = ".", args: string[] = []) {
if (Deno.env.has("FLUENTCI_SESSION_ID")) {
await uploadContext(src, exclude);
}
connect(async (client: Client) => {
if (args.length > 0) {
await runSpecificJobs(client, args as jobs.Job[]);
Expand Down
2 changes: 1 addition & 1 deletion src/dagger/runner.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import pipeline from "./pipeline.ts";

pipeline(".", Deno.args);
await pipeline(".", Deno.args);

0 comments on commit 5d5f74b

Please sign in to comment.