From 4e06dfad9e869dea6773cd6919eaf77ecc952b5c Mon Sep 17 00:00:00 2001 From: Tsiry Sandratraina Date: Thu, 22 Aug 2024 19:52:23 +0000 Subject: [PATCH] install rebar3 --- .github/workflows/ci.yml | 12 ++--- .github/workflows/example.yml | 4 +- .github/workflows/zenith.yml | 2 +- dagger.json | 2 +- deno.json | 2 +- example/.fluentci/mod.ts | 2 +- example/.fluentci/plugin/Cargo.lock | 2 +- example/.fluentci/plugin/Cargo.toml | 2 +- example/.fluentci/plugin/src/lib.rs | 8 ++-- 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/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 | 12 ++--- .../.fluentci/src/{dagger/index.ts => mod.ts} | 0 .../.fluentci/src/{dagger => }/pipeline.ts | 0 example/.fluentci/src/{dagger => }/runner.ts | 2 +- fluentci.toml | 2 +- mod.ts | 2 +- plugin/Cargo.lock | 2 +- plugin/Cargo.toml | 2 +- plugin/src/lib.rs | 8 ++-- 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 | 12 ++--- src/{dagger/index.ts => mod.ts} | 0 src/{dagger => }/pipeline.ts | 0 src/{dagger => }/runner.ts | 2 +- 66 files changed, 41 insertions(+), 1013 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/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 (91%) rename example/.fluentci/src/{dagger/index.ts => 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 (91%) rename src/{dagger/index.ts => mod.ts} (100%) 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 c7decc4..fda468b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,16 +16,14 @@ jobs: wasm: true pipeline: deno args: | - fmt - test - coverage + fmts - name: Run Dagger Pipelines run: | dagger -m github.com/fluent-ci-templates/gleam-pipeline functions - - name: Upload Coverage - run: fluentci run --wasm codecov upload - env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + #- name: Upload Coverage + # run: fluentci run --wasm codecov upload + # env: + # CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} publish: needs: tests runs-on: ubuntu-latest diff --git a/.github/workflows/example.yml b/.github/workflows/example.yml index 4766ffd..0254add 100644 --- a/.github/workflows/example.yml +++ b/.github/workflows/example.yml @@ -12,12 +12,12 @@ jobs: - uses: actions/checkout@v2 - uses: denoland/setup-deno@v1 with: - deno-version: v1.41 + deno-version: v1.45 - name: Setup Fluent CI CLI uses: fluentci-io/setup-fluentci@v5 - name: Run Wasm Plugin run: fluentci run --wasm . test working-directory: example - name: Run Dagger Pipelines - run: dagger run deno run -A ../src/dagger/runner.ts check format test build + run: dagger run deno run -A ../src/runner.ts check format test build working-directory: example diff --git a/.github/workflows/zenith.yml b/.github/workflows/zenith.yml index 04397cc..397e39c 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.5 sh sudo mv bin/dagger /usr/local/bin dagger version - name: Run Dagger Pipelines diff --git a/dagger.json b/dagger.json index f4b7d2d..a9f82d6 100644 --- a/dagger.json +++ b/dagger.json @@ -1,7 +1,7 @@ { "name": "gleam", "sdk": "github.com/fluentci-io/daggerverse/deno-sdk@main", - "version": "v0.8.0", + "version": "v0.8.1", "description": "", "author": "Tsiry Sandratraina", "license": "MIT" diff --git a/deno.json b/deno.json index e62db50..05f5d0f 100644 --- a/deno.json +++ b/deno.json @@ -1,6 +1,6 @@ { "name": "@fluentci/gleam", - "version": "0.7.0", + "version": "0.8.1", "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/plugin/Cargo.lock b/example/.fluentci/plugin/Cargo.lock index b37822f..445ecc2 100644 --- a/example/.fluentci/plugin/Cargo.lock +++ b/example/.fluentci/plugin/Cargo.lock @@ -144,7 +144,7 @@ dependencies = [ [[package]] name = "gleam" -version = "0.8.0" +version = "0.8.1" dependencies = [ "extism-pdk", "fluentci-pdk", diff --git a/example/.fluentci/plugin/Cargo.toml b/example/.fluentci/plugin/Cargo.toml index 07526f6..084adb7 100644 --- a/example/.fluentci/plugin/Cargo.toml +++ b/example/.fluentci/plugin/Cargo.toml @@ -1,7 +1,7 @@ [package] edition = "2021" name = "gleam" -version = "0.8.0" +version = "0.8.1" [lib] crate-type = ["cdylib"] diff --git a/example/.fluentci/plugin/src/lib.rs b/example/.fluentci/plugin/src/lib.rs index 54dda74..b7c843e 100644 --- a/example/.fluentci/plugin/src/lib.rs +++ b/example/.fluentci/plugin/src/lib.rs @@ -6,7 +6,7 @@ pub fn check(args: String) -> FnResult { let stdout = dag() .pipeline("check")? .pkgx()? - .with_packages(vec!["gleam", "escript"])? + .with_packages(vec!["gleam", "escript", "rebar3"])? .with_exec(vec!["gleam", "deps", "download"])? .with_exec(vec!["gleam", "check", &args])? .stdout()?; @@ -18,7 +18,7 @@ pub fn format(args: String) -> FnResult { let stdout = dag() .pipeline("format")? .pkgx()? - .with_packages(vec!["gleam", "escript"])? + .with_packages(vec!["gleam", "escript", "rebar3"])? .with_exec(vec!["gleam", "deps", "download"])? .with_exec(vec!["gleam", "format", "--check", &args])? .stdout()?; @@ -30,7 +30,7 @@ pub fn test(args: String) -> FnResult { let stdout = dag() .pipeline("test")? .pkgx()? - .with_packages(vec!["gleam", "escript"])? + .with_packages(vec!["gleam", "escript", "rebar3"])? .with_exec(vec!["gleam", "deps", "download"])? .with_exec(vec!["gleam", "test", &args])? .stdout()?; @@ -42,7 +42,7 @@ pub fn build(args: String) -> FnResult { let stdout = dag() .pipeline("build")? .pkgx()? - .with_packages(vec!["gleam", "escript"])? + .with_packages(vec!["gleam", "escript", "rebar3"])? .with_exec(vec!["gleam", "deps", "download"])? .with_exec(vec!["gleam", "build", &args])? .stdout()?; diff --git a/example/.fluentci/src/aws/README.md b/example/.fluentci/src/aws/README.md deleted file mode 100644 index 65aada6..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%2Fgleam_pipeline&query=%24.version)](https://pkg.fluentci.io/gleam_pipeline) -[![deno module](https://shield.deno.dev/x/gleam_pipeline)](https://deno.land/x/gleam_pipeline) -![deno compatibility](https://shield.deno.dev/deno/^1.34) -[![](https://img.shields.io/codecov/c/gh/fluent-ci-templates/gleam-pipeline)](https://codecov.io/gh/fluent-ci-templates/gleam-pipeline) - -The following command will generate a `buildspec.yml` file in your project: - -```bash -fluentci ac init -t gleam_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 gleam_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 0cfa61b..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 The generated BuildSpec object. - */ -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.8.1 sh", - "mv bin/dagger /usr/local/bin", - "dagger version", - ], - }) - .phase("build", { - commands: ["fluentci run gleam_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 edb33b7..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%2Fgleam_pipeline&query=%24.version)](https://pkg.fluentci.io/gleam_pipeline) -[![deno module](https://shield.deno.dev/x/gleam_pipeline)](https://deno.land/x/gleam_pipeline) -![deno compatibility](https://shield.deno.dev/deno/^1.34) -[![](https://img.shields.io/codecov/c/gh/fluent-ci-templates/gleam-pipeline)](https://codecov.io/gh/fluent-ci-templates/gleam-pipeline) - -The following command will generate a `azure-pipelines.yml` file in your project: - -```bash -fluentci ap init -t gleam_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: ugleamtu-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 gleam_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 b8e0776..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.8.1 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 gleam_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 71ad6ff..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%2Fgleam_pipeline&query=%24.version)](https://pkg.fluentci.io/gleam_pipeline) -[![deno module](https://shield.deno.dev/x/gleam_pipeline)](https://deno.land/x/gleam_pipeline) -![deno compatibility](https://shield.deno.dev/deno/^1.34) -[![](https://img.shields.io/codecov/c/gh/fluent-ci-templates/gleam-pipeline)](https://codecov.io/gh/fluent-ci-templates/gleam-pipeline) - - -The following command will generate a `.circleci/config.yml` file in your project: - -```bash -fluentci cci init -t gleam_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 gleam_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 afe3a6a..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 tests = 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.8.1 sh -sudo mv bin/dagger /usr/local/bin -dagger version`, - }, - { - run: { - name: "Run Dagger Pipelines", - command: "fluentci run gleam_pipeline", - }, - }, - ]); - - circleci.jobs({ tests }).workflow("dagger", ["tests"]); - - 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/list_jobs.ts b/example/.fluentci/src/dagger/list_jobs.ts deleted file mode 100644 index 3108099..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("gleam_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 5060502..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%2Fgleam_pipeline&query=%24.version)](https://pkg.fluentci.io/gleam_pipeline) -[![deno module](https://shield.deno.dev/x/gleam_pipeline)](https://deno.land/x/gleam_pipeline) -![deno compatibility](https://shield.deno.dev/deno/^1.34) -[![](https://img.shields.io/codecov/c/gh/fluent-ci-templates/gleam-pipeline)](https://codecov.io/gh/fluent-ci-templates/gleam-pipeline) - -The following command will generate a `.github/workflows/workflow.yml` file in your project: - -```bash -fluentci gh init -t gleam_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 gleam_pipeline - -``` - -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 1be4ce2..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@v1", - }, - { - name: "Run Dagger Pipelines", - run: "fluentci run gleam_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 9c1d118..0000000 --- a/example/.fluentci/src/github/init.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { generateYaml } from "./config.ts"; - -generateYaml().save(".github/workflows/base.yml"); diff --git a/example/.fluentci/src/gitlab/README.md b/example/.fluentci/src/gitlab/README.md deleted file mode 100644 index 311ce0f..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%2Fgleam_pipeline&query=%24.version)](https://pkg.fluentci.io/gleam_pipeline) -[![deno module](https://shield.deno.dev/x/gleam_pipeline)](https://deno.land/x/gleam_pipeline) -![deno compatibility](https://shield.deno.dev/deno/^1.34) -[![](https://img.shields.io/codecov/c/gh/fluent-ci-templates/gleam-pipeline)](https://codecov.io/gh/fluent-ci-templates/gleam-pipeline) - -The following command will generate a `.gitlab-ci.yml` file in your project: - -```bash -fluentci gl init -t gleam_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 gleam_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 cfd4cdc..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.8.1 sh - mv bin/dagger /usr/local/bin - dagger version - ` - ); - - const tests = new Job() - .extends(".dagger") - .script("fluentci run gleam_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 a53a94b..87cbd92 100644 --- a/example/.fluentci/src/dagger/lib.ts +++ b/example/.fluentci/src/helpers.ts @@ -1,4 +1,4 @@ -import { dag, Directory, DirectoryID } from "../../deps.ts"; +import { dag, Directory, type DirectoryID } 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 91% rename from example/.fluentci/src/dagger/jobs.ts rename to example/.fluentci/src/jobs.ts index fe54afb..e496893 100644 --- a/example/.fluentci/src/dagger/jobs.ts +++ b/example/.fluentci/src/jobs.ts @@ -2,8 +2,8 @@ * @module gleam * @description This module provides functions for Gleam projects */ -import { Directory, dag } from "../../deps.ts"; -import { getDirectory } from "./lib.ts"; +import { type Directory, dag } from "../deps.ts"; +import { getDirectory } from "./helpers.ts"; export enum Job { check = "check", @@ -32,7 +32,7 @@ export async function check( .from("pkgxdev/pkgx:latest") .withExec(["apt-get", "update"]) .withExec(["apt-get", "install", "-y", "ca-certificates"]) - .withExec(["pkgx", "install", "gleam", "escript"]) + .withExec(["pkgx", "install", "gleam", "escript", "rebar3"]) .withMountedCache("/app/build", dag.cacheVolume("gleam-build")) .withDirectory("/app", context, { exclude }) .withWorkdir("/app") @@ -60,7 +60,7 @@ export async function format( .from("pkgxdev/pkgx:latest") .withExec(["apt-get", "update"]) .withExec(["apt-get", "install", "-y", "ca-certificates"]) - .withExec(["pkgx", "install", "gleam", "escript"]) + .withExec(["pkgx", "install", "gleam", "escript", "rebar3"]) .withMountedCache("/app/build", dag.cacheVolume("gleam-build")) .withDirectory("/app", context, { exclude }) .withWorkdir("/app") @@ -89,7 +89,7 @@ export async function test( .from("pkgxdev/pkgx:latest") .withExec(["apt-get", "update"]) .withExec(["apt-get", "install", "-y", "ca-certificates"]) - .withExec(["pkgx", "install", "gleam", "escript"]) + .withExec(["pkgx", "install", "gleam", "escript", "rebar3"]) .withMountedCache("/app/build", dag.cacheVolume("gleam-build")) .withDirectory("/app", context, { exclude }) .withWorkdir("/app") @@ -117,7 +117,7 @@ export async function build( .from("pkgxdev/pkgx:latest") .withExec(["apt-get", "update"]) .withExec(["apt-get", "install", "-y", "ca-certificates"]) - .withExec(["pkgx", "install", "gleam", "escript"]) + .withExec(["pkgx", "install", "gleam", "escript", "rebar3"]) .withMountedCache("/app/build", dag.cacheVolume("gleam-build")) .withDirectory("/app", context, { exclude }) .withWorkdir("/app") diff --git a/example/.fluentci/src/dagger/index.ts b/example/.fluentci/src/mod.ts similarity index 100% rename from example/.fluentci/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 0b4560a..32edcbf 100644 --- a/fluentci.toml +++ b/fluentci.toml @@ -5,4 +5,4 @@ authors = [ description = "CI/CD Plugin for Gleam" license = "MIT" name = "gleam" -version = "0.8.0" +version = "0.8.1" 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.lock b/plugin/Cargo.lock index b37822f..445ecc2 100644 --- a/plugin/Cargo.lock +++ b/plugin/Cargo.lock @@ -144,7 +144,7 @@ dependencies = [ [[package]] name = "gleam" -version = "0.8.0" +version = "0.8.1" dependencies = [ "extism-pdk", "fluentci-pdk", diff --git a/plugin/Cargo.toml b/plugin/Cargo.toml index 07526f6..084adb7 100644 --- a/plugin/Cargo.toml +++ b/plugin/Cargo.toml @@ -1,7 +1,7 @@ [package] edition = "2021" name = "gleam" -version = "0.8.0" +version = "0.8.1" [lib] crate-type = ["cdylib"] diff --git a/plugin/src/lib.rs b/plugin/src/lib.rs index 54dda74..b7c843e 100644 --- a/plugin/src/lib.rs +++ b/plugin/src/lib.rs @@ -6,7 +6,7 @@ pub fn check(args: String) -> FnResult { let stdout = dag() .pipeline("check")? .pkgx()? - .with_packages(vec!["gleam", "escript"])? + .with_packages(vec!["gleam", "escript", "rebar3"])? .with_exec(vec!["gleam", "deps", "download"])? .with_exec(vec!["gleam", "check", &args])? .stdout()?; @@ -18,7 +18,7 @@ pub fn format(args: String) -> FnResult { let stdout = dag() .pipeline("format")? .pkgx()? - .with_packages(vec!["gleam", "escript"])? + .with_packages(vec!["gleam", "escript", "rebar3"])? .with_exec(vec!["gleam", "deps", "download"])? .with_exec(vec!["gleam", "format", "--check", &args])? .stdout()?; @@ -30,7 +30,7 @@ pub fn test(args: String) -> FnResult { let stdout = dag() .pipeline("test")? .pkgx()? - .with_packages(vec!["gleam", "escript"])? + .with_packages(vec!["gleam", "escript", "rebar3"])? .with_exec(vec!["gleam", "deps", "download"])? .with_exec(vec!["gleam", "test", &args])? .stdout()?; @@ -42,7 +42,7 @@ pub fn build(args: String) -> FnResult { let stdout = dag() .pipeline("build")? .pkgx()? - .with_packages(vec!["gleam", "escript"])? + .with_packages(vec!["gleam", "escript", "rebar3"])? .with_exec(vec!["gleam", "deps", "download"])? .with_exec(vec!["gleam", "build", &args])? .stdout()?; diff --git a/src/aws/README.md b/src/aws/README.md deleted file mode 100644 index 65aada6..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%2Fgleam_pipeline&query=%24.version)](https://pkg.fluentci.io/gleam_pipeline) -[![deno module](https://shield.deno.dev/x/gleam_pipeline)](https://deno.land/x/gleam_pipeline) -![deno compatibility](https://shield.deno.dev/deno/^1.34) -[![](https://img.shields.io/codecov/c/gh/fluent-ci-templates/gleam-pipeline)](https://codecov.io/gh/fluent-ci-templates/gleam-pipeline) - -The following command will generate a `buildspec.yml` file in your project: - -```bash -fluentci ac init -t gleam_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 gleam_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 0cfa61b..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 The generated BuildSpec object. - */ -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.8.1 sh", - "mv bin/dagger /usr/local/bin", - "dagger version", - ], - }) - .phase("build", { - commands: ["fluentci run gleam_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 edb33b7..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%2Fgleam_pipeline&query=%24.version)](https://pkg.fluentci.io/gleam_pipeline) -[![deno module](https://shield.deno.dev/x/gleam_pipeline)](https://deno.land/x/gleam_pipeline) -![deno compatibility](https://shield.deno.dev/deno/^1.34) -[![](https://img.shields.io/codecov/c/gh/fluent-ci-templates/gleam-pipeline)](https://codecov.io/gh/fluent-ci-templates/gleam-pipeline) - -The following command will generate a `azure-pipelines.yml` file in your project: - -```bash -fluentci ap init -t gleam_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: ugleamtu-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 gleam_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 b8e0776..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.8.1 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 gleam_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 71ad6ff..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%2Fgleam_pipeline&query=%24.version)](https://pkg.fluentci.io/gleam_pipeline) -[![deno module](https://shield.deno.dev/x/gleam_pipeline)](https://deno.land/x/gleam_pipeline) -![deno compatibility](https://shield.deno.dev/deno/^1.34) -[![](https://img.shields.io/codecov/c/gh/fluent-ci-templates/gleam-pipeline)](https://codecov.io/gh/fluent-ci-templates/gleam-pipeline) - - -The following command will generate a `.circleci/config.yml` file in your project: - -```bash -fluentci cci init -t gleam_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 gleam_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 afe3a6a..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 tests = 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.8.1 sh -sudo mv bin/dagger /usr/local/bin -dagger version`, - }, - { - run: { - name: "Run Dagger Pipelines", - command: "fluentci run gleam_pipeline", - }, - }, - ]); - - circleci.jobs({ tests }).workflow("dagger", ["tests"]); - - 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 3108099..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("gleam_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 5060502..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%2Fgleam_pipeline&query=%24.version)](https://pkg.fluentci.io/gleam_pipeline) -[![deno module](https://shield.deno.dev/x/gleam_pipeline)](https://deno.land/x/gleam_pipeline) -![deno compatibility](https://shield.deno.dev/deno/^1.34) -[![](https://img.shields.io/codecov/c/gh/fluent-ci-templates/gleam-pipeline)](https://codecov.io/gh/fluent-ci-templates/gleam-pipeline) - -The following command will generate a `.github/workflows/workflow.yml` file in your project: - -```bash -fluentci gh init -t gleam_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 gleam_pipeline - -``` - -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 1be4ce2..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@v1", - }, - { - name: "Run Dagger Pipelines", - run: "fluentci run gleam_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 9c1d118..0000000 --- a/src/github/init.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { generateYaml } from "./config.ts"; - -generateYaml().save(".github/workflows/base.yml"); diff --git a/src/gitlab/README.md b/src/gitlab/README.md deleted file mode 100644 index 311ce0f..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%2Fgleam_pipeline&query=%24.version)](https://pkg.fluentci.io/gleam_pipeline) -[![deno module](https://shield.deno.dev/x/gleam_pipeline)](https://deno.land/x/gleam_pipeline) -![deno compatibility](https://shield.deno.dev/deno/^1.34) -[![](https://img.shields.io/codecov/c/gh/fluent-ci-templates/gleam-pipeline)](https://codecov.io/gh/fluent-ci-templates/gleam-pipeline) - -The following command will generate a `.gitlab-ci.yml` file in your project: - -```bash -fluentci gl init -t gleam_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 gleam_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 cfd4cdc..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.8.1 sh - mv bin/dagger /usr/local/bin - dagger version - ` - ); - - const tests = new Job() - .extends(".dagger") - .script("fluentci run gleam_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 a53a94b..87cbd92 100644 --- a/src/dagger/lib.ts +++ b/src/helpers.ts @@ -1,4 +1,4 @@ -import { dag, Directory, DirectoryID } from "../../deps.ts"; +import { dag, Directory, type DirectoryID } from "../deps.ts"; export const getDirectory = async ( src: string | Directory | undefined = "." diff --git a/src/dagger/jobs.ts b/src/jobs.ts similarity index 91% rename from src/dagger/jobs.ts rename to src/jobs.ts index fe54afb..e496893 100644 --- a/src/dagger/jobs.ts +++ b/src/jobs.ts @@ -2,8 +2,8 @@ * @module gleam * @description This module provides functions for Gleam projects */ -import { Directory, dag } from "../../deps.ts"; -import { getDirectory } from "./lib.ts"; +import { type Directory, dag } from "../deps.ts"; +import { getDirectory } from "./helpers.ts"; export enum Job { check = "check", @@ -32,7 +32,7 @@ export async function check( .from("pkgxdev/pkgx:latest") .withExec(["apt-get", "update"]) .withExec(["apt-get", "install", "-y", "ca-certificates"]) - .withExec(["pkgx", "install", "gleam", "escript"]) + .withExec(["pkgx", "install", "gleam", "escript", "rebar3"]) .withMountedCache("/app/build", dag.cacheVolume("gleam-build")) .withDirectory("/app", context, { exclude }) .withWorkdir("/app") @@ -60,7 +60,7 @@ export async function format( .from("pkgxdev/pkgx:latest") .withExec(["apt-get", "update"]) .withExec(["apt-get", "install", "-y", "ca-certificates"]) - .withExec(["pkgx", "install", "gleam", "escript"]) + .withExec(["pkgx", "install", "gleam", "escript", "rebar3"]) .withMountedCache("/app/build", dag.cacheVolume("gleam-build")) .withDirectory("/app", context, { exclude }) .withWorkdir("/app") @@ -89,7 +89,7 @@ export async function test( .from("pkgxdev/pkgx:latest") .withExec(["apt-get", "update"]) .withExec(["apt-get", "install", "-y", "ca-certificates"]) - .withExec(["pkgx", "install", "gleam", "escript"]) + .withExec(["pkgx", "install", "gleam", "escript", "rebar3"]) .withMountedCache("/app/build", dag.cacheVolume("gleam-build")) .withDirectory("/app", context, { exclude }) .withWorkdir("/app") @@ -117,7 +117,7 @@ export async function build( .from("pkgxdev/pkgx:latest") .withExec(["apt-get", "update"]) .withExec(["apt-get", "install", "-y", "ca-certificates"]) - .withExec(["pkgx", "install", "gleam", "escript"]) + .withExec(["pkgx", "install", "gleam", "escript", "rebar3"]) .withMountedCache("/app/build", dag.cacheVolume("gleam-build")) .withDirectory("/app", context, { exclude }) .withWorkdir("/app") diff --git a/src/dagger/index.ts b/src/mod.ts similarity index 100% rename from src/dagger/index.ts rename to src/mod.ts 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());