From ce7d862b91fe62adff0c50741f554b6d2594aeaa Mon Sep 17 00:00:00 2001 From: Tsiry Sandratraina Date: Sun, 11 Aug 2024 15:55:09 +0000 Subject: [PATCH] remove unused files --- .github/workflows/ci.yml | 10 ++-- .github/workflows/zenith.yml | 2 +- dagger.json | 2 +- deno.json | 2 +- example/.fluentci/mod.ts | 2 +- example/.fluentci/src/aws/README.md | 39 --------------- example/.fluentci/src/aws/config.ts | 28 ----------- example/.fluentci/src/aws/config_test.ts | 9 ---- example/.fluentci/src/aws/init.ts | 3 -- example/.fluentci/src/azure/README.md | 42 ----------------- example/.fluentci/src/azure/config.ts | 45 ------------------ example/.fluentci/src/azure/config_test.ts | 9 ---- example/.fluentci/src/azure/init.ts | 3 -- example/.fluentci/src/circleci/README.md | 47 ------------------- example/.fluentci/src/circleci/config.ts | 41 ---------------- example/.fluentci/src/circleci/config_test.ts | 9 ---- example/.fluentci/src/circleci/init.ts | 3 -- example/.fluentci/src/dagger/index.ts | 4 -- example/.fluentci/src/dagger/list_jobs.ts | 20 -------- example/.fluentci/src/github/README.md | 44 ----------------- example/.fluentci/src/github/config.ts | 34 -------------- example/.fluentci/src/github/config_test.ts | 9 ---- example/.fluentci/src/github/init.ts | 3 -- example/.fluentci/src/gitlab/README.md | 47 ------------------- example/.fluentci/src/gitlab/config.ts | 38 --------------- example/.fluentci/src/gitlab/config_test.ts | 9 ---- example/.fluentci/src/gitlab/init.ts | 3 -- .../src/{dagger/lib.ts => helpers.ts} | 2 +- example/.fluentci/src/{dagger => }/jobs.ts | 4 +- .../index.ts => example/.fluentci/src/mod.ts | 0 .../.fluentci/src/{dagger => }/pipeline.ts | 0 example/.fluentci/src/{dagger => }/runner.ts | 2 +- fluentci.toml | 2 +- mod.ts | 2 +- plugin/Cargo.toml | 2 +- src/aws/README.md | 39 --------------- src/aws/config.ts | 28 ----------- src/aws/config_test.ts | 9 ---- src/aws/init.ts | 3 -- src/azure/README.md | 42 ----------------- src/azure/config.ts | 45 ------------------ src/azure/config_test.ts | 9 ---- src/azure/init.ts | 3 -- src/circleci/README.md | 47 ------------------- src/circleci/config.ts | 41 ---------------- src/circleci/config_test.ts | 9 ---- src/circleci/init.ts | 3 -- src/dagger/list_jobs.ts | 20 -------- src/github/README.md | 44 ----------------- src/github/config.ts | 34 -------------- src/github/config_test.ts | 9 ---- src/github/init.ts | 3 -- src/gitlab/README.md | 47 ------------------- src/gitlab/config.ts | 38 --------------- src/gitlab/config_test.ts | 9 ---- src/gitlab/init.ts | 3 -- src/{dagger/lib.ts => helpers.ts} | 2 +- src/{dagger => }/jobs.ts | 4 +- src/mod.ts | 3 ++ src/{dagger => }/pipeline.ts | 0 src/{dagger => }/runner.ts | 2 +- 61 files changed, 22 insertions(+), 995 deletions(-) delete mode 100644 example/.fluentci/src/aws/README.md delete mode 100644 example/.fluentci/src/aws/config.ts delete mode 100644 example/.fluentci/src/aws/config_test.ts delete mode 100644 example/.fluentci/src/aws/init.ts delete mode 100644 example/.fluentci/src/azure/README.md delete mode 100644 example/.fluentci/src/azure/config.ts delete mode 100644 example/.fluentci/src/azure/config_test.ts delete mode 100644 example/.fluentci/src/azure/init.ts delete mode 100644 example/.fluentci/src/circleci/README.md delete mode 100644 example/.fluentci/src/circleci/config.ts delete mode 100644 example/.fluentci/src/circleci/config_test.ts delete mode 100644 example/.fluentci/src/circleci/init.ts delete mode 100644 example/.fluentci/src/dagger/index.ts delete mode 100644 example/.fluentci/src/dagger/list_jobs.ts delete mode 100644 example/.fluentci/src/github/README.md delete mode 100644 example/.fluentci/src/github/config.ts delete mode 100644 example/.fluentci/src/github/config_test.ts delete mode 100644 example/.fluentci/src/github/init.ts delete mode 100644 example/.fluentci/src/gitlab/README.md delete mode 100644 example/.fluentci/src/gitlab/config.ts delete mode 100644 example/.fluentci/src/gitlab/config_test.ts delete mode 100644 example/.fluentci/src/gitlab/init.ts rename example/.fluentci/src/{dagger/lib.ts => helpers.ts} (89%) rename example/.fluentci/src/{dagger => }/jobs.ts (98%) rename src/dagger/index.ts => example/.fluentci/src/mod.ts (100%) rename example/.fluentci/src/{dagger => }/pipeline.ts (100%) rename example/.fluentci/src/{dagger => }/runner.ts (86%) delete mode 100644 src/aws/README.md delete mode 100644 src/aws/config.ts delete mode 100644 src/aws/config_test.ts delete mode 100644 src/aws/init.ts delete mode 100644 src/azure/README.md delete mode 100644 src/azure/config.ts delete mode 100644 src/azure/config_test.ts delete mode 100644 src/azure/init.ts delete mode 100644 src/circleci/README.md delete mode 100644 src/circleci/config.ts delete mode 100644 src/circleci/config_test.ts delete mode 100644 src/circleci/init.ts delete mode 100644 src/dagger/list_jobs.ts delete mode 100644 src/github/README.md delete mode 100644 src/github/config.ts delete mode 100644 src/github/config_test.ts delete mode 100644 src/github/init.ts delete mode 100644 src/gitlab/README.md delete mode 100644 src/gitlab/config.ts delete mode 100644 src/gitlab/config_test.ts delete mode 100644 src/gitlab/init.ts rename src/{dagger/lib.ts => helpers.ts} (89%) rename src/{dagger => }/jobs.ts (98%) create mode 100644 src/mod.ts rename src/{dagger => }/pipeline.ts (100%) rename src/{dagger => }/runner.ts (86%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6c868ee..d17f410 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,15 +17,13 @@ jobs: pipeline: deno args: | fmt - test - coverage - name: Run Dagger Pipelines run: | dagger -m github.com/fluent-ci-templates/bun-pipeline@main functions - - name: Upload to Codecov - run: fluentci run --wasm codecov upload - env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + #- name: Upload to Codecov + # run: fluentci run --wasm codecov upload + # env: + # CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} publish: needs: tests runs-on: ubuntu-latest diff --git a/.github/workflows/zenith.yml b/.github/workflows/zenith.yml index fe1a43a..459349c 100644 --- a/.github/workflows/zenith.yml +++ b/.github/workflows/zenith.yml @@ -13,7 +13,7 @@ jobs: - uses: actions/checkout@v2 - name: Setup Dagger Zenith run: | - curl -L https://dl.dagger.io/dagger/install.sh | DAGGER_VERSION=0.11.7 sh + curl -L https://dl.dagger.io/dagger/install.sh | DAGGER_VERSION=0.12.4 sh sudo mv bin/dagger /usr/local/bin dagger version - name: Run Dagger Pipelines diff --git a/dagger.json b/dagger.json index 04c3a7f..ed570a5 100644 --- a/dagger.json +++ b/dagger.json @@ -1,7 +1,7 @@ { "name": "bun", "sdk": "github.com/fluentci-io/daggerverse/deno-sdk@main", - "version": "v0.7.1", + "version": "v0.8.0", "description": "", "author": "Tsiry Sandratraina", "license": "MIT" diff --git a/deno.json b/deno.json index 2728742..38b81e0 100644 --- a/deno.json +++ b/deno.json @@ -1,6 +1,6 @@ { "name": "@fluentci/bun", - "version": "0.6.14", + "version": "0.8.0", "exports": "./mod.ts", "importMap": "import_map.json", "tasks": { diff --git a/example/.fluentci/mod.ts b/example/.fluentci/mod.ts index fbc1f17..a1ca67a 100644 --- a/example/.fluentci/mod.ts +++ b/example/.fluentci/mod.ts @@ -1 +1 @@ -export * from "./src/dagger/index.ts"; +export * from "./src/mod.ts"; diff --git a/example/.fluentci/src/aws/README.md b/example/.fluentci/src/aws/README.md deleted file mode 100644 index 279355d..0000000 --- a/example/.fluentci/src/aws/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS CodePipeline - -[![fluentci pipeline](https://img.shields.io/badge/dynamic/json?label=pkg.fluentci.io&labelColor=%23000&color=%23460cf1&url=https%3A%2F%2Fapi.fluentci.io%2Fv1%2Fpipeline%2Fbun_pipeline&query=%24.version)](https://pkg.fluentci.io/bun_pipeline) -[![deno module](https://shield.deno.dev/x/bun_pipeline)](https://deno.land/x/bun_pipeline) -![deno compatibility](https://shield.deno.dev/deno/^1.37) -[![](https://img.shields.io/codecov/c/gh/fluent-ci-templates/bun-pipeline)](https://codecov.io/gh/fluent-ci-templates/bun-pipeline) - -The following command will generate a `buildspec.yml` file in your project: - -```bash -fluentci ac init -t bun_pipeline -``` - -Generated file: - -```yaml -# Do not edit this file directly. It is generated by https://deno.land/x/fluent_aws_codepipeline - -version: 0.2 -phases: - install: - commands: - - curl -fsSL https://deno.land/x/install/install.sh | sh - - export DENO_INSTALL="$HOME/.deno" - - export PATH="$DENO_INSTALL/bin:$PATH" - - deno install -A -r https://cli.fluentci.io -n fluentci - - curl -L https://dl.dagger.io/dagger/install.sh | DAGGER_VERSION=0.8.1 sh - - mv bin/dagger /usr/local/bin - - dagger version - tests: - commands: - - fluentci run bun_pipeline - post_build: - commands: - - echo Build completed on `date` - -``` - -Feel free to edit the template generator at `.fluentci/src/aws/config.ts` to your needs. diff --git a/example/.fluentci/src/aws/config.ts b/example/.fluentci/src/aws/config.ts deleted file mode 100644 index 9cb4d70..0000000 --- a/example/.fluentci/src/aws/config.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { BuildSpec } from "fluent_aws_codepipeline"; - -/** - * Generates a BuildSpec object for AWS CodePipeline. - * @returns A BuildSpec object with install, build, and post_build phases. - */ -export function generateYaml(): BuildSpec { - const buildspec = new BuildSpec(); - buildspec - .phase("install", { - commands: [ - "curl -fsSL https://deno.land/x/install/install.sh | sh", - 'export DENO_INSTALL="$HOME/.deno"', - 'export PATH="$DENO_INSTALL/bin:$PATH"', - "deno install -A -r https://cli.fluentci.io -n fluentci", - "curl -L https://dl.dagger.io/dagger/install.sh | DAGGER_VERSION=0.9.3 sh", - "mv bin/dagger /usr/local/bin", - "dagger version", - ], - }) - .phase("build", { - commands: ["fluentci run bun_pipeline"], - }) - .phase("post_build", { - commands: ["echo Build completed on `date`"], - }); - return buildspec; -} diff --git a/example/.fluentci/src/aws/config_test.ts b/example/.fluentci/src/aws/config_test.ts deleted file mode 100644 index 97bed68..0000000 --- a/example/.fluentci/src/aws/config_test.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { assertEquals } from "https://deno.land/std@0.191.0/testing/asserts.ts"; -import { generateYaml } from "./config.ts"; - -Deno.test(function generateAWSCodePipelineTest() { - const buildspec = generateYaml(); - const actual = buildspec.toString(); - const expected = Deno.readTextFileSync("./fixtures/buildspec.yml"); - assertEquals(actual, expected); -}); diff --git a/example/.fluentci/src/aws/init.ts b/example/.fluentci/src/aws/init.ts deleted file mode 100644 index 83944b7..0000000 --- a/example/.fluentci/src/aws/init.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { generateYaml } from "./config.ts"; - -generateYaml().save("buildspec.yml"); diff --git a/example/.fluentci/src/azure/README.md b/example/.fluentci/src/azure/README.md deleted file mode 100644 index 6b1efa4..0000000 --- a/example/.fluentci/src/azure/README.md +++ /dev/null @@ -1,42 +0,0 @@ -# Azure Pipelines - -[![fluentci pipeline](https://img.shields.io/badge/dynamic/json?label=pkg.fluentci.io&labelColor=%23000&color=%23460cf1&url=https%3A%2F%2Fapi.fluentci.io%2Fv1%2Fpipeline%2Fbun_pipeline&query=%24.version)](https://pkg.fluentci.io/bun_pipeline) -[![deno module](https://shield.deno.dev/x/bun_pipeline)](https://deno.land/x/bun_pipeline) -![deno compatibility](https://shield.deno.dev/deno/^1.37) -[![](https://img.shields.io/codecov/c/gh/fluent-ci-templates/bun-pipeline)](https://codecov.io/gh/fluent-ci-templates/bun-pipeline) - -The following command will generate a `azure-pipelines.yml` file in your project: - -```bash -fluentci ap init -t bun_pipeline -``` - -Generated file: - -```yaml -# Do not edit this file directly. It is generated by https://deno.land/x/fluent_azure_pipelines - -trigger: - - main -pool: - name: Default - vmImage: ubuntu-latest -steps: - - script: | - curl -fsSL https://deno.land/x/install/install.sh | sh - export DENO_INSTALL="$HOME/.deno" - export PATH="$DENO_INSTALL/bin:$PATH" - displayName: Install Deno - - script: deno install -A -r https://cli.fluentci.io -n fluentci - displayName: Setup Fluent CI CLI - - script: | - curl -L https://dl.dagger.io/dagger/install.sh | DAGGER_VERSION=0.8.1 sh - sudo mv bin/dagger /usr/local/bin - dagger version - displayName: Setup Dagger - - script: fluentci run bun_pipeline - displayName: Run Dagger Pipelines - -``` - -Feel free to edit the template generator at `.fluentci/src/azure/config.ts` to your needs. diff --git a/example/.fluentci/src/azure/config.ts b/example/.fluentci/src/azure/config.ts deleted file mode 100644 index 4c4c4a7..0000000 --- a/example/.fluentci/src/azure/config.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { AzurePipeline } from "fluent_azure_pipelines"; - -/** - * Generates the YAML for the Azure Pipeline. - * @returns An instance of AzurePipeline. - */ -export function generateYaml(): AzurePipeline { - const azurePipeline = new AzurePipeline(); - - const installDeno = `\ - curl -fsSL https://deno.land/x/install/install.sh | sh - export DENO_INSTALL="$HOME/.deno" - export PATH="$DENO_INSTALL/bin:$PATH" -`; - - const setupDagger = `\ - curl -L https://dl.dagger.io/dagger/install.sh | DAGGER_VERSION=0.9.3 sh - sudo mv bin/dagger /usr/local/bin - dagger version -`; - - azurePipeline - .trigger(["main"]) - .pool({ - name: "Default", - vmImage: "ubuntu-latest", - }) - .step({ - script: installDeno, - displayName: "Install Deno", - }) - .step({ - script: "deno install -A -r https://cli.fluentci.io -n fluentci", - displayName: "Setup Fluent CI CLI", - }) - .step({ - script: setupDagger, - displayName: "Setup Dagger", - }) - .step({ - script: "fluentci run bun_pipeline", - displayName: "Run Dagger Pipelines", - }); - return azurePipeline; -} diff --git a/example/.fluentci/src/azure/config_test.ts b/example/.fluentci/src/azure/config_test.ts deleted file mode 100644 index 0311f55..0000000 --- a/example/.fluentci/src/azure/config_test.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { assertEquals } from "https://deno.land/std@0.191.0/testing/asserts.ts"; -import { generateYaml } from "./config.ts"; - -Deno.test(function generateAzurePipelinesTest() { - const azurepipelines = generateYaml(); - const actual = azurepipelines.toString(); - const expected = Deno.readTextFileSync("./fixtures/azure-pipelines.yml"); - assertEquals(actual, expected); -}); diff --git a/example/.fluentci/src/azure/init.ts b/example/.fluentci/src/azure/init.ts deleted file mode 100644 index 2e71b2e..0000000 --- a/example/.fluentci/src/azure/init.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { generateYaml } from "./config.ts"; - -generateYaml().save("azure-pipeline.yml"); diff --git a/example/.fluentci/src/circleci/README.md b/example/.fluentci/src/circleci/README.md deleted file mode 100644 index 48b0f3a..0000000 --- a/example/.fluentci/src/circleci/README.md +++ /dev/null @@ -1,47 +0,0 @@ -# Circle CI - -[![fluentci pipeline](https://img.shields.io/badge/dynamic/json?label=pkg.fluentci.io&labelColor=%23000&color=%23460cf1&url=https%3A%2F%2Fapi.fluentci.io%2Fv1%2Fpipeline%2Fbun_pipeline&query=%24.version)](https://pkg.fluentci.io/bun_pipeline) -[![deno module](https://shield.deno.dev/x/bun_pipeline)](https://deno.land/x/bun_pipeline) -![deno compatibility](https://shield.deno.dev/deno/^1.37) -[![](https://img.shields.io/codecov/c/gh/fluent-ci-templates/bun-pipeline)](https://codecov.io/gh/fluent-ci-templates/bun-pipeline) - - -The following command will generate a `.circleci/config.yml` file in your project: - -```bash -fluentci cci init -t bun_pipeline -``` - -Generated file: - -```yaml -# Do not edit this file directly. It is generated by https://deno.land/x/fluent_circleci - -version: 2.1 -jobs: - tests: - steps: - - checkout - - run: sudo apt-get update && sudo apt-get install -y curl unzip - - run: | - curl -fsSL https://deno.land/x/install/install.sh | sh - export DENO_INSTALL="$HOME/.deno" - export PATH="$DENO_INSTALL/bin:$PATH" - - run: deno install -A -r https://cli.fluentci.io -n fluentci - - 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 - - run: - name: Run Dagger Pipelines - command: fluentci run bun_pipeline - machine: - image: ubuntu-2004:2023.07.1 -workflows: - dagger: - jobs: - - tests - -``` - -Feel free to edit the template generator at `.fluentci/src/circleci/config.ts` to your needs. diff --git a/example/.fluentci/src/circleci/config.ts b/example/.fluentci/src/circleci/config.ts deleted file mode 100644 index 754f484..0000000 --- a/example/.fluentci/src/circleci/config.ts +++ /dev/null @@ -1,41 +0,0 @@ -import { CircleCI, Job } from "fluent_circleci"; - -/** - * Generates CircleCI configuration object. - * @returns {CircleCI} CircleCI configuration object. - */ -export function generateYaml(): CircleCI { - const circleci = new CircleCI(); - - const base = new Job().machine({ image: "ubuntu-2004:2023.07.1" }).steps([ - "checkout", - { - run: "sudo apt-get update && sudo apt-get install -y curl unzip", - }, - { - run: `\ -curl -fsSL https://deno.land/x/install/install.sh | sh -export DENO_INSTALL="$HOME/.deno" -export PATH="$DENO_INSTALL/bin:$PATH"`, - }, - { - run: "deno install -A -r https://cli.fluentci.io -n fluentci", - }, - { - run: `\ -curl -L https://dl.dagger.io/dagger/install.sh | DAGGER_VERSION=0.9.3 sh -sudo mv bin/dagger /usr/local/bin -dagger version`, - }, - { - run: { - name: "Run Dagger Pipelines", - command: "fluentci run bun_pipeline", - }, - }, - ]); - - circleci.jobs({ base }).workflow("dagger", ["base"]); - - return circleci; -} diff --git a/example/.fluentci/src/circleci/config_test.ts b/example/.fluentci/src/circleci/config_test.ts deleted file mode 100644 index 283a9c3..0000000 --- a/example/.fluentci/src/circleci/config_test.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { assertEquals } from "https://deno.land/std@0.191.0/testing/asserts.ts"; -import { generateYaml } from "./config.ts"; - -Deno.test(function generateCircleCITest() { - const circleci = generateYaml(); - const actual = circleci.toString(); - const expected = Deno.readTextFileSync("./fixtures/config.yml"); - assertEquals(actual, expected); -}); diff --git a/example/.fluentci/src/circleci/init.ts b/example/.fluentci/src/circleci/init.ts deleted file mode 100644 index 1f71248..0000000 --- a/example/.fluentci/src/circleci/init.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { generateYaml } from "./config.ts"; - -generateYaml().save(".circleci/config.yml"); diff --git a/example/.fluentci/src/dagger/index.ts b/example/.fluentci/src/dagger/index.ts deleted file mode 100644 index bb8dcfd..0000000 --- a/example/.fluentci/src/dagger/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -import pipeline from "./pipeline.ts"; -import { build, test, run, jobDescriptions } from "./jobs.ts"; - -export { pipeline, build, test, run, jobDescriptions }; diff --git a/example/.fluentci/src/dagger/list_jobs.ts b/example/.fluentci/src/dagger/list_jobs.ts deleted file mode 100644 index f0cfd7c..0000000 --- a/example/.fluentci/src/dagger/list_jobs.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { brightGreen, stringifyTree } from "../../deps.ts"; -import { runnableJobs, jobDescriptions, Job } from "./jobs.ts"; - -const tree = { - name: brightGreen("bun_pipeline"), - children: (Object.keys(runnableJobs) as Job[]).map((job) => ({ - name: jobDescriptions[job] - ? `${brightGreen(job)} - ${jobDescriptions[job]}` - : brightGreen(job), - children: [], - })), -}; - -console.log( - stringifyTree( - tree, - (t) => t.name, - (t) => t.children - ) -); diff --git a/example/.fluentci/src/github/README.md b/example/.fluentci/src/github/README.md deleted file mode 100644 index 82d7e0b..0000000 --- a/example/.fluentci/src/github/README.md +++ /dev/null @@ -1,44 +0,0 @@ -# Github Actions - -[![fluentci pipeline](https://img.shields.io/badge/dynamic/json?label=pkg.fluentci.io&labelColor=%23000&color=%23460cf1&url=https%3A%2F%2Fapi.fluentci.io%2Fv1%2Fpipeline%2Fbun_pipeline&query=%24.version)](https://pkg.fluentci.io/bun_pipeline) -[![deno module](https://shield.deno.dev/x/bun_pipeline)](https://deno.land/x/bun_pipeline) -![deno compatibility](https://shield.deno.dev/deno/^1.37) -[![](https://img.shields.io/codecov/c/gh/fluent-ci-templates/bun-pipeline)](https://codecov.io/gh/fluent-ci-templates/bun-pipeline) - -The following command will generate a `.github/workflows/base.yml` file in your project: - -```bash -fluentci gh init -t bun_pipeline -``` - -Generated file: - -```yaml -# Do not edit this file directly. It is generated by https://deno.land/x/fluent_github_actions - -name: base -on: - push: - branches: - - main -jobs: - build: - 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: Run Dagger Pipelines - run: fluentci run . - -``` - -Feel free to edit the template generator at `.fluentci/src/github/config.ts` to your needs. diff --git a/example/.fluentci/src/github/config.ts b/example/.fluentci/src/github/config.ts deleted file mode 100644 index 4d11c5e..0000000 --- a/example/.fluentci/src/github/config.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { JobSpec, Workflow } from "fluent_github_actions"; - -/** - * Generates a GitHub Actions workflow for running tests. - * @returns The generated workflow. - */ -export function generateYaml(): Workflow { - const workflow = new Workflow("tests"); - - const push = { - branches: ["main"], - }; - - const tests: JobSpec = { - "runs-on": "ubuntu-latest", - steps: [ - { - uses: "actions/checkout@v2", - }, - { - name: "Setup Fluent CI", - uses: "fluentci-io/setup-fluentci@v2", - }, - { - name: "Run Dagger Pipelines", - run: "fluentci run bun_pipeline", - }, - ], - }; - - workflow.on({ push }).jobs({ tests }); - - return workflow; -} diff --git a/example/.fluentci/src/github/config_test.ts b/example/.fluentci/src/github/config_test.ts deleted file mode 100644 index 88bf54f..0000000 --- a/example/.fluentci/src/github/config_test.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { assertEquals } from "https://deno.land/std@0.191.0/testing/asserts.ts"; -import { generateYaml } from "./config.ts"; - -Deno.test(function generateGithubActionsWorkflowTest() { - const workflow = generateYaml(); - const actual = workflow.toString(); - const expected = Deno.readTextFileSync("./fixtures/workflow.yml"); - assertEquals(actual, expected); -}); diff --git a/example/.fluentci/src/github/init.ts b/example/.fluentci/src/github/init.ts deleted file mode 100644 index 4788c58..0000000 --- a/example/.fluentci/src/github/init.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { generateYaml } from "./config.ts"; - -generateYaml().save(".github/workflows/ci.yml"); diff --git a/example/.fluentci/src/gitlab/README.md b/example/.fluentci/src/gitlab/README.md deleted file mode 100644 index a7c0b17..0000000 --- a/example/.fluentci/src/gitlab/README.md +++ /dev/null @@ -1,47 +0,0 @@ -# Gitlab CI - -[![fluentci pipeline](https://img.shields.io/badge/dynamic/json?label=pkg.fluentci.io&labelColor=%23000&color=%23460cf1&url=https%3A%2F%2Fapi.fluentci.io%2Fv1%2Fpipeline%2Fbun_pipeline&query=%24.version)](https://pkg.fluentci.io/bun_pipeline) -[![deno module](https://shield.deno.dev/x/bun_pipeline)](https://deno.land/x/bun_pipeline) -![deno compatibility](https://shield.deno.dev/deno/^1.37) -[![](https://img.shields.io/codecov/c/gh/fluent-ci-templates/bun-pipeline)](https://codecov.io/gh/fluent-ci-templates/bun-pipeline) - -The following command will generate a `.gitlab-ci.yml` file in your project: - -```bash -fluentci gl init -t bun_pipeline -``` - -Generated file: - -```yaml -# Do not edit this file directly. It is generated by https://deno.land/x/fluent_gitlab_ci - -.docker: - image: denoland/deno:alpine - services: - - docker:${DOCKER_VERSION}-dind - variables: - DOCKER_HOST: tcp://docker:2376 - DOCKER_TLS_VERIFY: "1" - DOCKER_TLS_CERTDIR: /certs - DOCKER_CERT_PATH: /certs/client - DOCKER_DRIVER: overlay2 - DOCKER_VERSION: 20.10.16 - -.dagger: - extends: .docker - before_script: - - apk add docker-cli curl unzip - - deno install -A -r https://cli.fluentci.io -n fluentci - - curl -L https://dl.dagger.io/dagger/install.sh | DAGGER_VERSION=0.8.1 sh - - mv bin/dagger /usr/local/bin - - dagger version - -tests: - extends: .dagger - script: - - fluentci run bun_pipeline - -``` - -Feel free to edit the template generator at `.fluentci/src/gitlab/config.ts` to your needs. diff --git a/example/.fluentci/src/gitlab/config.ts b/example/.fluentci/src/gitlab/config.ts deleted file mode 100644 index 384ebc6..0000000 --- a/example/.fluentci/src/gitlab/config.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { GitlabCI, Job } from "fluent_gitlab_ci"; - -/** - * Generates GitLab CI YAML configuration. - * @returns {GitlabCI} GitLab CI configuration. - */ -export function generateYaml(): GitlabCI { - const docker = new Job() - .image("denoland/deno:alpine") - .services(["docker:${DOCKER_VERSION}-dind"]) - .variables({ - DOCKER_HOST: "tcp://docker:2376", - DOCKER_TLS_VERIFY: "1", - DOCKER_TLS_CERTDIR: "/certs", - DOCKER_CERT_PATH: "/certs/client", - DOCKER_DRIVER: "overlay2", - DOCKER_VERSION: "20.10.16", - }); - - const dagger = new Job().extends(".docker").beforeScript( - ` - apk add docker-cli curl unzip - deno install -A -r https://cli.fluentci.io -n fluentci - curl -L https://dl.dagger.io/dagger/install.sh | DAGGER_VERSION=0.9.3 sh - mv bin/dagger /usr/local/bin - dagger version - ` - ); - - const tests = new Job() - .extends(".dagger") - .script("fluentci run bun_pipeline"); - - return new GitlabCI() - .addJob(".docker", docker) - .addJob(".dagger", dagger) - .addJob("tests", tests); -} diff --git a/example/.fluentci/src/gitlab/config_test.ts b/example/.fluentci/src/gitlab/config_test.ts deleted file mode 100644 index bf5c856..0000000 --- a/example/.fluentci/src/gitlab/config_test.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { assertEquals } from "https://deno.land/std@0.191.0/testing/asserts.ts"; -import { generateYaml } from "./config.ts"; - -Deno.test(function generateGitlabCITest() { - const gitlabci = generateYaml(); - const actual = gitlabci.toString(); - const expected = Deno.readTextFileSync("./fixtures/.gitlab-ci.yml"); - assertEquals(actual, expected); -}); diff --git a/example/.fluentci/src/gitlab/init.ts b/example/.fluentci/src/gitlab/init.ts deleted file mode 100644 index 6097dd5..0000000 --- a/example/.fluentci/src/gitlab/init.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { generateYaml } from "./config.ts"; - -generateYaml(); diff --git a/example/.fluentci/src/dagger/lib.ts b/example/.fluentci/src/helpers.ts similarity index 89% rename from example/.fluentci/src/dagger/lib.ts rename to example/.fluentci/src/helpers.ts index 0333f53..f87ec12 100644 --- a/example/.fluentci/src/dagger/lib.ts +++ b/example/.fluentci/src/helpers.ts @@ -1,4 +1,4 @@ -import { Directory, DirectoryID, dag } from "../../deps.ts"; +import { Directory, type DirectoryID, dag } from "../deps.ts"; export const getDirectory = async ( src: string | Directory | undefined = "." diff --git a/example/.fluentci/src/dagger/jobs.ts b/example/.fluentci/src/jobs.ts similarity index 98% rename from example/.fluentci/src/dagger/jobs.ts rename to example/.fluentci/src/jobs.ts index 3beb8b7..3bc2f03 100644 --- a/example/.fluentci/src/dagger/jobs.ts +++ b/example/.fluentci/src/jobs.ts @@ -3,8 +3,8 @@ * @description Provides a set of functions for Bun projects */ -import { Directory, dag, env } from "../../deps.ts"; -import { getDirectory } from "./lib.ts"; +import { type Directory, dag, env } from "../deps.ts"; +import { getDirectory } from "./helpers.ts"; export enum Job { test = "test", diff --git a/src/dagger/index.ts b/example/.fluentci/src/mod.ts similarity index 100% rename from src/dagger/index.ts rename to example/.fluentci/src/mod.ts diff --git a/example/.fluentci/src/dagger/pipeline.ts b/example/.fluentci/src/pipeline.ts similarity index 100% rename from example/.fluentci/src/dagger/pipeline.ts rename to example/.fluentci/src/pipeline.ts diff --git a/example/.fluentci/src/dagger/runner.ts b/example/.fluentci/src/runner.ts similarity index 86% rename from example/.fluentci/src/dagger/runner.ts rename to example/.fluentci/src/runner.ts index 59f82f5..4b86a36 100644 --- a/example/.fluentci/src/dagger/runner.ts +++ b/example/.fluentci/src/runner.ts @@ -1,5 +1,5 @@ import pipeline from "./pipeline.ts"; -import { parse, camelCase, snakeCase } from "../../deps.ts"; +import { parse, camelCase, snakeCase } from "../deps.ts"; const args = parse(Deno.args.map((x) => x.split(" ")).flat()); diff --git a/fluentci.toml b/fluentci.toml index d2e6d4e..945042a 100644 --- a/fluentci.toml +++ b/fluentci.toml @@ -5,4 +5,4 @@ authors = [ description = "CI/CD Plugin for Bun" license = "MIT" name = "bun" -version = "0.7.1" +version = "0.8.0" diff --git a/mod.ts b/mod.ts index fbc1f17..a1ca67a 100644 --- a/mod.ts +++ b/mod.ts @@ -1 +1 @@ -export * from "./src/dagger/index.ts"; +export * from "./src/mod.ts"; diff --git a/plugin/Cargo.toml b/plugin/Cargo.toml index 30a2d24..e650091 100644 --- a/plugin/Cargo.toml +++ b/plugin/Cargo.toml @@ -1,7 +1,7 @@ [package] edition = "2021" name = "bun" -version = "0.7.1" +version = "0.8.0" [lib] crate-type = ["cdylib"] diff --git a/src/aws/README.md b/src/aws/README.md deleted file mode 100644 index 279355d..0000000 --- a/src/aws/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS CodePipeline - -[![fluentci pipeline](https://img.shields.io/badge/dynamic/json?label=pkg.fluentci.io&labelColor=%23000&color=%23460cf1&url=https%3A%2F%2Fapi.fluentci.io%2Fv1%2Fpipeline%2Fbun_pipeline&query=%24.version)](https://pkg.fluentci.io/bun_pipeline) -[![deno module](https://shield.deno.dev/x/bun_pipeline)](https://deno.land/x/bun_pipeline) -![deno compatibility](https://shield.deno.dev/deno/^1.37) -[![](https://img.shields.io/codecov/c/gh/fluent-ci-templates/bun-pipeline)](https://codecov.io/gh/fluent-ci-templates/bun-pipeline) - -The following command will generate a `buildspec.yml` file in your project: - -```bash -fluentci ac init -t bun_pipeline -``` - -Generated file: - -```yaml -# Do not edit this file directly. It is generated by https://deno.land/x/fluent_aws_codepipeline - -version: 0.2 -phases: - install: - commands: - - curl -fsSL https://deno.land/x/install/install.sh | sh - - export DENO_INSTALL="$HOME/.deno" - - export PATH="$DENO_INSTALL/bin:$PATH" - - deno install -A -r https://cli.fluentci.io -n fluentci - - curl -L https://dl.dagger.io/dagger/install.sh | DAGGER_VERSION=0.8.1 sh - - mv bin/dagger /usr/local/bin - - dagger version - tests: - commands: - - fluentci run bun_pipeline - post_build: - commands: - - echo Build completed on `date` - -``` - -Feel free to edit the template generator at `.fluentci/src/aws/config.ts` to your needs. diff --git a/src/aws/config.ts b/src/aws/config.ts deleted file mode 100644 index 9cb4d70..0000000 --- a/src/aws/config.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { BuildSpec } from "fluent_aws_codepipeline"; - -/** - * Generates a BuildSpec object for AWS CodePipeline. - * @returns A BuildSpec object with install, build, and post_build phases. - */ -export function generateYaml(): BuildSpec { - const buildspec = new BuildSpec(); - buildspec - .phase("install", { - commands: [ - "curl -fsSL https://deno.land/x/install/install.sh | sh", - 'export DENO_INSTALL="$HOME/.deno"', - 'export PATH="$DENO_INSTALL/bin:$PATH"', - "deno install -A -r https://cli.fluentci.io -n fluentci", - "curl -L https://dl.dagger.io/dagger/install.sh | DAGGER_VERSION=0.9.3 sh", - "mv bin/dagger /usr/local/bin", - "dagger version", - ], - }) - .phase("build", { - commands: ["fluentci run bun_pipeline"], - }) - .phase("post_build", { - commands: ["echo Build completed on `date`"], - }); - return buildspec; -} diff --git a/src/aws/config_test.ts b/src/aws/config_test.ts deleted file mode 100644 index 97bed68..0000000 --- a/src/aws/config_test.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { assertEquals } from "https://deno.land/std@0.191.0/testing/asserts.ts"; -import { generateYaml } from "./config.ts"; - -Deno.test(function generateAWSCodePipelineTest() { - const buildspec = generateYaml(); - const actual = buildspec.toString(); - const expected = Deno.readTextFileSync("./fixtures/buildspec.yml"); - assertEquals(actual, expected); -}); diff --git a/src/aws/init.ts b/src/aws/init.ts deleted file mode 100644 index 83944b7..0000000 --- a/src/aws/init.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { generateYaml } from "./config.ts"; - -generateYaml().save("buildspec.yml"); diff --git a/src/azure/README.md b/src/azure/README.md deleted file mode 100644 index 6b1efa4..0000000 --- a/src/azure/README.md +++ /dev/null @@ -1,42 +0,0 @@ -# Azure Pipelines - -[![fluentci pipeline](https://img.shields.io/badge/dynamic/json?label=pkg.fluentci.io&labelColor=%23000&color=%23460cf1&url=https%3A%2F%2Fapi.fluentci.io%2Fv1%2Fpipeline%2Fbun_pipeline&query=%24.version)](https://pkg.fluentci.io/bun_pipeline) -[![deno module](https://shield.deno.dev/x/bun_pipeline)](https://deno.land/x/bun_pipeline) -![deno compatibility](https://shield.deno.dev/deno/^1.37) -[![](https://img.shields.io/codecov/c/gh/fluent-ci-templates/bun-pipeline)](https://codecov.io/gh/fluent-ci-templates/bun-pipeline) - -The following command will generate a `azure-pipelines.yml` file in your project: - -```bash -fluentci ap init -t bun_pipeline -``` - -Generated file: - -```yaml -# Do not edit this file directly. It is generated by https://deno.land/x/fluent_azure_pipelines - -trigger: - - main -pool: - name: Default - vmImage: ubuntu-latest -steps: - - script: | - curl -fsSL https://deno.land/x/install/install.sh | sh - export DENO_INSTALL="$HOME/.deno" - export PATH="$DENO_INSTALL/bin:$PATH" - displayName: Install Deno - - script: deno install -A -r https://cli.fluentci.io -n fluentci - displayName: Setup Fluent CI CLI - - script: | - curl -L https://dl.dagger.io/dagger/install.sh | DAGGER_VERSION=0.8.1 sh - sudo mv bin/dagger /usr/local/bin - dagger version - displayName: Setup Dagger - - script: fluentci run bun_pipeline - displayName: Run Dagger Pipelines - -``` - -Feel free to edit the template generator at `.fluentci/src/azure/config.ts` to your needs. diff --git a/src/azure/config.ts b/src/azure/config.ts deleted file mode 100644 index 4c4c4a7..0000000 --- a/src/azure/config.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { AzurePipeline } from "fluent_azure_pipelines"; - -/** - * Generates the YAML for the Azure Pipeline. - * @returns An instance of AzurePipeline. - */ -export function generateYaml(): AzurePipeline { - const azurePipeline = new AzurePipeline(); - - const installDeno = `\ - curl -fsSL https://deno.land/x/install/install.sh | sh - export DENO_INSTALL="$HOME/.deno" - export PATH="$DENO_INSTALL/bin:$PATH" -`; - - const setupDagger = `\ - curl -L https://dl.dagger.io/dagger/install.sh | DAGGER_VERSION=0.9.3 sh - sudo mv bin/dagger /usr/local/bin - dagger version -`; - - azurePipeline - .trigger(["main"]) - .pool({ - name: "Default", - vmImage: "ubuntu-latest", - }) - .step({ - script: installDeno, - displayName: "Install Deno", - }) - .step({ - script: "deno install -A -r https://cli.fluentci.io -n fluentci", - displayName: "Setup Fluent CI CLI", - }) - .step({ - script: setupDagger, - displayName: "Setup Dagger", - }) - .step({ - script: "fluentci run bun_pipeline", - displayName: "Run Dagger Pipelines", - }); - return azurePipeline; -} diff --git a/src/azure/config_test.ts b/src/azure/config_test.ts deleted file mode 100644 index 0311f55..0000000 --- a/src/azure/config_test.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { assertEquals } from "https://deno.land/std@0.191.0/testing/asserts.ts"; -import { generateYaml } from "./config.ts"; - -Deno.test(function generateAzurePipelinesTest() { - const azurepipelines = generateYaml(); - const actual = azurepipelines.toString(); - const expected = Deno.readTextFileSync("./fixtures/azure-pipelines.yml"); - assertEquals(actual, expected); -}); diff --git a/src/azure/init.ts b/src/azure/init.ts deleted file mode 100644 index 2e71b2e..0000000 --- a/src/azure/init.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { generateYaml } from "./config.ts"; - -generateYaml().save("azure-pipeline.yml"); diff --git a/src/circleci/README.md b/src/circleci/README.md deleted file mode 100644 index 48b0f3a..0000000 --- a/src/circleci/README.md +++ /dev/null @@ -1,47 +0,0 @@ -# Circle CI - -[![fluentci pipeline](https://img.shields.io/badge/dynamic/json?label=pkg.fluentci.io&labelColor=%23000&color=%23460cf1&url=https%3A%2F%2Fapi.fluentci.io%2Fv1%2Fpipeline%2Fbun_pipeline&query=%24.version)](https://pkg.fluentci.io/bun_pipeline) -[![deno module](https://shield.deno.dev/x/bun_pipeline)](https://deno.land/x/bun_pipeline) -![deno compatibility](https://shield.deno.dev/deno/^1.37) -[![](https://img.shields.io/codecov/c/gh/fluent-ci-templates/bun-pipeline)](https://codecov.io/gh/fluent-ci-templates/bun-pipeline) - - -The following command will generate a `.circleci/config.yml` file in your project: - -```bash -fluentci cci init -t bun_pipeline -``` - -Generated file: - -```yaml -# Do not edit this file directly. It is generated by https://deno.land/x/fluent_circleci - -version: 2.1 -jobs: - tests: - steps: - - checkout - - run: sudo apt-get update && sudo apt-get install -y curl unzip - - run: | - curl -fsSL https://deno.land/x/install/install.sh | sh - export DENO_INSTALL="$HOME/.deno" - export PATH="$DENO_INSTALL/bin:$PATH" - - run: deno install -A -r https://cli.fluentci.io -n fluentci - - 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 - - run: - name: Run Dagger Pipelines - command: fluentci run bun_pipeline - machine: - image: ubuntu-2004:2023.07.1 -workflows: - dagger: - jobs: - - tests - -``` - -Feel free to edit the template generator at `.fluentci/src/circleci/config.ts` to your needs. diff --git a/src/circleci/config.ts b/src/circleci/config.ts deleted file mode 100644 index 754f484..0000000 --- a/src/circleci/config.ts +++ /dev/null @@ -1,41 +0,0 @@ -import { CircleCI, Job } from "fluent_circleci"; - -/** - * Generates CircleCI configuration object. - * @returns {CircleCI} CircleCI configuration object. - */ -export function generateYaml(): CircleCI { - const circleci = new CircleCI(); - - const base = new Job().machine({ image: "ubuntu-2004:2023.07.1" }).steps([ - "checkout", - { - run: "sudo apt-get update && sudo apt-get install -y curl unzip", - }, - { - run: `\ -curl -fsSL https://deno.land/x/install/install.sh | sh -export DENO_INSTALL="$HOME/.deno" -export PATH="$DENO_INSTALL/bin:$PATH"`, - }, - { - run: "deno install -A -r https://cli.fluentci.io -n fluentci", - }, - { - run: `\ -curl -L https://dl.dagger.io/dagger/install.sh | DAGGER_VERSION=0.9.3 sh -sudo mv bin/dagger /usr/local/bin -dagger version`, - }, - { - run: { - name: "Run Dagger Pipelines", - command: "fluentci run bun_pipeline", - }, - }, - ]); - - circleci.jobs({ base }).workflow("dagger", ["base"]); - - return circleci; -} diff --git a/src/circleci/config_test.ts b/src/circleci/config_test.ts deleted file mode 100644 index 283a9c3..0000000 --- a/src/circleci/config_test.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { assertEquals } from "https://deno.land/std@0.191.0/testing/asserts.ts"; -import { generateYaml } from "./config.ts"; - -Deno.test(function generateCircleCITest() { - const circleci = generateYaml(); - const actual = circleci.toString(); - const expected = Deno.readTextFileSync("./fixtures/config.yml"); - assertEquals(actual, expected); -}); diff --git a/src/circleci/init.ts b/src/circleci/init.ts deleted file mode 100644 index 1f71248..0000000 --- a/src/circleci/init.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { generateYaml } from "./config.ts"; - -generateYaml().save(".circleci/config.yml"); diff --git a/src/dagger/list_jobs.ts b/src/dagger/list_jobs.ts deleted file mode 100644 index f0cfd7c..0000000 --- a/src/dagger/list_jobs.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { brightGreen, stringifyTree } from "../../deps.ts"; -import { runnableJobs, jobDescriptions, Job } from "./jobs.ts"; - -const tree = { - name: brightGreen("bun_pipeline"), - children: (Object.keys(runnableJobs) as Job[]).map((job) => ({ - name: jobDescriptions[job] - ? `${brightGreen(job)} - ${jobDescriptions[job]}` - : brightGreen(job), - children: [], - })), -}; - -console.log( - stringifyTree( - tree, - (t) => t.name, - (t) => t.children - ) -); diff --git a/src/github/README.md b/src/github/README.md deleted file mode 100644 index 82d7e0b..0000000 --- a/src/github/README.md +++ /dev/null @@ -1,44 +0,0 @@ -# Github Actions - -[![fluentci pipeline](https://img.shields.io/badge/dynamic/json?label=pkg.fluentci.io&labelColor=%23000&color=%23460cf1&url=https%3A%2F%2Fapi.fluentci.io%2Fv1%2Fpipeline%2Fbun_pipeline&query=%24.version)](https://pkg.fluentci.io/bun_pipeline) -[![deno module](https://shield.deno.dev/x/bun_pipeline)](https://deno.land/x/bun_pipeline) -![deno compatibility](https://shield.deno.dev/deno/^1.37) -[![](https://img.shields.io/codecov/c/gh/fluent-ci-templates/bun-pipeline)](https://codecov.io/gh/fluent-ci-templates/bun-pipeline) - -The following command will generate a `.github/workflows/base.yml` file in your project: - -```bash -fluentci gh init -t bun_pipeline -``` - -Generated file: - -```yaml -# Do not edit this file directly. It is generated by https://deno.land/x/fluent_github_actions - -name: base -on: - push: - branches: - - main -jobs: - build: - 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: Run Dagger Pipelines - run: fluentci run . - -``` - -Feel free to edit the template generator at `.fluentci/src/github/config.ts` to your needs. diff --git a/src/github/config.ts b/src/github/config.ts deleted file mode 100644 index 4d11c5e..0000000 --- a/src/github/config.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { JobSpec, Workflow } from "fluent_github_actions"; - -/** - * Generates a GitHub Actions workflow for running tests. - * @returns The generated workflow. - */ -export function generateYaml(): Workflow { - const workflow = new Workflow("tests"); - - const push = { - branches: ["main"], - }; - - const tests: JobSpec = { - "runs-on": "ubuntu-latest", - steps: [ - { - uses: "actions/checkout@v2", - }, - { - name: "Setup Fluent CI", - uses: "fluentci-io/setup-fluentci@v2", - }, - { - name: "Run Dagger Pipelines", - run: "fluentci run bun_pipeline", - }, - ], - }; - - workflow.on({ push }).jobs({ tests }); - - return workflow; -} diff --git a/src/github/config_test.ts b/src/github/config_test.ts deleted file mode 100644 index 88bf54f..0000000 --- a/src/github/config_test.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { assertEquals } from "https://deno.land/std@0.191.0/testing/asserts.ts"; -import { generateYaml } from "./config.ts"; - -Deno.test(function generateGithubActionsWorkflowTest() { - const workflow = generateYaml(); - const actual = workflow.toString(); - const expected = Deno.readTextFileSync("./fixtures/workflow.yml"); - assertEquals(actual, expected); -}); diff --git a/src/github/init.ts b/src/github/init.ts deleted file mode 100644 index 4788c58..0000000 --- a/src/github/init.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { generateYaml } from "./config.ts"; - -generateYaml().save(".github/workflows/ci.yml"); diff --git a/src/gitlab/README.md b/src/gitlab/README.md deleted file mode 100644 index a7c0b17..0000000 --- a/src/gitlab/README.md +++ /dev/null @@ -1,47 +0,0 @@ -# Gitlab CI - -[![fluentci pipeline](https://img.shields.io/badge/dynamic/json?label=pkg.fluentci.io&labelColor=%23000&color=%23460cf1&url=https%3A%2F%2Fapi.fluentci.io%2Fv1%2Fpipeline%2Fbun_pipeline&query=%24.version)](https://pkg.fluentci.io/bun_pipeline) -[![deno module](https://shield.deno.dev/x/bun_pipeline)](https://deno.land/x/bun_pipeline) -![deno compatibility](https://shield.deno.dev/deno/^1.37) -[![](https://img.shields.io/codecov/c/gh/fluent-ci-templates/bun-pipeline)](https://codecov.io/gh/fluent-ci-templates/bun-pipeline) - -The following command will generate a `.gitlab-ci.yml` file in your project: - -```bash -fluentci gl init -t bun_pipeline -``` - -Generated file: - -```yaml -# Do not edit this file directly. It is generated by https://deno.land/x/fluent_gitlab_ci - -.docker: - image: denoland/deno:alpine - services: - - docker:${DOCKER_VERSION}-dind - variables: - DOCKER_HOST: tcp://docker:2376 - DOCKER_TLS_VERIFY: "1" - DOCKER_TLS_CERTDIR: /certs - DOCKER_CERT_PATH: /certs/client - DOCKER_DRIVER: overlay2 - DOCKER_VERSION: 20.10.16 - -.dagger: - extends: .docker - before_script: - - apk add docker-cli curl unzip - - deno install -A -r https://cli.fluentci.io -n fluentci - - curl -L https://dl.dagger.io/dagger/install.sh | DAGGER_VERSION=0.8.1 sh - - mv bin/dagger /usr/local/bin - - dagger version - -tests: - extends: .dagger - script: - - fluentci run bun_pipeline - -``` - -Feel free to edit the template generator at `.fluentci/src/gitlab/config.ts` to your needs. diff --git a/src/gitlab/config.ts b/src/gitlab/config.ts deleted file mode 100644 index 384ebc6..0000000 --- a/src/gitlab/config.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { GitlabCI, Job } from "fluent_gitlab_ci"; - -/** - * Generates GitLab CI YAML configuration. - * @returns {GitlabCI} GitLab CI configuration. - */ -export function generateYaml(): GitlabCI { - const docker = new Job() - .image("denoland/deno:alpine") - .services(["docker:${DOCKER_VERSION}-dind"]) - .variables({ - DOCKER_HOST: "tcp://docker:2376", - DOCKER_TLS_VERIFY: "1", - DOCKER_TLS_CERTDIR: "/certs", - DOCKER_CERT_PATH: "/certs/client", - DOCKER_DRIVER: "overlay2", - DOCKER_VERSION: "20.10.16", - }); - - const dagger = new Job().extends(".docker").beforeScript( - ` - apk add docker-cli curl unzip - deno install -A -r https://cli.fluentci.io -n fluentci - curl -L https://dl.dagger.io/dagger/install.sh | DAGGER_VERSION=0.9.3 sh - mv bin/dagger /usr/local/bin - dagger version - ` - ); - - const tests = new Job() - .extends(".dagger") - .script("fluentci run bun_pipeline"); - - return new GitlabCI() - .addJob(".docker", docker) - .addJob(".dagger", dagger) - .addJob("tests", tests); -} diff --git a/src/gitlab/config_test.ts b/src/gitlab/config_test.ts deleted file mode 100644 index bf5c856..0000000 --- a/src/gitlab/config_test.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { assertEquals } from "https://deno.land/std@0.191.0/testing/asserts.ts"; -import { generateYaml } from "./config.ts"; - -Deno.test(function generateGitlabCITest() { - const gitlabci = generateYaml(); - const actual = gitlabci.toString(); - const expected = Deno.readTextFileSync("./fixtures/.gitlab-ci.yml"); - assertEquals(actual, expected); -}); diff --git a/src/gitlab/init.ts b/src/gitlab/init.ts deleted file mode 100644 index 6097dd5..0000000 --- a/src/gitlab/init.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { generateYaml } from "./config.ts"; - -generateYaml(); diff --git a/src/dagger/lib.ts b/src/helpers.ts similarity index 89% rename from src/dagger/lib.ts rename to src/helpers.ts index 0333f53..f87ec12 100644 --- a/src/dagger/lib.ts +++ b/src/helpers.ts @@ -1,4 +1,4 @@ -import { Directory, DirectoryID, dag } from "../../deps.ts"; +import { Directory, type DirectoryID, dag } from "../deps.ts"; export const getDirectory = async ( src: string | Directory | undefined = "." diff --git a/src/dagger/jobs.ts b/src/jobs.ts similarity index 98% rename from src/dagger/jobs.ts rename to src/jobs.ts index 3beb8b7..3bc2f03 100644 --- a/src/dagger/jobs.ts +++ b/src/jobs.ts @@ -3,8 +3,8 @@ * @description Provides a set of functions for Bun projects */ -import { Directory, dag, env } from "../../deps.ts"; -import { getDirectory } from "./lib.ts"; +import { type Directory, dag, env } from "../deps.ts"; +import { getDirectory } from "./helpers.ts"; export enum Job { test = "test", diff --git a/src/mod.ts b/src/mod.ts new file mode 100644 index 0000000..9af1454 --- /dev/null +++ b/src/mod.ts @@ -0,0 +1,3 @@ +import { build, test, run, jobDescriptions } from "./jobs.ts"; + +export { build, test, run, jobDescriptions }; diff --git a/src/dagger/pipeline.ts b/src/pipeline.ts similarity index 100% rename from src/dagger/pipeline.ts rename to src/pipeline.ts diff --git a/src/dagger/runner.ts b/src/runner.ts similarity index 86% rename from src/dagger/runner.ts rename to src/runner.ts index 59f82f5..4b86a36 100644 --- a/src/dagger/runner.ts +++ b/src/runner.ts @@ -1,5 +1,5 @@ import pipeline from "./pipeline.ts"; -import { parse, camelCase, snakeCase } from "../../deps.ts"; +import { parse, camelCase, snakeCase } from "../deps.ts"; const args = parse(Deno.args.map((x) => x.split(" ")).flat());