diff --git a/example/.fluentci/.fluentci/.devcontainer/devcontainer.json b/example/.fluentci/.fluentci/.devcontainer/devcontainer.json new file mode 100644 index 0000000..39a38ae --- /dev/null +++ b/example/.fluentci/.fluentci/.devcontainer/devcontainer.json @@ -0,0 +1,25 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/debian +{ + "name": "Debian", + // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile + "image": "mcr.microsoft.com/devcontainers/base:bullseye", + "features": { + "ghcr.io/devcontainers/features/github-cli:1": {}, + "ghcr.io/devcontainers/features/nix:1": {} + }, + + // Features to add to the dev container. More info: https://containers.dev/features. + // "features": {}, + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], + + // Use 'postCreateCommand' to run commands after the container is created. + "postCreateCommand": "nix develop --experimental-features \"nix-command flakes\"" + // Configure tool-specific properties. + // "customizations": {}, + + // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. + // "remoteUser": "root" +} diff --git a/example/.fluentci/.fluentci/.fluentci/.devcontainer/devcontainer.json b/example/.fluentci/.fluentci/.fluentci/.devcontainer/devcontainer.json new file mode 100644 index 0000000..39a38ae --- /dev/null +++ b/example/.fluentci/.fluentci/.fluentci/.devcontainer/devcontainer.json @@ -0,0 +1,25 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/debian +{ + "name": "Debian", + // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile + "image": "mcr.microsoft.com/devcontainers/base:bullseye", + "features": { + "ghcr.io/devcontainers/features/github-cli:1": {}, + "ghcr.io/devcontainers/features/nix:1": {} + }, + + // Features to add to the dev container. More info: https://containers.dev/features. + // "features": {}, + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], + + // Use 'postCreateCommand' to run commands after the container is created. + "postCreateCommand": "nix develop --experimental-features \"nix-command flakes\"" + // Configure tool-specific properties. + // "customizations": {}, + + // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. + // "remoteUser": "root" +} diff --git a/example/.fluentci/.fluentci/.fluentci/.github/workflows/ci.yml b/example/.fluentci/.fluentci/.fluentci/.github/workflows/ci.yml new file mode 100644 index 0000000..3ac7dd7 --- /dev/null +++ b/example/.fluentci/.fluentci/.fluentci/.github/workflows/ci.yml @@ -0,0 +1,28 @@ +name: Codecov + +# Controls when the action will run. Triggers the workflow on push or pull request +# events but only for the master branch +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: denolib/setup-deno@v2 + with: + deno-version: v1.34 + - name: Create coverage files + run: deno test --allow-read --coverage=coverage --lock-write # create coverage files + - name: Create coverage report + run: deno coverage ./coverage --lcov > coverage.lcov # create coverage report + - name: Collect coverage + uses: codecov/codecov-action@v3 # upload the report on Codecov + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + with: + file: ./coverage.lcov diff --git a/example/.fluentci/.fluentci/.fluentci/.vscode/settings.json b/example/.fluentci/.fluentci/.fluentci/.vscode/settings.json new file mode 100644 index 0000000..cbac569 --- /dev/null +++ b/example/.fluentci/.fluentci/.fluentci/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "deno.enable": true +} diff --git a/example/.fluentci/.fluentci/.fluentci/CODE_OF_CONDUCT.md b/example/.fluentci/.fluentci/.fluentci/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..e9c20f9 --- /dev/null +++ b/example/.fluentci/.fluentci/.fluentci/CODE_OF_CONDUCT.md @@ -0,0 +1,132 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +We as members, contributors, and leaders pledge to make participation in our +community a harassment-free experience for everyone, regardless of age, body +size, visible or invisible disability, ethnicity, sex characteristics, gender +identity and expression, level of experience, education, socio-economic status, +nationality, personal appearance, race, caste, color, religion, or sexual +identity and orientation. + +We pledge to act and interact in ways that contribute to an open, welcoming, +diverse, inclusive, and healthy community. + +## Our Standards + +Examples of behavior that contributes to a positive environment for our +community include: + +- Demonstrating empathy and kindness toward other people +- Being respectful of differing opinions, viewpoints, and experiences +- Giving and gracefully accepting constructive feedback +- Accepting responsibility and apologizing to those affected by our mistakes, + and learning from the experience +- Focusing on what is best not just for us as individuals, but for the overall + community + +Examples of unacceptable behavior include: + +- The use of sexualized language or imagery, and sexual attention or advances of + any kind +- Trolling, insulting or derogatory comments, and personal or political attacks +- Public or private harassment +- Publishing others' private information, such as a physical or email address, + without their explicit permission +- Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Enforcement Responsibilities + +Community leaders are responsible for clarifying and enforcing our standards of +acceptable behavior and will take appropriate and fair corrective action in +response to any behavior that they deem inappropriate, threatening, offensive, +or harmful. + +Community leaders have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions that are +not aligned to this Code of Conduct, and will communicate reasons for moderation +decisions when appropriate. + +## Scope + +This Code of Conduct applies within all community spaces, and also applies when +an individual is officially representing the community in public spaces. +Examples of representing our community include using an official e-mail address, +posting via an official social media account, or acting as an appointed +representative at an online or offline event. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported to the community leaders responsible for enforcement at +[GitHub Issues](https://github.com/fluent-ci-templates/deno-pipeline/issues). +All complaints will be reviewed and investigated promptly and fairly. + +All community leaders are obligated to respect the privacy and security of the +reporter of any incident. + +## Enforcement Guidelines + +Community leaders will follow these Community Impact Guidelines in determining +the consequences for any action they deem in violation of this Code of Conduct: + +### 1. Correction + +**Community Impact**: Use of inappropriate language or other behavior deemed +unprofessional or unwelcome in the community. + +**Consequence**: A private, written warning from community leaders, providing +clarity around the nature of the violation and an explanation of why the +behavior was inappropriate. A public apology may be requested. + +### 2. Warning + +**Community Impact**: A violation through a single incident or series of +actions. + +**Consequence**: A warning with consequences for continued behavior. No +interaction with the people involved, including unsolicited interaction with +those enforcing the Code of Conduct, for a specified period of time. This +includes avoiding interactions in community spaces as well as external channels +like social media. Violating these terms may lead to a temporary or permanent +ban. + +### 3. Temporary Ban + +**Community Impact**: A serious violation of community standards, including +sustained inappropriate behavior. + +**Consequence**: A temporary ban from any sort of interaction or public +communication with the community for a specified period of time. No public or +private interaction with the people involved, including unsolicited interaction +with those enforcing the Code of Conduct, is allowed during this period. +Violating these terms may lead to a permanent ban. + +### 4. Permanent Ban + +**Community Impact**: Demonstrating a pattern of violation of community +standards, including sustained inappropriate behavior, harassment of an +individual, or aggression toward or disparagement of classes of individuals. + +**Consequence**: A permanent ban from any sort of public interaction within the +community. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], +version 2.1, available at +[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1]. + +Community Impact Guidelines were inspired by +[Mozilla's code of conduct enforcement ladder][Mozilla CoC]. + +For answers to common questions about this code of conduct, see the FAQ at +[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at +[https://www.contributor-covenant.org/translations][translations]. + +[homepage]: https://www.contributor-covenant.org +[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html +[Mozilla CoC]: https://github.com/mozilla/diversity +[FAQ]: https://www.contributor-covenant.org/faq +[translations]: https://www.contributor-covenant.org/translations diff --git a/example/.fluentci/.fluentci/.fluentci/CONTRIBUTING.md b/example/.fluentci/.fluentci/.fluentci/CONTRIBUTING.md new file mode 100644 index 0000000..e50de72 --- /dev/null +++ b/example/.fluentci/.fluentci/.fluentci/CONTRIBUTING.md @@ -0,0 +1,70 @@ +# Contributing Guidelines + +Thank you for your interest in contributing to our project. Whether it's a bug +report, new feature, correction, or additional documentation, we greatly value +feedback and contributions from our community. + +Please read through this document before submitting any issues or pull requests +to ensure we have all the necessary information to effectively respond to your +bug report or contribution. + +## Reporting Bugs/Feature Requests + +We welcome you to use the GitHub issue tracker to report bugs or suggest +features. + +When filing an issue, please check existing open, or recently closed, issues to +make sure somebody else hasn't already reported the issue. Please try to include +as much information as you can. Details like these are incredibly useful: + +- A reproducible test case or series of steps +- The version of our code being used +- Any modifications you've made relevant to the bug +- Anything unusual about your environment or deployment + +## Contributing via Pull Requests + +Contributions via pull requests are much appreciated. Before sending us a pull +request, please ensure that: + +1. You are working against the latest source on the _master_ branch. +2. You check existing open, and recently merged, pull requests to make sure + someone else hasn't addressed the problem already. +3. You open an issue to discuss any significant work - we would hate for your + time to be wasted. + +To send us a pull request, please: + +1. Fork the repository. +2. Modify the source; please focus on the specific change you are contributing. + If you also reformat all the code, it will be hard for us to focus on your + change. +3. Ensure local tests pass. +4. Commit to your fork using clear commit messages. +5. Send us a pull request, answering any default questions in the pull request + interface. +6. Pay attention to any automated CI failures reported in the pull request, and + stay involved in the conversation. + +GitHub provides additional document on +[forking a repository](https://help.github.com/articles/fork-a-repo/) and +[creating a pull request](https://help.github.com/articles/creating-a-pull-request/). + +## Finding contributions to work on + +Looking at the existing issues is a great way to find something to contribute +on. As our projects, by default, use the default GitHub issue labels +(enhancement/bug/duplicate/help wanted/invalid/question/wontfix), looking at any +'help wanted' issues is a great place to start. + +## Code of Conduct + +This project has adopted the +[Contributor Covenant](https://www.contributor-covenant.org/), version 2.1, +available at +https://www.contributor-covenant.org/version/2/1/code_of_conduct.html. + +## Licensing + +See the [LICENSE](LICENSE) file for our project's licensing. We will ask you to +confirm the licensing of your contribution. diff --git a/example/.fluentci/.fluentci/.fluentci/LICENSE b/example/.fluentci/.fluentci/.fluentci/LICENSE new file mode 100644 index 0000000..d9ab36a --- /dev/null +++ b/example/.fluentci/.fluentci/.fluentci/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2023 Tsiry Sandratraina + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/example/.fluentci/.fluentci/.fluentci/README.md b/example/.fluentci/.fluentci/.fluentci/README.md new file mode 100644 index 0000000..23f6a94 --- /dev/null +++ b/example/.fluentci/.fluentci/.fluentci/README.md @@ -0,0 +1,88 @@ +# Deno Pipeline + +[![deno module](https://shield.deno.dev/x/deno_pipeline)](https://deno.land/x/deno_pipeline) +![deno compatibility](https://shield.deno.dev/deno/^1.34) +[![](https://img.shields.io/codecov/c/gh/fluent-ci-templates/deno-pipeline)](https://codecov.io/gh/fluent-ci-templates/deno-pipeline) + +A ready-to-use GitLab CI Pipeline and Jobs for your Deno projects. + +## ๐Ÿš€ Usage + +Quick start: + +```ts +import { GitLab } from "https://deno.land/x/deno_pipeline/mod.ts"; + +const { pipeline } = GitLab; + +pipeline.write(); // Write the pipeline to the file .gitlab-ci.yml +``` + +Or, if you want to use the predefined jobs: + +```ts +import { GitlabCI } from "https://deno.land/x/fluent_gitlab_ci/mod.ts"; +import { GitLab } from "https://deno.land/x/deno_pipeline/mod.ts"; + +const { fmt, lint, test } = GitLab; + +const const pipeline = new GitlabCI() + .image("denoland/deno:alpine") + .addJob("fmt", fmt) + .addJob("lint", lint) + .addJob("test", test); + +pipeline.write(); // Write the pipeline to the file .gitlab-ci.yml +``` + +It will generate the following `.gitlab-ci.yml` file: + +```yaml +# Do not edit this file directly. It is generated by Fluent GitLab CI + +image: denoland/deno:alpine + +fmt: + image: denoland/deno:alpine + script: + - deno fmt --check + +lint: + image: denoland/deno:alpine + script: + - deno lint + +test: + image: denoland/deno:alpine + script: + - deno test +``` + +## ๐Ÿงช Advanced Usage + +This package also provides a ready-to-use pipeline for +[Dagger](https://dagger.io/), just run the following command on your Deno +project: + +```sh +dagger run deno run -A https://deno.land/x/deno_pipeline/ci.ts +``` + +Or, if you want to use the predefined jobs: + +```ts +import Client, { connect } from "@dagger.io/dagger"; +import { Dagger } from "https://deno.land/x/deno_pipeline/mod.ts"; + +const { fmt, lint, test } = Dagger; + +function pipeline(src = ".") { + connect(async (client: Client) => { + await fmt(client, src); + await lint(client, src); + await test(client, src); + }); +} + +pipeline(); +``` diff --git a/example/.fluentci/.fluentci/.fluentci/ci.ts b/example/.fluentci/.fluentci/.fluentci/ci.ts new file mode 100644 index 0000000..67e5a80 --- /dev/null +++ b/example/.fluentci/.fluentci/.fluentci/ci.ts @@ -0,0 +1,12 @@ +const command = new Deno.Command(Deno.execPath(), { + args: [ + "run", + "-A", + "--import-map=https://deno.land/x/deno_pipeline/import_map.json", + "https://deno.land/x/deno_pipeline/src/dagger/runner.ts", + ], +}); + +const { stdout } = await command.output(); + +console.log(new TextDecoder().decode(stdout)); diff --git a/example/.fluentci/.fluentci/.fluentci/deno.json b/example/.fluentci/.fluentci/.fluentci/deno.json new file mode 100644 index 0000000..4240219 --- /dev/null +++ b/example/.fluentci/.fluentci/.fluentci/deno.json @@ -0,0 +1,9 @@ +{ + "importMap": "import_map.json", + "tasks": { + "esm:add": "deno run -A https://esm.sh/v128 add", + "esm:update": "deno run -A https://esm.sh/v128 update", + "esm:remove": "deno run -A https://esm.sh/v128 remove", + "ci:dagger": "dagger run deno run -A src/dagger/runner.ts" + } +} diff --git a/example/.fluentci/.fluentci/.fluentci/deno.lock b/example/.fluentci/.fluentci/.fluentci/deno.lock new file mode 100644 index 0000000..a364136 --- /dev/null +++ b/example/.fluentci/.fluentci/.fluentci/deno.lock @@ -0,0 +1,68 @@ +{ + "version": "2", + "remote": { + "https://deno.land/std@0.150.0/media_types/_util.ts": "ce9b4fc4ba1c447dafab619055e20fd88236ca6bdd7834a21f98bd193c3fbfa1", + "https://deno.land/std@0.150.0/media_types/mod.ts": "2d4b6f32a087029272dc59e0a55ae3cc4d1b27b794ccf528e94b1925795b3118", + "https://deno.land/std@0.150.0/media_types/vendor/mime-db.v1.52.0.ts": "724cee25fa40f1a52d3937d6b4fbbfdd7791ff55e1b7ac08d9319d5632c7f5af", + "https://deno.land/std@0.191.0/fmt/colors.ts": "d67e3cd9f472535241a8e410d33423980bec45047e343577554d3356e1f0ef4e", + "https://deno.land/x/codecov_pipeline@v0.1.0/src/dagger/jobs.ts": "e980479e0bcd759773286145f3345ce7e1662c7d6734bfc4bbf8e6bfc93b974e", + "https://deno.land/x/nix_installer_pipeline@v0.3.6/src/dagger/steps.ts": "a34aea3753c7079de5877f592ce31f30d05d552155729ff3e695d77326405133", + "https://deno.land/x/xhr@0.3.0/mod.ts": "094aacd627fd9635cd942053bf8032b5223b909858fa9dc8ffa583752ff63b20", + "https://esm.sh/stringify-tree@1.1.1": "8d994a105481fa944515323d89bd2596c1de79f3d9bd1386266463934716eca0", + "https://esm.sh/v128/*@dagger.io/dagger@0.6.3": "cb691a77c0cdaee22f2b8393731b5143c83ce22dbbea204cdbfd203768d15b64", + "https://esm.sh/v128/@dagger.io/dagger@0.6.3/X-ZS8q/denonext/dagger.mjs": "fd0901784d75b99615b5409c3654b5c7edfc5ba377c9e1a5a67ffff4f7d3ac32", + "https://esm.sh/v128/adm-zip@0.5.10": "d9c54d6d2dd788462781a57d923295bd79304e6fd74b242fd4b30e35b39c5dcf", + "https://esm.sh/v128/adm-zip@0.5.10/denonext/adm-zip.mjs": "07a9731547905e0ca55ae917e1969d7f6d04fb3773f906ce3306891337eb4849", + "https://esm.sh/v128/chownr@2.0.0/denonext/chownr.mjs": "30b8f17084dfbe475a5052b615f706b06ddd17dca0535103340d485c6b94e952", + "https://esm.sh/v128/cross-fetch@3.1.8/denonext/cross-fetch.mjs": "8fba9e7c3fbaf0d2168beb63ce0cd21b5bfbfbd77e2fcbf8d957d533a71222f6", + "https://esm.sh/v128/cross-spawn@7.0.3/denonext/cross-spawn.mjs": "0569a26e7ad4b3376516cbc9b1942e10961a58030eadcea8c848e6b956eb355c", + "https://esm.sh/v128/data-uri-to-buffer@4.0.1/denonext/data-uri-to-buffer.mjs": "70ef987b1da58391495ecfad9888d996469224faf3cd996d81dc2e059feb9f31", + "https://esm.sh/v128/env-paths@3.0.0": "8400fb23319be9b30d7b40d1c865541c5b3c7726cdf9b74000bc0f1678d52ecf", + "https://esm.sh/v128/env-paths@3.0.0/denonext/env-paths.mjs": "77984a05eb16450087f25060a070ed500ec546719d471143e16d976ca73ca956", + "https://esm.sh/v128/execa@7.1.1": "a40c7030df81ab0847a5d844f4c5c6420af973dff05fef88e53cbb9b8667fdc2", + "https://esm.sh/v128/execa@7.1.1/denonext/execa.mjs": "9d5943544c0df3761b52f2c095f89a03ca6c028d818a8f0475ff883b0408f154", + "https://esm.sh/v128/fetch-blob@3.2.0/denonext/fetch-blob.mjs": "0531568b36c0f6db3e9825fbb2d08dee51100eb675c2bf1d98d6971a92010721", + "https://esm.sh/v128/fetch-blob@3.2.0/denonext/file.js": "fd82828163a4e7bdc15190d8c3dbfd92f93274d05bd7f7f5ab81093e3ad7e9c2", + "https://esm.sh/v128/fetch-blob@3.2.0/denonext/from.js": "7d3258c7960755497f90879806f0b815d5e564c2ac1523238af5cb9552ff5c45", + "https://esm.sh/v128/formdata-polyfill@4.0.10/denonext/esm.min.js": "b6d65a204e81eca699d9eb6f867e9efffa42db39a8f161690915a89e5eb1766f", + "https://esm.sh/v128/fs-minipass@2.1.0/denonext/fs-minipass.mjs": "74b00283d556b281bdfd6a669576d852f2c43702043c411985f8f8188d208c5d", + "https://esm.sh/v128/get-stream@6.0.1/denonext/get-stream.mjs": "a947a16f8cb3052fd654a84f8b36b40ce96b6a5acfb3ad4ab69d814bcf3351fb", + "https://esm.sh/v128/graphql-request@6.1.0": "17f00c323eb825811ce14e2b0e88a0c873acb666c382ac963d1edeb03e01f372", + "https://esm.sh/v128/graphql-request@6.1.0/denonext/graphql-request.mjs": "0b15f49d44489423ae6f06004725b6d050b6359da4969e6569bd6ad45065bd94", + "https://esm.sh/v128/graphql-tag@2.12.6": "5bfa27da9c9918fb52a01b8579891e804e0365d91118df1f2e0957a72dacdc39", + "https://esm.sh/v128/graphql-tag@2.12.6/denonext/graphql-tag.mjs": "331d09949efc4ac60c84a69b52a7da8b333210493900e54953ae4604c9874527", + "https://esm.sh/v128/graphql@16.7.1/denonext/graphql.mjs": "418ad7c07b0f2d687f33b6275d3b5f317f4afbef1f462f318229f458dff45416", + "https://esm.sh/v128/human-signals@4.3.1/denonext/human-signals.mjs": "3889110cedd907804443d018cffe0a1d892d5e7467661376caf967feff55cbe9", + "https://esm.sh/v128/is-stream@3.0.0/denonext/is-stream.mjs": "5c8b65f2fa051c4b18e88bbae11dac8bba9caf57752577d69bcea86d1f05c5b7", + "https://esm.sh/v128/isexe@2.0.0/denonext/isexe.mjs": "3cfefd270d1bfdfb864ee98dbb8f41d150cbf480925158f4a8f0ade8a9e17d6c", + "https://esm.sh/v128/merge-stream@2.0.0/denonext/merge-stream.mjs": "2c2af22401c294158d6bff659d157e3d2c028c218cc1bd2246534a45a4c03c61", + "https://esm.sh/v128/mimic-fn@4.0.0/denonext/mimic-fn.mjs": "10bcf0f2f20cbbba0c289ef7bf4d2422639bbc1c36c247be876afd6fe2d67138", + "https://esm.sh/v128/minipass@3.3.6/denonext/minipass.mjs": "59bbe430514455e78cb30c389b21af66efb2bf010cda071820a17d8c76d0d1cf", + "https://esm.sh/v128/minipass@5.0.0/denonext/minipass.mjs": "de0e049728f8c387b58c86439eb9d69a16b6a88756a6bc694e2fecbd7fd00401", + "https://esm.sh/v128/minizlib@2.1.2/denonext/minizlib.mjs": "0d919b6a0c60d5a31e14d748ff9d62aeae2923b604bcc6a22f90fa4bbd400d68", + "https://esm.sh/v128/mkdirp@1.0.4/denonext/mkdirp.mjs": "ee129b32e55dd8bede6b1bbd1978f7775fa5e2720d5a7ae07bf1e8c99abd77c7", + "https://esm.sh/v128/node-color-log@10.0.2": "05a277987c64153af1252167135076155fdc6b39ca260b2bdc39750da12d2a2d", + "https://esm.sh/v128/node-color-log@10.0.2/denonext/node-color-log.mjs": "2504391bd0ce1dd4c2bf0ed0b839b8a3ad84c028d9dd17cc58dccd2e14dacfde", + "https://esm.sh/v128/node-domexception@1.0.0/denonext/node-domexception.mjs": "bb35ba54c1a2b35870618876c0c96310a28ae58aecff33c8eed58a582e270ff4", + "https://esm.sh/v128/node-fetch@3.3.1": "916dcee177a69fb0e46970c528cb66fcd4973488f861844c0a235bfc645b0506", + "https://esm.sh/v128/node-fetch@3.3.1/denonext/node-fetch.mjs": "dc3a8f1f2fc9eb26d0d33e49f3750acc265d51a1a54bbd670c5d9f640b633a93", + "https://esm.sh/v128/node-fetch@3.3.1/denonext/src/utils/multipart-parser.js": "713b1b8cbafc4bfb7358debeb35d507e0d2328f0a28b8a2a7d79a3e5e4f5e5b8", + "https://esm.sh/v128/npm-run-path@5.1.0/denonext/npm-run-path.mjs": "3540b8c2dd1430f10d580f323f3a51aa30094da27a9220cce03ce69884b163bb", + "https://esm.sh/v128/onetime@6.0.0/denonext/onetime.mjs": "6e362222575d815f37fb813168d7069dd6a0f6bb6f972ed54d1bccb0f9fb3e1b", + "https://esm.sh/v128/original-fs@1.2.0/denonext/original-fs.mjs": "2b1098818e54d2c6748ff5b0dd9ea5f6a61b4b6d0f63fb625f21773d11cfc667", + "https://esm.sh/v128/path-key@3.1.1/denonext/path-key.mjs": "add83c631278b7df9b33ae84e41142db88bb291295bcc27eb4e77a1cbdfa71d0", + "https://esm.sh/v128/path-key@4.0.0/denonext/path-key.mjs": "2c2e3922bd0e6e414fa2752ff800bdc6b9208035ce797fa22e49b859f8259417", + "https://esm.sh/v128/shebang-command@2.0.0/denonext/shebang-command.mjs": "404e0fb09a782ca9495d53c721bb84b673b7b2e1054e021852143a6b91ca0e4f", + "https://esm.sh/v128/shebang-regex@3.0.0/denonext/shebang-regex.mjs": "03983ba59dd2cba9402935e21b46d05f5249364cba9f5757aef23c6c2fea65b9", + "https://esm.sh/v128/signal-exit@3.0.7/denonext/signal-exit.mjs": "2a176e5f9b351fa8057213c627a1503d63bf308b64447ef47f1ca6fbb2a91c81", + "https://esm.sh/v128/strip-final-newline@3.0.0/denonext/strip-final-newline.mjs": "03d9be4e8a249d63cbbddeb2fb675a1bbbcb335283e604d4ce56c88c90e6f102", + "https://esm.sh/v128/tar@6.1.15": "0460339f8aba5f287e8bebe258fe3fe13cb12f85820693f25724f0d98ef1258e", + "https://esm.sh/v128/tar@6.1.15/denonext/tar.mjs": "6194d892de8457b3b1f11d5cbacda1d540b453b45e8cb9f5f610abfb3e490b65", + "https://esm.sh/v128/tslib@2.6.0/denonext/tslib.mjs": "2215292e6fcf28a7a081eee911f127bb3c44cdd61ff0651e3e384d7a49b4e42b", + "https://esm.sh/v128/web-streams-polyfill@3.2.1/denonext/dist/ponyfill.es2018.js": "a2edb52a93494cda06386b3d6a168016b366e78f02c5eff1f94a0240be12ac96", + "https://esm.sh/v128/which@2.0.2/denonext/which.mjs": "86bf76e4937edb7fa3464d7bb9a426ef273684d1cefbec5ba5f1bdcb5cafff91", + "https://esm.sh/v128/yallist@4.0.0/denonext/yallist.mjs": "61f180d807dda50bac17028eda05d5722a3fecef6e98a9064e2353ea6864fd82", + "https://esm.sh/v130/lodash.flatten@4.4.0/denonext/lodash.flatten.mjs": "8e86ab607deea15cc3c1acfb5eae278ecbc5b80f24167b4e8f4c56df3278cd55", + "https://esm.sh/v130/stringify-tree@1.1.1/denonext/stringify-tree.mjs": "40a9d40e0282b5432302a3da68b88aa11685bc0b8a0b70246168deed5c5773fe" + } +} diff --git a/example/.fluentci/.fluentci/.fluentci/fixtures/.gitlab-ci.yml b/example/.fluentci/.fluentci/.fluentci/fixtures/.gitlab-ci.yml new file mode 100644 index 0000000..299e4c6 --- /dev/null +++ b/example/.fluentci/.fluentci/.fluentci/fixtures/.gitlab-ci.yml @@ -0,0 +1,19 @@ +# Do not edit this file directly. It is generated by Fluent GitLab CI + +image: denoland/deno:alpine + +fmt: + image: denoland/deno:alpine + script: + - deno fmt --check + +lint: + image: denoland/deno:alpine + script: + - deno lint + +test: + image: denoland/deno:alpine + script: + - deno test + diff --git a/example/.fluentci/.fluentci/.fluentci/flake.lock b/example/.fluentci/.fluentci/.fluentci/flake.lock new file mode 100644 index 0000000..af7453c --- /dev/null +++ b/example/.fluentci/.fluentci/.fluentci/flake.lock @@ -0,0 +1,61 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1687709756, + "narHash": "sha256-Y5wKlQSkgEK2weWdOu4J3riRd+kV/VCgHsqLNTTWQ/0=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "dbabf0ca0c0c4bce6ea5eaf65af5cb694d2082c7", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1688910226, + "narHash": "sha256-kLTsFu9CAU2Gb288JhIBN/WlX4UUUDz4WiC/U59nvwk=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "2540432a940aee979be6ccfefba9ea0652c273a0", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "release-23.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/example/.fluentci/.fluentci/.fluentci/flake.nix b/example/.fluentci/.fluentci/.fluentci/flake.nix new file mode 100644 index 0000000..b13ea7d --- /dev/null +++ b/example/.fluentci/.fluentci/.fluentci/flake.nix @@ -0,0 +1,26 @@ +{ + description = "A Nix-flake-based Deno development environment"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/release-23.05"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { + self, + nixpkgs, + flake-utils, + }: + flake-utils.lib.eachDefaultSystem + (system: let + pkgs = import nixpkgs { + inherit system; + }; + in { + devShells.default = pkgs.mkShell { + buildInputs = [ + pkgs.deno + ]; + }; + }); +} \ No newline at end of file diff --git a/example/.fluentci/.fluentci/.fluentci/import_map.json b/example/.fluentci/.fluentci/.fluentci/import_map.json new file mode 100644 index 0000000..12c59ff --- /dev/null +++ b/example/.fluentci/.fluentci/.fluentci/import_map.json @@ -0,0 +1,28 @@ +{ + "imports": { + "@dagger.io/dagger": "https://esm.sh/v128/*@dagger.io/dagger@0.6.3", + "fluent_gitlab_ci": "https://deno.land/x/fluent_gitlab_ci@v0.3.2/mod.ts", + "fluent_github_actions": "https://deno.land/x/fluent_github_actions@v0.1.2/mod.ts", + "url": "node:url", + "readline": "node:readline", + "process": "node:process", + "path": "node:path", + "os": "node:os", + "fs": "node:fs", + "crypto": "node:crypto" + }, + "scopes": { + "https://esm.sh/v128/": { + "@lifeomic/axios-fetch": "https://esm.sh/v128/@lifeomic/axios-fetch@3.0.1", + "adm-zip": "https://esm.sh/v128/adm-zip@0.5.10", + "env-paths": "https://esm.sh/v128/env-paths@3.0.0", + "execa": "https://esm.sh/v128/execa@7.1.1", + "graphql-request": "https://esm.sh/v128/graphql-request@6.1.0", + "graphql-tag": "https://esm.sh/v128/graphql-tag@2.12.6", + "graphql": "https://esm.sh/v128/graphql@16.7.1", + "node-color-log": "https://esm.sh/v128/node-color-log@10.0.2", + "node-fetch": "https://esm.sh/v128/node-fetch@3.3.1", + "tar": "https://esm.sh/v128/tar@6.1.15" + } + } +} \ No newline at end of file diff --git a/example/.fluentci/.fluentci/.fluentci/mod.ts b/example/.fluentci/.fluentci/.fluentci/mod.ts new file mode 100644 index 0000000..6152fb6 --- /dev/null +++ b/example/.fluentci/.fluentci/.fluentci/mod.ts @@ -0,0 +1,4 @@ +import * as GitLab from "./src/gitlab/index.ts"; +import * as Dagger from "./src/dagger/index.ts"; + +export { Dagger, GitLab }; diff --git a/example/.fluentci/.fluentci/.fluentci/src/dagger/index.ts b/example/.fluentci/.fluentci/.fluentci/src/dagger/index.ts new file mode 100644 index 0000000..392c001 --- /dev/null +++ b/example/.fluentci/.fluentci/.fluentci/src/dagger/index.ts @@ -0,0 +1,4 @@ +import pipeline from "./pipeline.ts"; +import { fmt, lint, test } from "./jobs.ts"; + +export { fmt, lint, pipeline, test }; diff --git a/example/.fluentci/.fluentci/.fluentci/src/dagger/jobs.ts b/example/.fluentci/.fluentci/.fluentci/src/dagger/jobs.ts new file mode 100644 index 0000000..658ed39 --- /dev/null +++ b/example/.fluentci/.fluentci/.fluentci/src/dagger/jobs.ts @@ -0,0 +1,197 @@ +import Client from "@dagger.io/dagger"; +import { upload } from "https://deno.land/x/codecov_pipeline@v0.1.0/src/dagger/jobs.ts"; +import { withDevbox } from "https://deno.land/x/nix_installer_pipeline@v0.3.6/src/dagger/steps.ts"; +import { existsSync } from "fs"; + +export enum Job { + fmt = "fmt", + lint = "lint", + test = "test", + deploy = "deploy", + codecov = "codecov", +} + +const baseCtr = (client: Client, pipeline: string) => { + if (existsSync("devbox.json")) { + return withDevbox( + client + .pipeline(pipeline) + .container() + .from("alpine:latest") + .withExec(["apk", "update"]) + .withExec(["apk", "add", "bash", "curl"]) + .withMountedCache("/nix", client.cacheVolume("nix")) + .withMountedCache("/etc/nix", client.cacheVolume("nix-etc")) + ); + } + return client.pipeline(pipeline).container().from("denoland/deno:alpine"); +}; + +export const lint = async (client: Client, src = ".") => { + const context = client.host().directory(src); + let command = ["deno", "lint"]; + + if (existsSync("devbox.json")) { + command = ["sh", "-c", `devbox run -- ${command.join(" ")}`]; + } + + const ctr = baseCtr(client, Job.lint) + .withDirectory("/app", context, { + exclude: [".git", ".devbox", ".fluentci"], + }) + .withWorkdir("/app") + .withExec(command); + + const result = await ctr.stdout(); + + console.log(result); +}; + +export const fmt = async (client: Client, src = ".") => { + const context = client.host().directory(src); + let command = ["deno", "fmt"]; + + if (existsSync("devbox.json")) { + command = ["sh", "-c", `devbox run -- ${command.join(" ")}`]; + } + + const ctr = baseCtr(client, Job.fmt) + .withDirectory("/app", context, { + exclude: [".git", ".devbox", ".fluentci"], + }) + .withWorkdir("/app") + .withExec(command); + + const result = await ctr.stdout(); + + console.log(result); +}; + +export const test = async ( + client: Client, + src = ".", + options: { ignore: string[] } = { ignore: [] } +) => { + const context = client.host().directory(src); + let command = ["deno", "test", "-A", "--coverage=coverage", "--lock-write"]; + + if (options.ignore.length > 0) { + command = command.concat([`--ignore=${options.ignore.join(",")}`]); + } + + if (existsSync("devbox.json")) { + command = ["sh", "-c", `devbox run -- ${command.join(" ")}`]; + } + + const ctr = baseCtr(client, Job.test) + .from("denoland/deno:alpine") + .withDirectory("/app", context, { + exclude: [".git", ".devbox", ".fluentci"], + }) + .withWorkdir("/app") + .withMountedCache("/root/.cache/deno", client.cacheVolume("deno-cache")) + .withExec(command) + .withExec(["sh", "-c", "deno coverage ./coverage --lcov > coverage.lcov"]); + + await ctr.file("/app/coverage.lcov").export("./coverage.lcov"); + + const result = await ctr.stdout(); + + console.log(result); +}; + +export const deploy = async (client: Client, src = ".") => { + const context = client.host().directory(src); + let installDeployCtl = [ + "deno", + "install", + "--allow-all", + "--no-check", + "-r", + "-f", + "https://deno.land/x/deploy/deployctl.ts", + ]; + const project = Deno.env.get("DENO_PROJECT"); + const noStatic = Deno.env.get("NO_STATIC"); + const exclude = Deno.env.get("EXCLUDE"); + + let command = ["deployctl", "deploy"]; + + if (noStatic) { + command = command.concat(["--no-static"]); + } + + if (exclude) { + command = command.concat([`--exclude=${exclude}`]); + } + + if (!Deno.env.get("DENO_DEPLOY_TOKEN")) { + throw new Error("DENO_DEPLOY_TOKEN environment variable is not set"); + } + + if (!project) { + throw new Error("DENO_PROJECT environment variable is not set"); + } + + const script = Deno.env.get("DENO_MAIN_SCRIPT") || "main.tsx"; + command = command.concat([`--project=${project}`, script]); + + if (existsSync("devbox.json")) { + command = ["sh", "-c", `devbox run -- ${command.join(" ")}`]; + installDeployCtl = [ + "sh", + "-c", + `devbox run -- ${installDeployCtl.join(" ")}`, + ]; + } + + const ctr = baseCtr(client, Job.deploy) + .from("denoland/deno:alpine") + .withDirectory("/app", context, { + exclude: [".git", ".devbox", ".fluentci"], + }) + .withWorkdir("/app") + .withEnvVariable("PATH", "/root/.deno/bin:$PATH", { expand: true }) + .withEnvVariable("DENO_DEPLOY_TOKEN", Deno.env.get("DENO_DEPLOY_TOKEN")!) + .withEnvVariable( + "DENO_MAIN_SCRIPT", + Deno.env.get("DENO_MAIN_SCRIPT") || "main.tsx" + ) + .withExec(installDeployCtl) + .withExec(command); + + const result = await ctr.stdout(); + + console.log(result); +}; + +export type JobExec = ( + client: Client, + src?: string +) => + | Promise + | (( + client: Client, + src?: string, + options?: { + ignore: string[]; + } + ) => Promise); + +export const codecov = upload; + +export const runnableJobs: Record = { + [Job.fmt]: fmt, + [Job.lint]: lint, + [Job.test]: test, + [Job.deploy]: deploy, + [Job.codecov]: upload, +}; + +export const jobDescriptions: Record = { + [Job.fmt]: "Format your code", + [Job.lint]: "Lint your code", + [Job.test]: "Run your tests", + [Job.deploy]: "Deploy your code to Deno Deploy", + [Job.codecov]: "Upload your code coverage to Codecov", +}; diff --git a/example/.fluentci/.fluentci/.fluentci/src/dagger/list_jobs.ts b/example/.fluentci/.fluentci/.fluentci/src/dagger/list_jobs.ts new file mode 100644 index 0000000..12bb3cb --- /dev/null +++ b/example/.fluentci/.fluentci/.fluentci/src/dagger/list_jobs.ts @@ -0,0 +1,21 @@ +import { brightGreen } from "https://deno.land/std@0.191.0/fmt/colors.ts"; +import { runnableJobs, jobDescriptions, Job } from "./jobs.ts"; +import { stringifyTree } from "https://esm.sh/stringify-tree@1.1.1"; + +const tree = { + name: brightGreen("deno_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/.fluentci/.fluentci/src/dagger/pipeline.ts b/example/.fluentci/.fluentci/.fluentci/src/dagger/pipeline.ts new file mode 100644 index 0000000..bad7372 --- /dev/null +++ b/example/.fluentci/.fluentci/.fluentci/src/dagger/pipeline.ts @@ -0,0 +1,27 @@ +import Client, { connect } from "@dagger.io/dagger"; +import * as jobs from "./jobs.ts"; + +const { fmt, lint, test, runnableJobs } = jobs; + +export default function pipeline(src = ".", args: string[] = []) { + connect(async (client: Client) => { + if (args.length > 0) { + await runSpecificJobs(client, args as jobs.Job[]); + return; + } + + await fmt(client, src); + await lint(client, src); + await test(client, src); + }); +} + +async function runSpecificJobs(client: Client, args: jobs.Job[]) { + for (const name of args) { + const job = runnableJobs[name]; + if (!job) { + throw new Error(`Job ${name} not found`); + } + await job(client); + } +} diff --git a/example/.fluentci/.fluentci/.fluentci/src/dagger/runner.ts b/example/.fluentci/.fluentci/.fluentci/src/dagger/runner.ts new file mode 100644 index 0000000..e23879e --- /dev/null +++ b/example/.fluentci/.fluentci/.fluentci/src/dagger/runner.ts @@ -0,0 +1,3 @@ +import pipeline from "./pipeline.ts"; + +pipeline(".", Deno.args); diff --git a/example/.fluentci/.fluentci/.fluentci/src/github/config.ts b/example/.fluentci/.fluentci/.fluentci/src/github/config.ts new file mode 100644 index 0000000..5a35a70 --- /dev/null +++ b/example/.fluentci/.fluentci/.fluentci/src/github/config.ts @@ -0,0 +1,52 @@ +import { JobSpec, Workflow } from "fluent_github_actions"; + +export function generateYaml() { + const workflow = new Workflow("Codecov"); + + const push = { + branches: ["main"], + }; + + const setupDagger = `\ + curl -L https://dl.dagger.io/dagger/install.sh | DAGGER_VERSION=0.8.1 sh + sudo mv bin/dagger /usr/local/bin + dagger version`; + + const tests: JobSpec = { + "runs-on": "ubuntu-latest", + steps: [ + { + uses: "actions/checkout@v2", + }, + { + uses: "denolib/setup-deno@v2", + with: { + "deno-version": "v1.36", + }, + }, + { + name: "Setup Fluent CI CLI", + run: "deno install -A -r https://cli.fluentci.io -n fluentci", + }, + { + name: "Setup Dagger", + run: setupDagger, + }, + { + name: "List Jobs", + run: "fluentci ls .", + }, + { + name: "Run Dagger Pipelines", + run: "dagger run fluentci . fmt lint test codecov", + env: { + CODECOV_TOKEN: "${{ secrets.CODECOV_TOKEN }}", + }, + }, + ], + }; + + workflow.on({ push }).jobs({ tests }); + + workflow.save(".github/workflows/ci.yml"); +} diff --git a/example/.fluentci/.fluentci/.fluentci/src/github/init.ts b/example/.fluentci/.fluentci/.fluentci/src/github/init.ts new file mode 100644 index 0000000..6097dd5 --- /dev/null +++ b/example/.fluentci/.fluentci/.fluentci/src/github/init.ts @@ -0,0 +1,3 @@ +import { generateYaml } from "./config.ts"; + +generateYaml(); diff --git a/example/.fluentci/.fluentci/.fluentci/src/gitlab/index.ts b/example/.fluentci/.fluentci/.fluentci/src/gitlab/index.ts new file mode 100644 index 0000000..392c001 --- /dev/null +++ b/example/.fluentci/.fluentci/.fluentci/src/gitlab/index.ts @@ -0,0 +1,4 @@ +import pipeline from "./pipeline.ts"; +import { fmt, lint, test } from "./jobs.ts"; + +export { fmt, lint, pipeline, test }; diff --git a/example/.fluentci/.fluentci/.fluentci/src/gitlab/jobs.ts b/example/.fluentci/.fluentci/.fluentci/src/gitlab/jobs.ts new file mode 100644 index 0000000..46be50c --- /dev/null +++ b/example/.fluentci/.fluentci/.fluentci/src/gitlab/jobs.ts @@ -0,0 +1,9 @@ +import { Job } from "https://deno.land/x/fluent_gitlab_ci@v0.3.2/mod.ts"; + +export const fmt = new Job() + .image("denoland/deno:alpine") + .script("deno fmt --check"); + +export const lint = new Job().image("denoland/deno:alpine").script("deno lint"); + +export const test = new Job().image("denoland/deno:alpine").script("deno test"); diff --git a/example/.fluentci/.fluentci/.fluentci/src/gitlab/pipeline.ts b/example/.fluentci/.fluentci/.fluentci/src/gitlab/pipeline.ts new file mode 100644 index 0000000..366de64 --- /dev/null +++ b/example/.fluentci/.fluentci/.fluentci/src/gitlab/pipeline.ts @@ -0,0 +1,10 @@ +import { GitlabCI } from "https://deno.land/x/fluent_gitlab_ci@v0.3.2/mod.ts"; +import { fmt, lint, test } from "./jobs.ts"; + +const pipeline = new GitlabCI() + .image("denoland/deno:alpine") + .addJob("fmt", fmt) + .addJob("lint", lint) + .addJob("test", test); + +export default pipeline; diff --git a/example/.fluentci/src/gitlab/pipeline_test.ts b/example/.fluentci/.fluentci/.fluentci/src/gitlab/pipeline_test.ts similarity index 100% rename from example/.fluentci/src/gitlab/pipeline_test.ts rename to example/.fluentci/.fluentci/.fluentci/src/gitlab/pipeline_test.ts diff --git a/example/.fluentci/.fluentci/.github/workflows/ci.yml b/example/.fluentci/.fluentci/.github/workflows/ci.yml new file mode 100644 index 0000000..99f51d2 --- /dev/null +++ b/example/.fluentci/.fluentci/.github/workflows/ci.yml @@ -0,0 +1,28 @@ +# Do not edit this file directly. It is generated by Fluent Github Actions + +name: Codecov +on: + push: + branches: + - main +jobs: + tests: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: denolib/setup-deno@v2 + with: + deno-version: v1.36 + - 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: List Jobs + run: fluentci ls . + - name: Run Dagger Pipelines + run: dagger run fluentci . fmt lint test codecov + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} diff --git a/example/.fluentci/.fluentci/.gitignore b/example/.fluentci/.fluentci/.gitignore new file mode 100644 index 0000000..a2442bb --- /dev/null +++ b/example/.fluentci/.fluentci/.gitignore @@ -0,0 +1,2 @@ +coverage/ +coverage.lcov \ No newline at end of file diff --git a/example/.fluentci/.fluentci/.vscode/settings.json b/example/.fluentci/.fluentci/.vscode/settings.json new file mode 100644 index 0000000..cbac569 --- /dev/null +++ b/example/.fluentci/.fluentci/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "deno.enable": true +} diff --git a/example/.fluentci/.fluentci/CODE_OF_CONDUCT.md b/example/.fluentci/.fluentci/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..e9c20f9 --- /dev/null +++ b/example/.fluentci/.fluentci/CODE_OF_CONDUCT.md @@ -0,0 +1,132 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +We as members, contributors, and leaders pledge to make participation in our +community a harassment-free experience for everyone, regardless of age, body +size, visible or invisible disability, ethnicity, sex characteristics, gender +identity and expression, level of experience, education, socio-economic status, +nationality, personal appearance, race, caste, color, religion, or sexual +identity and orientation. + +We pledge to act and interact in ways that contribute to an open, welcoming, +diverse, inclusive, and healthy community. + +## Our Standards + +Examples of behavior that contributes to a positive environment for our +community include: + +- Demonstrating empathy and kindness toward other people +- Being respectful of differing opinions, viewpoints, and experiences +- Giving and gracefully accepting constructive feedback +- Accepting responsibility and apologizing to those affected by our mistakes, + and learning from the experience +- Focusing on what is best not just for us as individuals, but for the overall + community + +Examples of unacceptable behavior include: + +- The use of sexualized language or imagery, and sexual attention or advances of + any kind +- Trolling, insulting or derogatory comments, and personal or political attacks +- Public or private harassment +- Publishing others' private information, such as a physical or email address, + without their explicit permission +- Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Enforcement Responsibilities + +Community leaders are responsible for clarifying and enforcing our standards of +acceptable behavior and will take appropriate and fair corrective action in +response to any behavior that they deem inappropriate, threatening, offensive, +or harmful. + +Community leaders have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions that are +not aligned to this Code of Conduct, and will communicate reasons for moderation +decisions when appropriate. + +## Scope + +This Code of Conduct applies within all community spaces, and also applies when +an individual is officially representing the community in public spaces. +Examples of representing our community include using an official e-mail address, +posting via an official social media account, or acting as an appointed +representative at an online or offline event. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported to the community leaders responsible for enforcement at +[GitHub Issues](https://github.com/fluent-ci-templates/deno-pipeline/issues). +All complaints will be reviewed and investigated promptly and fairly. + +All community leaders are obligated to respect the privacy and security of the +reporter of any incident. + +## Enforcement Guidelines + +Community leaders will follow these Community Impact Guidelines in determining +the consequences for any action they deem in violation of this Code of Conduct: + +### 1. Correction + +**Community Impact**: Use of inappropriate language or other behavior deemed +unprofessional or unwelcome in the community. + +**Consequence**: A private, written warning from community leaders, providing +clarity around the nature of the violation and an explanation of why the +behavior was inappropriate. A public apology may be requested. + +### 2. Warning + +**Community Impact**: A violation through a single incident or series of +actions. + +**Consequence**: A warning with consequences for continued behavior. No +interaction with the people involved, including unsolicited interaction with +those enforcing the Code of Conduct, for a specified period of time. This +includes avoiding interactions in community spaces as well as external channels +like social media. Violating these terms may lead to a temporary or permanent +ban. + +### 3. Temporary Ban + +**Community Impact**: A serious violation of community standards, including +sustained inappropriate behavior. + +**Consequence**: A temporary ban from any sort of interaction or public +communication with the community for a specified period of time. No public or +private interaction with the people involved, including unsolicited interaction +with those enforcing the Code of Conduct, is allowed during this period. +Violating these terms may lead to a permanent ban. + +### 4. Permanent Ban + +**Community Impact**: Demonstrating a pattern of violation of community +standards, including sustained inappropriate behavior, harassment of an +individual, or aggression toward or disparagement of classes of individuals. + +**Consequence**: A permanent ban from any sort of public interaction within the +community. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], +version 2.1, available at +[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1]. + +Community Impact Guidelines were inspired by +[Mozilla's code of conduct enforcement ladder][Mozilla CoC]. + +For answers to common questions about this code of conduct, see the FAQ at +[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at +[https://www.contributor-covenant.org/translations][translations]. + +[homepage]: https://www.contributor-covenant.org +[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html +[Mozilla CoC]: https://github.com/mozilla/diversity +[FAQ]: https://www.contributor-covenant.org/faq +[translations]: https://www.contributor-covenant.org/translations diff --git a/example/.fluentci/.fluentci/CONTRIBUTING.md b/example/.fluentci/.fluentci/CONTRIBUTING.md new file mode 100644 index 0000000..e50de72 --- /dev/null +++ b/example/.fluentci/.fluentci/CONTRIBUTING.md @@ -0,0 +1,70 @@ +# Contributing Guidelines + +Thank you for your interest in contributing to our project. Whether it's a bug +report, new feature, correction, or additional documentation, we greatly value +feedback and contributions from our community. + +Please read through this document before submitting any issues or pull requests +to ensure we have all the necessary information to effectively respond to your +bug report or contribution. + +## Reporting Bugs/Feature Requests + +We welcome you to use the GitHub issue tracker to report bugs or suggest +features. + +When filing an issue, please check existing open, or recently closed, issues to +make sure somebody else hasn't already reported the issue. Please try to include +as much information as you can. Details like these are incredibly useful: + +- A reproducible test case or series of steps +- The version of our code being used +- Any modifications you've made relevant to the bug +- Anything unusual about your environment or deployment + +## Contributing via Pull Requests + +Contributions via pull requests are much appreciated. Before sending us a pull +request, please ensure that: + +1. You are working against the latest source on the _master_ branch. +2. You check existing open, and recently merged, pull requests to make sure + someone else hasn't addressed the problem already. +3. You open an issue to discuss any significant work - we would hate for your + time to be wasted. + +To send us a pull request, please: + +1. Fork the repository. +2. Modify the source; please focus on the specific change you are contributing. + If you also reformat all the code, it will be hard for us to focus on your + change. +3. Ensure local tests pass. +4. Commit to your fork using clear commit messages. +5. Send us a pull request, answering any default questions in the pull request + interface. +6. Pay attention to any automated CI failures reported in the pull request, and + stay involved in the conversation. + +GitHub provides additional document on +[forking a repository](https://help.github.com/articles/fork-a-repo/) and +[creating a pull request](https://help.github.com/articles/creating-a-pull-request/). + +## Finding contributions to work on + +Looking at the existing issues is a great way to find something to contribute +on. As our projects, by default, use the default GitHub issue labels +(enhancement/bug/duplicate/help wanted/invalid/question/wontfix), looking at any +'help wanted' issues is a great place to start. + +## Code of Conduct + +This project has adopted the +[Contributor Covenant](https://www.contributor-covenant.org/), version 2.1, +available at +https://www.contributor-covenant.org/version/2/1/code_of_conduct.html. + +## Licensing + +See the [LICENSE](LICENSE) file for our project's licensing. We will ask you to +confirm the licensing of your contribution. diff --git a/example/.fluentci/.fluentci/LICENSE b/example/.fluentci/.fluentci/LICENSE new file mode 100644 index 0000000..d9ab36a --- /dev/null +++ b/example/.fluentci/.fluentci/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2023 Tsiry Sandratraina + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/example/.fluentci/.fluentci/README.md b/example/.fluentci/.fluentci/README.md new file mode 100644 index 0000000..b8517c1 --- /dev/null +++ b/example/.fluentci/.fluentci/README.md @@ -0,0 +1,69 @@ +# Deno Pipeline + +[![deno module](https://shield.deno.dev/x/deno_pipeline)](https://deno.land/x/deno_pipeline) +![deno compatibility](https://shield.deno.dev/deno/^1.34) +[![](https://img.shields.io/codecov/c/gh/fluent-ci-templates/deno-pipeline)](https://codecov.io/gh/fluent-ci-templates/deno-pipeline) + +A ready-to-use CI/CD Pipeline for your Deno projects. + +## ๐Ÿš€ Usage + +Run the following command: + +```bash +dagger run fluentci deno_pipeline +``` + +Or, if you want to use it as a template: + +```bash +fluentci init -t deno +``` + +This will create a `.fluentci` folder in your project. + +Now you can run the pipeline with: + +```bash +dagger run fluentci . +``` + +## Environment variables (Deno Deploy) + +| Variable | Description | Default | +| ----------------- | ------------------------- | ---------- | +| DENO_PROJECT | Your project name | | +| NO_STATIC | Disable static assets | `false` | +| EXCLUDE | Exclude files from deploy | | +| DENO_DEPLOY_TOKEN | Your Deno Deploy token | | +| DENO_MAIN_SCRIPT | Your main script | `main.tsx` | + +## Jobs + +| Job | Description | Options | +| ------ | ------------------------------ | ---------------------- | +| fmt | Format your code | | +| lint | Lint your code | | +| test | Run your tests | `{ ignore: string[] }` | +| deploy | Deploy your app to Deno Deploy | | + +## Programmatic usage + +You can also use this pipeline programmatically: + +```ts +import { Client, connect } from "https://esm.sh/@dagger.io/dagger@0.8.1"; +import { Dagger } from "https://deno.land/x/deno_pipeline/mod.ts"; + +const { fmt, lint, test } = Dagger; + +function pipeline(src = ".") { + connect(async (client: Client) => { + await fmt(client, src); + await lint(client, src); + await test(client, src); + }); +} + +pipeline(); +``` diff --git a/example/.fluentci/.fluentci/ci.ts b/example/.fluentci/.fluentci/ci.ts new file mode 100644 index 0000000..67e5a80 --- /dev/null +++ b/example/.fluentci/.fluentci/ci.ts @@ -0,0 +1,12 @@ +const command = new Deno.Command(Deno.execPath(), { + args: [ + "run", + "-A", + "--import-map=https://deno.land/x/deno_pipeline/import_map.json", + "https://deno.land/x/deno_pipeline/src/dagger/runner.ts", + ], +}); + +const { stdout } = await command.output(); + +console.log(new TextDecoder().decode(stdout)); diff --git a/example/.fluentci/.fluentci/deno.json b/example/.fluentci/.fluentci/deno.json new file mode 100644 index 0000000..4240219 --- /dev/null +++ b/example/.fluentci/.fluentci/deno.json @@ -0,0 +1,9 @@ +{ + "importMap": "import_map.json", + "tasks": { + "esm:add": "deno run -A https://esm.sh/v128 add", + "esm:update": "deno run -A https://esm.sh/v128 update", + "esm:remove": "deno run -A https://esm.sh/v128 remove", + "ci:dagger": "dagger run deno run -A src/dagger/runner.ts" + } +} diff --git a/example/.fluentci/.fluentci/deno.lock b/example/.fluentci/.fluentci/deno.lock new file mode 100644 index 0000000..c5e3f9a --- /dev/null +++ b/example/.fluentci/.fluentci/deno.lock @@ -0,0 +1,13 @@ +{ + "version": "2", + "remote": { + "https://deno.land/x/fluent_github_actions@v0.1.2/mod.ts": "dc62b622791da77bc27f68e33cba618983a0770a9a12dcc9e0f9a61161bb90e5", + "https://deno.land/x/fluent_github_actions@v0.1.2/src/event.ts": "c31430af085682cb4ad522c655a8a0800a3ab8b8aec7c979d60c909051d853b0", + "https://deno.land/x/fluent_github_actions@v0.1.2/src/job_spec.ts": "ee7af83e75285b4776ff4f9e14764187737178b4abc6c277da1c32491c41dfca", + "https://deno.land/x/fluent_github_actions@v0.1.2/src/step_spec.ts": "3207071b5dee8487f36fe4ea1881e8fd3b77c472c965c20a14093a3c919af9af", + "https://deno.land/x/fluent_github_actions@v0.1.2/src/workflow.ts": "488556e230fdeeb3a5b0d0bf548c570606aa356b0a7f667ea1d031d3263eb566", + "https://deno.land/x/fluent_github_actions@v0.1.2/src/workflow_spec.ts": "3ca9e565dc1dedd0531e0b852d50b9a3853a1ad35f2010760e0326590b80fa43", + "https://esm.sh/v131/yaml@2.3.1/denonext/yaml.mjs": "71f677b4bfc69271af9d98db5194e354f9a1863955e208e26d32a9ef78bd89f5", + "https://esm.sh/yaml@v2.3.1": "1fe2490feb3d9c6d2c71c64dbdbed90acd4164b00628b3c68a311b6731ca38b5" + } +} diff --git a/example/.fluentci/.fluentci/example/.fluentci/.devcontainer/devcontainer.json b/example/.fluentci/.fluentci/example/.fluentci/.devcontainer/devcontainer.json new file mode 100644 index 0000000..39a38ae --- /dev/null +++ b/example/.fluentci/.fluentci/example/.fluentci/.devcontainer/devcontainer.json @@ -0,0 +1,25 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/debian +{ + "name": "Debian", + // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile + "image": "mcr.microsoft.com/devcontainers/base:bullseye", + "features": { + "ghcr.io/devcontainers/features/github-cli:1": {}, + "ghcr.io/devcontainers/features/nix:1": {} + }, + + // Features to add to the dev container. More info: https://containers.dev/features. + // "features": {}, + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], + + // Use 'postCreateCommand' to run commands after the container is created. + "postCreateCommand": "nix develop --experimental-features \"nix-command flakes\"" + // Configure tool-specific properties. + // "customizations": {}, + + // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. + // "remoteUser": "root" +} diff --git a/example/.fluentci/.fluentci/example/.fluentci/.fluentci/.devcontainer/devcontainer.json b/example/.fluentci/.fluentci/example/.fluentci/.fluentci/.devcontainer/devcontainer.json new file mode 100644 index 0000000..39a38ae --- /dev/null +++ b/example/.fluentci/.fluentci/example/.fluentci/.fluentci/.devcontainer/devcontainer.json @@ -0,0 +1,25 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/debian +{ + "name": "Debian", + // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile + "image": "mcr.microsoft.com/devcontainers/base:bullseye", + "features": { + "ghcr.io/devcontainers/features/github-cli:1": {}, + "ghcr.io/devcontainers/features/nix:1": {} + }, + + // Features to add to the dev container. More info: https://containers.dev/features. + // "features": {}, + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], + + // Use 'postCreateCommand' to run commands after the container is created. + "postCreateCommand": "nix develop --experimental-features \"nix-command flakes\"" + // Configure tool-specific properties. + // "customizations": {}, + + // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. + // "remoteUser": "root" +} diff --git a/example/.fluentci/.fluentci/example/.fluentci/.fluentci/.github/workflows/ci.yml b/example/.fluentci/.fluentci/example/.fluentci/.fluentci/.github/workflows/ci.yml new file mode 100644 index 0000000..3ac7dd7 --- /dev/null +++ b/example/.fluentci/.fluentci/example/.fluentci/.fluentci/.github/workflows/ci.yml @@ -0,0 +1,28 @@ +name: Codecov + +# Controls when the action will run. Triggers the workflow on push or pull request +# events but only for the master branch +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: denolib/setup-deno@v2 + with: + deno-version: v1.34 + - name: Create coverage files + run: deno test --allow-read --coverage=coverage --lock-write # create coverage files + - name: Create coverage report + run: deno coverage ./coverage --lcov > coverage.lcov # create coverage report + - name: Collect coverage + uses: codecov/codecov-action@v3 # upload the report on Codecov + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + with: + file: ./coverage.lcov diff --git a/example/.fluentci/.fluentci/example/.fluentci/.fluentci/.vscode/settings.json b/example/.fluentci/.fluentci/example/.fluentci/.fluentci/.vscode/settings.json new file mode 100644 index 0000000..cbac569 --- /dev/null +++ b/example/.fluentci/.fluentci/example/.fluentci/.fluentci/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "deno.enable": true +} diff --git a/example/.fluentci/.fluentci/example/.fluentci/.fluentci/CODE_OF_CONDUCT.md b/example/.fluentci/.fluentci/example/.fluentci/.fluentci/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..e9c20f9 --- /dev/null +++ b/example/.fluentci/.fluentci/example/.fluentci/.fluentci/CODE_OF_CONDUCT.md @@ -0,0 +1,132 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +We as members, contributors, and leaders pledge to make participation in our +community a harassment-free experience for everyone, regardless of age, body +size, visible or invisible disability, ethnicity, sex characteristics, gender +identity and expression, level of experience, education, socio-economic status, +nationality, personal appearance, race, caste, color, religion, or sexual +identity and orientation. + +We pledge to act and interact in ways that contribute to an open, welcoming, +diverse, inclusive, and healthy community. + +## Our Standards + +Examples of behavior that contributes to a positive environment for our +community include: + +- Demonstrating empathy and kindness toward other people +- Being respectful of differing opinions, viewpoints, and experiences +- Giving and gracefully accepting constructive feedback +- Accepting responsibility and apologizing to those affected by our mistakes, + and learning from the experience +- Focusing on what is best not just for us as individuals, but for the overall + community + +Examples of unacceptable behavior include: + +- The use of sexualized language or imagery, and sexual attention or advances of + any kind +- Trolling, insulting or derogatory comments, and personal or political attacks +- Public or private harassment +- Publishing others' private information, such as a physical or email address, + without their explicit permission +- Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Enforcement Responsibilities + +Community leaders are responsible for clarifying and enforcing our standards of +acceptable behavior and will take appropriate and fair corrective action in +response to any behavior that they deem inappropriate, threatening, offensive, +or harmful. + +Community leaders have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions that are +not aligned to this Code of Conduct, and will communicate reasons for moderation +decisions when appropriate. + +## Scope + +This Code of Conduct applies within all community spaces, and also applies when +an individual is officially representing the community in public spaces. +Examples of representing our community include using an official e-mail address, +posting via an official social media account, or acting as an appointed +representative at an online or offline event. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported to the community leaders responsible for enforcement at +[GitHub Issues](https://github.com/fluent-ci-templates/deno-pipeline/issues). +All complaints will be reviewed and investigated promptly and fairly. + +All community leaders are obligated to respect the privacy and security of the +reporter of any incident. + +## Enforcement Guidelines + +Community leaders will follow these Community Impact Guidelines in determining +the consequences for any action they deem in violation of this Code of Conduct: + +### 1. Correction + +**Community Impact**: Use of inappropriate language or other behavior deemed +unprofessional or unwelcome in the community. + +**Consequence**: A private, written warning from community leaders, providing +clarity around the nature of the violation and an explanation of why the +behavior was inappropriate. A public apology may be requested. + +### 2. Warning + +**Community Impact**: A violation through a single incident or series of +actions. + +**Consequence**: A warning with consequences for continued behavior. No +interaction with the people involved, including unsolicited interaction with +those enforcing the Code of Conduct, for a specified period of time. This +includes avoiding interactions in community spaces as well as external channels +like social media. Violating these terms may lead to a temporary or permanent +ban. + +### 3. Temporary Ban + +**Community Impact**: A serious violation of community standards, including +sustained inappropriate behavior. + +**Consequence**: A temporary ban from any sort of interaction or public +communication with the community for a specified period of time. No public or +private interaction with the people involved, including unsolicited interaction +with those enforcing the Code of Conduct, is allowed during this period. +Violating these terms may lead to a permanent ban. + +### 4. Permanent Ban + +**Community Impact**: Demonstrating a pattern of violation of community +standards, including sustained inappropriate behavior, harassment of an +individual, or aggression toward or disparagement of classes of individuals. + +**Consequence**: A permanent ban from any sort of public interaction within the +community. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], +version 2.1, available at +[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1]. + +Community Impact Guidelines were inspired by +[Mozilla's code of conduct enforcement ladder][Mozilla CoC]. + +For answers to common questions about this code of conduct, see the FAQ at +[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at +[https://www.contributor-covenant.org/translations][translations]. + +[homepage]: https://www.contributor-covenant.org +[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html +[Mozilla CoC]: https://github.com/mozilla/diversity +[FAQ]: https://www.contributor-covenant.org/faq +[translations]: https://www.contributor-covenant.org/translations diff --git a/example/.fluentci/.fluentci/example/.fluentci/.fluentci/CONTRIBUTING.md b/example/.fluentci/.fluentci/example/.fluentci/.fluentci/CONTRIBUTING.md new file mode 100644 index 0000000..e50de72 --- /dev/null +++ b/example/.fluentci/.fluentci/example/.fluentci/.fluentci/CONTRIBUTING.md @@ -0,0 +1,70 @@ +# Contributing Guidelines + +Thank you for your interest in contributing to our project. Whether it's a bug +report, new feature, correction, or additional documentation, we greatly value +feedback and contributions from our community. + +Please read through this document before submitting any issues or pull requests +to ensure we have all the necessary information to effectively respond to your +bug report or contribution. + +## Reporting Bugs/Feature Requests + +We welcome you to use the GitHub issue tracker to report bugs or suggest +features. + +When filing an issue, please check existing open, or recently closed, issues to +make sure somebody else hasn't already reported the issue. Please try to include +as much information as you can. Details like these are incredibly useful: + +- A reproducible test case or series of steps +- The version of our code being used +- Any modifications you've made relevant to the bug +- Anything unusual about your environment or deployment + +## Contributing via Pull Requests + +Contributions via pull requests are much appreciated. Before sending us a pull +request, please ensure that: + +1. You are working against the latest source on the _master_ branch. +2. You check existing open, and recently merged, pull requests to make sure + someone else hasn't addressed the problem already. +3. You open an issue to discuss any significant work - we would hate for your + time to be wasted. + +To send us a pull request, please: + +1. Fork the repository. +2. Modify the source; please focus on the specific change you are contributing. + If you also reformat all the code, it will be hard for us to focus on your + change. +3. Ensure local tests pass. +4. Commit to your fork using clear commit messages. +5. Send us a pull request, answering any default questions in the pull request + interface. +6. Pay attention to any automated CI failures reported in the pull request, and + stay involved in the conversation. + +GitHub provides additional document on +[forking a repository](https://help.github.com/articles/fork-a-repo/) and +[creating a pull request](https://help.github.com/articles/creating-a-pull-request/). + +## Finding contributions to work on + +Looking at the existing issues is a great way to find something to contribute +on. As our projects, by default, use the default GitHub issue labels +(enhancement/bug/duplicate/help wanted/invalid/question/wontfix), looking at any +'help wanted' issues is a great place to start. + +## Code of Conduct + +This project has adopted the +[Contributor Covenant](https://www.contributor-covenant.org/), version 2.1, +available at +https://www.contributor-covenant.org/version/2/1/code_of_conduct.html. + +## Licensing + +See the [LICENSE](LICENSE) file for our project's licensing. We will ask you to +confirm the licensing of your contribution. diff --git a/example/.fluentci/.fluentci/example/.fluentci/.fluentci/LICENSE b/example/.fluentci/.fluentci/example/.fluentci/.fluentci/LICENSE new file mode 100644 index 0000000..d9ab36a --- /dev/null +++ b/example/.fluentci/.fluentci/example/.fluentci/.fluentci/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2023 Tsiry Sandratraina + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/example/.fluentci/.fluentci/example/.fluentci/.fluentci/README.md b/example/.fluentci/.fluentci/example/.fluentci/.fluentci/README.md new file mode 100644 index 0000000..23f6a94 --- /dev/null +++ b/example/.fluentci/.fluentci/example/.fluentci/.fluentci/README.md @@ -0,0 +1,88 @@ +# Deno Pipeline + +[![deno module](https://shield.deno.dev/x/deno_pipeline)](https://deno.land/x/deno_pipeline) +![deno compatibility](https://shield.deno.dev/deno/^1.34) +[![](https://img.shields.io/codecov/c/gh/fluent-ci-templates/deno-pipeline)](https://codecov.io/gh/fluent-ci-templates/deno-pipeline) + +A ready-to-use GitLab CI Pipeline and Jobs for your Deno projects. + +## ๐Ÿš€ Usage + +Quick start: + +```ts +import { GitLab } from "https://deno.land/x/deno_pipeline/mod.ts"; + +const { pipeline } = GitLab; + +pipeline.write(); // Write the pipeline to the file .gitlab-ci.yml +``` + +Or, if you want to use the predefined jobs: + +```ts +import { GitlabCI } from "https://deno.land/x/fluent_gitlab_ci/mod.ts"; +import { GitLab } from "https://deno.land/x/deno_pipeline/mod.ts"; + +const { fmt, lint, test } = GitLab; + +const const pipeline = new GitlabCI() + .image("denoland/deno:alpine") + .addJob("fmt", fmt) + .addJob("lint", lint) + .addJob("test", test); + +pipeline.write(); // Write the pipeline to the file .gitlab-ci.yml +``` + +It will generate the following `.gitlab-ci.yml` file: + +```yaml +# Do not edit this file directly. It is generated by Fluent GitLab CI + +image: denoland/deno:alpine + +fmt: + image: denoland/deno:alpine + script: + - deno fmt --check + +lint: + image: denoland/deno:alpine + script: + - deno lint + +test: + image: denoland/deno:alpine + script: + - deno test +``` + +## ๐Ÿงช Advanced Usage + +This package also provides a ready-to-use pipeline for +[Dagger](https://dagger.io/), just run the following command on your Deno +project: + +```sh +dagger run deno run -A https://deno.land/x/deno_pipeline/ci.ts +``` + +Or, if you want to use the predefined jobs: + +```ts +import Client, { connect } from "@dagger.io/dagger"; +import { Dagger } from "https://deno.land/x/deno_pipeline/mod.ts"; + +const { fmt, lint, test } = Dagger; + +function pipeline(src = ".") { + connect(async (client: Client) => { + await fmt(client, src); + await lint(client, src); + await test(client, src); + }); +} + +pipeline(); +``` diff --git a/example/.fluentci/.fluentci/example/.fluentci/.fluentci/ci.ts b/example/.fluentci/.fluentci/example/.fluentci/.fluentci/ci.ts new file mode 100644 index 0000000..67e5a80 --- /dev/null +++ b/example/.fluentci/.fluentci/example/.fluentci/.fluentci/ci.ts @@ -0,0 +1,12 @@ +const command = new Deno.Command(Deno.execPath(), { + args: [ + "run", + "-A", + "--import-map=https://deno.land/x/deno_pipeline/import_map.json", + "https://deno.land/x/deno_pipeline/src/dagger/runner.ts", + ], +}); + +const { stdout } = await command.output(); + +console.log(new TextDecoder().decode(stdout)); diff --git a/example/.fluentci/.fluentci/example/.fluentci/.fluentci/deno.json b/example/.fluentci/.fluentci/example/.fluentci/.fluentci/deno.json new file mode 100644 index 0000000..4240219 --- /dev/null +++ b/example/.fluentci/.fluentci/example/.fluentci/.fluentci/deno.json @@ -0,0 +1,9 @@ +{ + "importMap": "import_map.json", + "tasks": { + "esm:add": "deno run -A https://esm.sh/v128 add", + "esm:update": "deno run -A https://esm.sh/v128 update", + "esm:remove": "deno run -A https://esm.sh/v128 remove", + "ci:dagger": "dagger run deno run -A src/dagger/runner.ts" + } +} diff --git a/example/.fluentci/.fluentci/example/.fluentci/.fluentci/deno.lock b/example/.fluentci/.fluentci/example/.fluentci/.fluentci/deno.lock new file mode 100644 index 0000000..23cc878 --- /dev/null +++ b/example/.fluentci/.fluentci/example/.fluentci/.fluentci/deno.lock @@ -0,0 +1,66 @@ +{ + "version": "2", + "remote": { + "https://deno.land/std@0.150.0/media_types/_util.ts": "ce9b4fc4ba1c447dafab619055e20fd88236ca6bdd7834a21f98bd193c3fbfa1", + "https://deno.land/std@0.150.0/media_types/mod.ts": "2d4b6f32a087029272dc59e0a55ae3cc4d1b27b794ccf528e94b1925795b3118", + "https://deno.land/std@0.150.0/media_types/vendor/mime-db.v1.52.0.ts": "724cee25fa40f1a52d3937d6b4fbbfdd7791ff55e1b7ac08d9319d5632c7f5af", + "https://deno.land/std@0.191.0/fmt/colors.ts": "d67e3cd9f472535241a8e410d33423980bec45047e343577554d3356e1f0ef4e", + "https://deno.land/x/xhr@0.3.0/mod.ts": "094aacd627fd9635cd942053bf8032b5223b909858fa9dc8ffa583752ff63b20", + "https://esm.sh/stringify-tree@1.1.1": "8d994a105481fa944515323d89bd2596c1de79f3d9bd1386266463934716eca0", + "https://esm.sh/v128/*@dagger.io/dagger@0.6.3": "cb691a77c0cdaee22f2b8393731b5143c83ce22dbbea204cdbfd203768d15b64", + "https://esm.sh/v128/@dagger.io/dagger@0.6.3/X-ZS8q/denonext/dagger.mjs": "fd0901784d75b99615b5409c3654b5c7edfc5ba377c9e1a5a67ffff4f7d3ac32", + "https://esm.sh/v128/adm-zip@0.5.10": "d9c54d6d2dd788462781a57d923295bd79304e6fd74b242fd4b30e35b39c5dcf", + "https://esm.sh/v128/adm-zip@0.5.10/denonext/adm-zip.mjs": "07a9731547905e0ca55ae917e1969d7f6d04fb3773f906ce3306891337eb4849", + "https://esm.sh/v128/chownr@2.0.0/denonext/chownr.mjs": "30b8f17084dfbe475a5052b615f706b06ddd17dca0535103340d485c6b94e952", + "https://esm.sh/v128/cross-fetch@3.1.8/denonext/cross-fetch.mjs": "8fba9e7c3fbaf0d2168beb63ce0cd21b5bfbfbd77e2fcbf8d957d533a71222f6", + "https://esm.sh/v128/cross-spawn@7.0.3/denonext/cross-spawn.mjs": "0569a26e7ad4b3376516cbc9b1942e10961a58030eadcea8c848e6b956eb355c", + "https://esm.sh/v128/data-uri-to-buffer@4.0.1/denonext/data-uri-to-buffer.mjs": "70ef987b1da58391495ecfad9888d996469224faf3cd996d81dc2e059feb9f31", + "https://esm.sh/v128/env-paths@3.0.0": "8400fb23319be9b30d7b40d1c865541c5b3c7726cdf9b74000bc0f1678d52ecf", + "https://esm.sh/v128/env-paths@3.0.0/denonext/env-paths.mjs": "77984a05eb16450087f25060a070ed500ec546719d471143e16d976ca73ca956", + "https://esm.sh/v128/execa@7.1.1": "a40c7030df81ab0847a5d844f4c5c6420af973dff05fef88e53cbb9b8667fdc2", + "https://esm.sh/v128/execa@7.1.1/denonext/execa.mjs": "9d5943544c0df3761b52f2c095f89a03ca6c028d818a8f0475ff883b0408f154", + "https://esm.sh/v128/fetch-blob@3.2.0/denonext/fetch-blob.mjs": "0531568b36c0f6db3e9825fbb2d08dee51100eb675c2bf1d98d6971a92010721", + "https://esm.sh/v128/fetch-blob@3.2.0/denonext/file.js": "fd82828163a4e7bdc15190d8c3dbfd92f93274d05bd7f7f5ab81093e3ad7e9c2", + "https://esm.sh/v128/fetch-blob@3.2.0/denonext/from.js": "7d3258c7960755497f90879806f0b815d5e564c2ac1523238af5cb9552ff5c45", + "https://esm.sh/v128/formdata-polyfill@4.0.10/denonext/esm.min.js": "b6d65a204e81eca699d9eb6f867e9efffa42db39a8f161690915a89e5eb1766f", + "https://esm.sh/v128/fs-minipass@2.1.0/denonext/fs-minipass.mjs": "74b00283d556b281bdfd6a669576d852f2c43702043c411985f8f8188d208c5d", + "https://esm.sh/v128/get-stream@6.0.1/denonext/get-stream.mjs": "a947a16f8cb3052fd654a84f8b36b40ce96b6a5acfb3ad4ab69d814bcf3351fb", + "https://esm.sh/v128/graphql-request@6.1.0": "17f00c323eb825811ce14e2b0e88a0c873acb666c382ac963d1edeb03e01f372", + "https://esm.sh/v128/graphql-request@6.1.0/denonext/graphql-request.mjs": "0b15f49d44489423ae6f06004725b6d050b6359da4969e6569bd6ad45065bd94", + "https://esm.sh/v128/graphql-tag@2.12.6": "5bfa27da9c9918fb52a01b8579891e804e0365d91118df1f2e0957a72dacdc39", + "https://esm.sh/v128/graphql-tag@2.12.6/denonext/graphql-tag.mjs": "331d09949efc4ac60c84a69b52a7da8b333210493900e54953ae4604c9874527", + "https://esm.sh/v128/graphql@16.7.1/denonext/graphql.mjs": "418ad7c07b0f2d687f33b6275d3b5f317f4afbef1f462f318229f458dff45416", + "https://esm.sh/v128/human-signals@4.3.1/denonext/human-signals.mjs": "3889110cedd907804443d018cffe0a1d892d5e7467661376caf967feff55cbe9", + "https://esm.sh/v128/is-stream@3.0.0/denonext/is-stream.mjs": "5c8b65f2fa051c4b18e88bbae11dac8bba9caf57752577d69bcea86d1f05c5b7", + "https://esm.sh/v128/isexe@2.0.0/denonext/isexe.mjs": "3cfefd270d1bfdfb864ee98dbb8f41d150cbf480925158f4a8f0ade8a9e17d6c", + "https://esm.sh/v128/merge-stream@2.0.0/denonext/merge-stream.mjs": "2c2af22401c294158d6bff659d157e3d2c028c218cc1bd2246534a45a4c03c61", + "https://esm.sh/v128/mimic-fn@4.0.0/denonext/mimic-fn.mjs": "10bcf0f2f20cbbba0c289ef7bf4d2422639bbc1c36c247be876afd6fe2d67138", + "https://esm.sh/v128/minipass@3.3.6/denonext/minipass.mjs": "59bbe430514455e78cb30c389b21af66efb2bf010cda071820a17d8c76d0d1cf", + "https://esm.sh/v128/minipass@5.0.0/denonext/minipass.mjs": "de0e049728f8c387b58c86439eb9d69a16b6a88756a6bc694e2fecbd7fd00401", + "https://esm.sh/v128/minizlib@2.1.2/denonext/minizlib.mjs": "0d919b6a0c60d5a31e14d748ff9d62aeae2923b604bcc6a22f90fa4bbd400d68", + "https://esm.sh/v128/mkdirp@1.0.4/denonext/mkdirp.mjs": "ee129b32e55dd8bede6b1bbd1978f7775fa5e2720d5a7ae07bf1e8c99abd77c7", + "https://esm.sh/v128/node-color-log@10.0.2": "05a277987c64153af1252167135076155fdc6b39ca260b2bdc39750da12d2a2d", + "https://esm.sh/v128/node-color-log@10.0.2/denonext/node-color-log.mjs": "2504391bd0ce1dd4c2bf0ed0b839b8a3ad84c028d9dd17cc58dccd2e14dacfde", + "https://esm.sh/v128/node-domexception@1.0.0/denonext/node-domexception.mjs": "bb35ba54c1a2b35870618876c0c96310a28ae58aecff33c8eed58a582e270ff4", + "https://esm.sh/v128/node-fetch@3.3.1": "916dcee177a69fb0e46970c528cb66fcd4973488f861844c0a235bfc645b0506", + "https://esm.sh/v128/node-fetch@3.3.1/denonext/node-fetch.mjs": "dc3a8f1f2fc9eb26d0d33e49f3750acc265d51a1a54bbd670c5d9f640b633a93", + "https://esm.sh/v128/node-fetch@3.3.1/denonext/src/utils/multipart-parser.js": "713b1b8cbafc4bfb7358debeb35d507e0d2328f0a28b8a2a7d79a3e5e4f5e5b8", + "https://esm.sh/v128/npm-run-path@5.1.0/denonext/npm-run-path.mjs": "3540b8c2dd1430f10d580f323f3a51aa30094da27a9220cce03ce69884b163bb", + "https://esm.sh/v128/onetime@6.0.0/denonext/onetime.mjs": "6e362222575d815f37fb813168d7069dd6a0f6bb6f972ed54d1bccb0f9fb3e1b", + "https://esm.sh/v128/original-fs@1.2.0/denonext/original-fs.mjs": "2b1098818e54d2c6748ff5b0dd9ea5f6a61b4b6d0f63fb625f21773d11cfc667", + "https://esm.sh/v128/path-key@3.1.1/denonext/path-key.mjs": "add83c631278b7df9b33ae84e41142db88bb291295bcc27eb4e77a1cbdfa71d0", + "https://esm.sh/v128/path-key@4.0.0/denonext/path-key.mjs": "2c2e3922bd0e6e414fa2752ff800bdc6b9208035ce797fa22e49b859f8259417", + "https://esm.sh/v128/shebang-command@2.0.0/denonext/shebang-command.mjs": "404e0fb09a782ca9495d53c721bb84b673b7b2e1054e021852143a6b91ca0e4f", + "https://esm.sh/v128/shebang-regex@3.0.0/denonext/shebang-regex.mjs": "03983ba59dd2cba9402935e21b46d05f5249364cba9f5757aef23c6c2fea65b9", + "https://esm.sh/v128/signal-exit@3.0.7/denonext/signal-exit.mjs": "2a176e5f9b351fa8057213c627a1503d63bf308b64447ef47f1ca6fbb2a91c81", + "https://esm.sh/v128/strip-final-newline@3.0.0/denonext/strip-final-newline.mjs": "03d9be4e8a249d63cbbddeb2fb675a1bbbcb335283e604d4ce56c88c90e6f102", + "https://esm.sh/v128/tar@6.1.15": "0460339f8aba5f287e8bebe258fe3fe13cb12f85820693f25724f0d98ef1258e", + "https://esm.sh/v128/tar@6.1.15/denonext/tar.mjs": "6194d892de8457b3b1f11d5cbacda1d540b453b45e8cb9f5f610abfb3e490b65", + "https://esm.sh/v128/tslib@2.6.0/denonext/tslib.mjs": "2215292e6fcf28a7a081eee911f127bb3c44cdd61ff0651e3e384d7a49b4e42b", + "https://esm.sh/v128/web-streams-polyfill@3.2.1/denonext/dist/ponyfill.es2018.js": "a2edb52a93494cda06386b3d6a168016b366e78f02c5eff1f94a0240be12ac96", + "https://esm.sh/v128/which@2.0.2/denonext/which.mjs": "86bf76e4937edb7fa3464d7bb9a426ef273684d1cefbec5ba5f1bdcb5cafff91", + "https://esm.sh/v128/yallist@4.0.0/denonext/yallist.mjs": "61f180d807dda50bac17028eda05d5722a3fecef6e98a9064e2353ea6864fd82", + "https://esm.sh/v130/lodash.flatten@4.4.0/denonext/lodash.flatten.mjs": "8e86ab607deea15cc3c1acfb5eae278ecbc5b80f24167b4e8f4c56df3278cd55", + "https://esm.sh/v130/stringify-tree@1.1.1/denonext/stringify-tree.mjs": "40a9d40e0282b5432302a3da68b88aa11685bc0b8a0b70246168deed5c5773fe" + } +} diff --git a/example/.fluentci/.fluentci/example/.fluentci/.fluentci/fixtures/.gitlab-ci.yml b/example/.fluentci/.fluentci/example/.fluentci/.fluentci/fixtures/.gitlab-ci.yml new file mode 100644 index 0000000..299e4c6 --- /dev/null +++ b/example/.fluentci/.fluentci/example/.fluentci/.fluentci/fixtures/.gitlab-ci.yml @@ -0,0 +1,19 @@ +# Do not edit this file directly. It is generated by Fluent GitLab CI + +image: denoland/deno:alpine + +fmt: + image: denoland/deno:alpine + script: + - deno fmt --check + +lint: + image: denoland/deno:alpine + script: + - deno lint + +test: + image: denoland/deno:alpine + script: + - deno test + diff --git a/example/.fluentci/.fluentci/example/.fluentci/.fluentci/flake.lock b/example/.fluentci/.fluentci/example/.fluentci/.fluentci/flake.lock new file mode 100644 index 0000000..af7453c --- /dev/null +++ b/example/.fluentci/.fluentci/example/.fluentci/.fluentci/flake.lock @@ -0,0 +1,61 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1687709756, + "narHash": "sha256-Y5wKlQSkgEK2weWdOu4J3riRd+kV/VCgHsqLNTTWQ/0=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "dbabf0ca0c0c4bce6ea5eaf65af5cb694d2082c7", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1688910226, + "narHash": "sha256-kLTsFu9CAU2Gb288JhIBN/WlX4UUUDz4WiC/U59nvwk=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "2540432a940aee979be6ccfefba9ea0652c273a0", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "release-23.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/example/.fluentci/.fluentci/example/.fluentci/.fluentci/flake.nix b/example/.fluentci/.fluentci/example/.fluentci/.fluentci/flake.nix new file mode 100644 index 0000000..b13ea7d --- /dev/null +++ b/example/.fluentci/.fluentci/example/.fluentci/.fluentci/flake.nix @@ -0,0 +1,26 @@ +{ + description = "A Nix-flake-based Deno development environment"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/release-23.05"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { + self, + nixpkgs, + flake-utils, + }: + flake-utils.lib.eachDefaultSystem + (system: let + pkgs = import nixpkgs { + inherit system; + }; + in { + devShells.default = pkgs.mkShell { + buildInputs = [ + pkgs.deno + ]; + }; + }); +} \ No newline at end of file diff --git a/example/.fluentci/.fluentci/example/.fluentci/.fluentci/import_map.json b/example/.fluentci/.fluentci/example/.fluentci/.fluentci/import_map.json new file mode 100644 index 0000000..801ea9a --- /dev/null +++ b/example/.fluentci/.fluentci/example/.fluentci/.fluentci/import_map.json @@ -0,0 +1,27 @@ +{ + "imports": { + "@dagger.io/dagger": "https://esm.sh/v128/*@dagger.io/dagger@0.6.3", + "fluent_gitlab_ci": "https://deno.land/x/fluent_gitlab_ci@v0.3.2/mod.ts", + "url": "node:url", + "readline": "node:readline", + "process": "node:process", + "path": "node:path", + "os": "node:os", + "fs": "node:fs", + "crypto": "node:crypto" + }, + "scopes": { + "https://esm.sh/v128/": { + "@lifeomic/axios-fetch": "https://esm.sh/v128/@lifeomic/axios-fetch@3.0.1", + "adm-zip": "https://esm.sh/v128/adm-zip@0.5.10", + "env-paths": "https://esm.sh/v128/env-paths@3.0.0", + "execa": "https://esm.sh/v128/execa@7.1.1", + "graphql-request": "https://esm.sh/v128/graphql-request@6.1.0", + "graphql-tag": "https://esm.sh/v128/graphql-tag@2.12.6", + "graphql": "https://esm.sh/v128/graphql@16.7.1", + "node-color-log": "https://esm.sh/v128/node-color-log@10.0.2", + "node-fetch": "https://esm.sh/v128/node-fetch@3.3.1", + "tar": "https://esm.sh/v128/tar@6.1.15" + } + } +} diff --git a/example/.fluentci/.fluentci/example/.fluentci/.fluentci/mod.ts b/example/.fluentci/.fluentci/example/.fluentci/.fluentci/mod.ts new file mode 100644 index 0000000..6152fb6 --- /dev/null +++ b/example/.fluentci/.fluentci/example/.fluentci/.fluentci/mod.ts @@ -0,0 +1,4 @@ +import * as GitLab from "./src/gitlab/index.ts"; +import * as Dagger from "./src/dagger/index.ts"; + +export { Dagger, GitLab }; diff --git a/example/.fluentci/.fluentci/example/.fluentci/.fluentci/src/dagger/index.ts b/example/.fluentci/.fluentci/example/.fluentci/.fluentci/src/dagger/index.ts new file mode 100644 index 0000000..392c001 --- /dev/null +++ b/example/.fluentci/.fluentci/example/.fluentci/.fluentci/src/dagger/index.ts @@ -0,0 +1,4 @@ +import pipeline from "./pipeline.ts"; +import { fmt, lint, test } from "./jobs.ts"; + +export { fmt, lint, pipeline, test }; diff --git a/example/.fluentci/.fluentci/example/.fluentci/.fluentci/src/dagger/jobs.ts b/example/.fluentci/.fluentci/example/.fluentci/.fluentci/src/dagger/jobs.ts new file mode 100644 index 0000000..42b4554 --- /dev/null +++ b/example/.fluentci/.fluentci/example/.fluentci/.fluentci/src/dagger/jobs.ts @@ -0,0 +1,111 @@ +import Client from "@dagger.io/dagger"; +import { existsSync } from "fs"; + +export enum Job { + fmt = "fmt", + lint = "lint", + test = "test", +} + +export const lint = async (client: Client, src = ".") => { + const context = client.host().directory(src); + let command = ["deno", "lint"]; + + if (existsSync("devbox.json")) { + command = ["sh", "-c", `devbox run -- ${command.join(" ")}`]; + } + + const ctr = client + .pipeline(Job.lint) + .container() + .from("denoland/deno:alpine") + .withDirectory("/app", context, { + exclude: [".git", ".devbox", ".fluentci"], + }) + .withWorkdir("/app") + .withExec(command); + + const result = await ctr.stdout(); + + console.log(result); +}; + +export const fmt = async (client: Client, src = ".") => { + const context = client.host().directory(src); + let command = ["deno", "fmt"]; + + if (existsSync("devbox.json")) { + command = ["sh", "-c", `devbox run -- ${command.join(" ")}`]; + } + + const ctr = client + .pipeline(Job.fmt) + .container() + .from("denoland/deno:alpine") + .withDirectory("/app", context, { + exclude: [".git", ".devbox", ".fluentci"], + }) + .withWorkdir("/app") + .withExec(command); + + const result = await ctr.stdout(); + + console.log(result); +}; + +export const test = async ( + client: Client, + src = ".", + options: { ignore: string[] } = { ignore: [] } +) => { + const context = client.host().directory(src); + let command = ["deno", "test", "-A", "--lock-write"]; + + if (options.ignore.length > 0) { + command = command.concat([`--ignore=${options.ignore.join(",")}`]); + } + + if (existsSync("devbox.json")) { + command = ["sh", "-c", `devbox run -- ${command.join(" ")}`]; + } + + const ctr = client + .pipeline(Job.test) + .container() + .from("denoland/deno:alpine") + .withDirectory("/app", context, { + exclude: [".git", ".devbox", ".fluentci"], + }) + .withWorkdir("/app") + .withMountedCache("/root/.cache/deno", client.cacheVolume("deno-cache")) + .withExec(command); + + const result = await ctr.stdout(); + + console.log(result); +}; + +export type JobExec = ( + client: Client, + src?: string +) => + | Promise + | (( + client: Client, + src?: string, + options?: { + ignore: string[]; + } + ) => Promise); + +export const runnableJobs: Record = { + [Job.fmt]: fmt, + [Job.lint]: lint, + [Job.test]: test, +}; + +export const jobDescriptions: Record = { + [Job.fmt]: "Format your code", + [Job.lint]: "Lint your code", + [Job.test]: "Run your tests", +}; diff --git a/example/.fluentci/.fluentci/example/.fluentci/.fluentci/src/dagger/list_jobs.ts b/example/.fluentci/.fluentci/example/.fluentci/.fluentci/src/dagger/list_jobs.ts new file mode 100644 index 0000000..12bb3cb --- /dev/null +++ b/example/.fluentci/.fluentci/example/.fluentci/.fluentci/src/dagger/list_jobs.ts @@ -0,0 +1,21 @@ +import { brightGreen } from "https://deno.land/std@0.191.0/fmt/colors.ts"; +import { runnableJobs, jobDescriptions, Job } from "./jobs.ts"; +import { stringifyTree } from "https://esm.sh/stringify-tree@1.1.1"; + +const tree = { + name: brightGreen("deno_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/.fluentci/example/.fluentci/.fluentci/src/dagger/pipeline.ts b/example/.fluentci/.fluentci/example/.fluentci/.fluentci/src/dagger/pipeline.ts new file mode 100644 index 0000000..bad7372 --- /dev/null +++ b/example/.fluentci/.fluentci/example/.fluentci/.fluentci/src/dagger/pipeline.ts @@ -0,0 +1,27 @@ +import Client, { connect } from "@dagger.io/dagger"; +import * as jobs from "./jobs.ts"; + +const { fmt, lint, test, runnableJobs } = jobs; + +export default function pipeline(src = ".", args: string[] = []) { + connect(async (client: Client) => { + if (args.length > 0) { + await runSpecificJobs(client, args as jobs.Job[]); + return; + } + + await fmt(client, src); + await lint(client, src); + await test(client, src); + }); +} + +async function runSpecificJobs(client: Client, args: jobs.Job[]) { + for (const name of args) { + const job = runnableJobs[name]; + if (!job) { + throw new Error(`Job ${name} not found`); + } + await job(client); + } +} diff --git a/example/.fluentci/.fluentci/example/.fluentci/.fluentci/src/dagger/runner.ts b/example/.fluentci/.fluentci/example/.fluentci/.fluentci/src/dagger/runner.ts new file mode 100644 index 0000000..e23879e --- /dev/null +++ b/example/.fluentci/.fluentci/example/.fluentci/.fluentci/src/dagger/runner.ts @@ -0,0 +1,3 @@ +import pipeline from "./pipeline.ts"; + +pipeline(".", Deno.args); diff --git a/example/.fluentci/.fluentci/example/.fluentci/.fluentci/src/gitlab/index.ts b/example/.fluentci/.fluentci/example/.fluentci/.fluentci/src/gitlab/index.ts new file mode 100644 index 0000000..392c001 --- /dev/null +++ b/example/.fluentci/.fluentci/example/.fluentci/.fluentci/src/gitlab/index.ts @@ -0,0 +1,4 @@ +import pipeline from "./pipeline.ts"; +import { fmt, lint, test } from "./jobs.ts"; + +export { fmt, lint, pipeline, test }; diff --git a/example/.fluentci/.fluentci/example/.fluentci/.fluentci/src/gitlab/jobs.ts b/example/.fluentci/.fluentci/example/.fluentci/.fluentci/src/gitlab/jobs.ts new file mode 100644 index 0000000..46be50c --- /dev/null +++ b/example/.fluentci/.fluentci/example/.fluentci/.fluentci/src/gitlab/jobs.ts @@ -0,0 +1,9 @@ +import { Job } from "https://deno.land/x/fluent_gitlab_ci@v0.3.2/mod.ts"; + +export const fmt = new Job() + .image("denoland/deno:alpine") + .script("deno fmt --check"); + +export const lint = new Job().image("denoland/deno:alpine").script("deno lint"); + +export const test = new Job().image("denoland/deno:alpine").script("deno test"); diff --git a/example/.fluentci/.fluentci/example/.fluentci/.fluentci/src/gitlab/pipeline.ts b/example/.fluentci/.fluentci/example/.fluentci/.fluentci/src/gitlab/pipeline.ts new file mode 100644 index 0000000..366de64 --- /dev/null +++ b/example/.fluentci/.fluentci/example/.fluentci/.fluentci/src/gitlab/pipeline.ts @@ -0,0 +1,10 @@ +import { GitlabCI } from "https://deno.land/x/fluent_gitlab_ci@v0.3.2/mod.ts"; +import { fmt, lint, test } from "./jobs.ts"; + +const pipeline = new GitlabCI() + .image("denoland/deno:alpine") + .addJob("fmt", fmt) + .addJob("lint", lint) + .addJob("test", test); + +export default pipeline; diff --git a/example/.fluentci/.fluentci/example/.fluentci/.fluentci/src/gitlab/pipeline_test.ts b/example/.fluentci/.fluentci/example/.fluentci/.fluentci/src/gitlab/pipeline_test.ts new file mode 100644 index 0000000..ca24710 --- /dev/null +++ b/example/.fluentci/.fluentci/example/.fluentci/.fluentci/src/gitlab/pipeline_test.ts @@ -0,0 +1,8 @@ +import pipeline from "./pipeline.ts"; +import { assertEquals } from "https://deno.land/std@0.191.0/testing/asserts.ts"; + +Deno.test(function pipelineTest() { + const expected = Deno.readTextFileSync("./fixtures/.gitlab-ci.yml"); + const actual = pipeline.toString(); + assertEquals(actual, expected); +}); diff --git a/example/.fluentci/.fluentci/example/.fluentci/.github/workflows/ci.yml b/example/.fluentci/.fluentci/example/.fluentci/.github/workflows/ci.yml new file mode 100644 index 0000000..3ac7dd7 --- /dev/null +++ b/example/.fluentci/.fluentci/example/.fluentci/.github/workflows/ci.yml @@ -0,0 +1,28 @@ +name: Codecov + +# Controls when the action will run. Triggers the workflow on push or pull request +# events but only for the master branch +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: denolib/setup-deno@v2 + with: + deno-version: v1.34 + - name: Create coverage files + run: deno test --allow-read --coverage=coverage --lock-write # create coverage files + - name: Create coverage report + run: deno coverage ./coverage --lcov > coverage.lcov # create coverage report + - name: Collect coverage + uses: codecov/codecov-action@v3 # upload the report on Codecov + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + with: + file: ./coverage.lcov diff --git a/example/.fluentci/.fluentci/example/.fluentci/.vscode/settings.json b/example/.fluentci/.fluentci/example/.fluentci/.vscode/settings.json new file mode 100644 index 0000000..cbac569 --- /dev/null +++ b/example/.fluentci/.fluentci/example/.fluentci/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "deno.enable": true +} diff --git a/example/.fluentci/.fluentci/example/.fluentci/CODE_OF_CONDUCT.md b/example/.fluentci/.fluentci/example/.fluentci/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..e9c20f9 --- /dev/null +++ b/example/.fluentci/.fluentci/example/.fluentci/CODE_OF_CONDUCT.md @@ -0,0 +1,132 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +We as members, contributors, and leaders pledge to make participation in our +community a harassment-free experience for everyone, regardless of age, body +size, visible or invisible disability, ethnicity, sex characteristics, gender +identity and expression, level of experience, education, socio-economic status, +nationality, personal appearance, race, caste, color, religion, or sexual +identity and orientation. + +We pledge to act and interact in ways that contribute to an open, welcoming, +diverse, inclusive, and healthy community. + +## Our Standards + +Examples of behavior that contributes to a positive environment for our +community include: + +- Demonstrating empathy and kindness toward other people +- Being respectful of differing opinions, viewpoints, and experiences +- Giving and gracefully accepting constructive feedback +- Accepting responsibility and apologizing to those affected by our mistakes, + and learning from the experience +- Focusing on what is best not just for us as individuals, but for the overall + community + +Examples of unacceptable behavior include: + +- The use of sexualized language or imagery, and sexual attention or advances of + any kind +- Trolling, insulting or derogatory comments, and personal or political attacks +- Public or private harassment +- Publishing others' private information, such as a physical or email address, + without their explicit permission +- Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Enforcement Responsibilities + +Community leaders are responsible for clarifying and enforcing our standards of +acceptable behavior and will take appropriate and fair corrective action in +response to any behavior that they deem inappropriate, threatening, offensive, +or harmful. + +Community leaders have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions that are +not aligned to this Code of Conduct, and will communicate reasons for moderation +decisions when appropriate. + +## Scope + +This Code of Conduct applies within all community spaces, and also applies when +an individual is officially representing the community in public spaces. +Examples of representing our community include using an official e-mail address, +posting via an official social media account, or acting as an appointed +representative at an online or offline event. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported to the community leaders responsible for enforcement at +[GitHub Issues](https://github.com/fluent-ci-templates/deno-pipeline/issues). +All complaints will be reviewed and investigated promptly and fairly. + +All community leaders are obligated to respect the privacy and security of the +reporter of any incident. + +## Enforcement Guidelines + +Community leaders will follow these Community Impact Guidelines in determining +the consequences for any action they deem in violation of this Code of Conduct: + +### 1. Correction + +**Community Impact**: Use of inappropriate language or other behavior deemed +unprofessional or unwelcome in the community. + +**Consequence**: A private, written warning from community leaders, providing +clarity around the nature of the violation and an explanation of why the +behavior was inappropriate. A public apology may be requested. + +### 2. Warning + +**Community Impact**: A violation through a single incident or series of +actions. + +**Consequence**: A warning with consequences for continued behavior. No +interaction with the people involved, including unsolicited interaction with +those enforcing the Code of Conduct, for a specified period of time. This +includes avoiding interactions in community spaces as well as external channels +like social media. Violating these terms may lead to a temporary or permanent +ban. + +### 3. Temporary Ban + +**Community Impact**: A serious violation of community standards, including +sustained inappropriate behavior. + +**Consequence**: A temporary ban from any sort of interaction or public +communication with the community for a specified period of time. No public or +private interaction with the people involved, including unsolicited interaction +with those enforcing the Code of Conduct, is allowed during this period. +Violating these terms may lead to a permanent ban. + +### 4. Permanent Ban + +**Community Impact**: Demonstrating a pattern of violation of community +standards, including sustained inappropriate behavior, harassment of an +individual, or aggression toward or disparagement of classes of individuals. + +**Consequence**: A permanent ban from any sort of public interaction within the +community. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], +version 2.1, available at +[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1]. + +Community Impact Guidelines were inspired by +[Mozilla's code of conduct enforcement ladder][Mozilla CoC]. + +For answers to common questions about this code of conduct, see the FAQ at +[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at +[https://www.contributor-covenant.org/translations][translations]. + +[homepage]: https://www.contributor-covenant.org +[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html +[Mozilla CoC]: https://github.com/mozilla/diversity +[FAQ]: https://www.contributor-covenant.org/faq +[translations]: https://www.contributor-covenant.org/translations diff --git a/example/.fluentci/.fluentci/example/.fluentci/CONTRIBUTING.md b/example/.fluentci/.fluentci/example/.fluentci/CONTRIBUTING.md new file mode 100644 index 0000000..e50de72 --- /dev/null +++ b/example/.fluentci/.fluentci/example/.fluentci/CONTRIBUTING.md @@ -0,0 +1,70 @@ +# Contributing Guidelines + +Thank you for your interest in contributing to our project. Whether it's a bug +report, new feature, correction, or additional documentation, we greatly value +feedback and contributions from our community. + +Please read through this document before submitting any issues or pull requests +to ensure we have all the necessary information to effectively respond to your +bug report or contribution. + +## Reporting Bugs/Feature Requests + +We welcome you to use the GitHub issue tracker to report bugs or suggest +features. + +When filing an issue, please check existing open, or recently closed, issues to +make sure somebody else hasn't already reported the issue. Please try to include +as much information as you can. Details like these are incredibly useful: + +- A reproducible test case or series of steps +- The version of our code being used +- Any modifications you've made relevant to the bug +- Anything unusual about your environment or deployment + +## Contributing via Pull Requests + +Contributions via pull requests are much appreciated. Before sending us a pull +request, please ensure that: + +1. You are working against the latest source on the _master_ branch. +2. You check existing open, and recently merged, pull requests to make sure + someone else hasn't addressed the problem already. +3. You open an issue to discuss any significant work - we would hate for your + time to be wasted. + +To send us a pull request, please: + +1. Fork the repository. +2. Modify the source; please focus on the specific change you are contributing. + If you also reformat all the code, it will be hard for us to focus on your + change. +3. Ensure local tests pass. +4. Commit to your fork using clear commit messages. +5. Send us a pull request, answering any default questions in the pull request + interface. +6. Pay attention to any automated CI failures reported in the pull request, and + stay involved in the conversation. + +GitHub provides additional document on +[forking a repository](https://help.github.com/articles/fork-a-repo/) and +[creating a pull request](https://help.github.com/articles/creating-a-pull-request/). + +## Finding contributions to work on + +Looking at the existing issues is a great way to find something to contribute +on. As our projects, by default, use the default GitHub issue labels +(enhancement/bug/duplicate/help wanted/invalid/question/wontfix), looking at any +'help wanted' issues is a great place to start. + +## Code of Conduct + +This project has adopted the +[Contributor Covenant](https://www.contributor-covenant.org/), version 2.1, +available at +https://www.contributor-covenant.org/version/2/1/code_of_conduct.html. + +## Licensing + +See the [LICENSE](LICENSE) file for our project's licensing. We will ask you to +confirm the licensing of your contribution. diff --git a/example/.fluentci/.fluentci/example/.fluentci/LICENSE b/example/.fluentci/.fluentci/example/.fluentci/LICENSE new file mode 100644 index 0000000..d9ab36a --- /dev/null +++ b/example/.fluentci/.fluentci/example/.fluentci/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2023 Tsiry Sandratraina + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/example/.fluentci/.fluentci/example/.fluentci/README.md b/example/.fluentci/.fluentci/example/.fluentci/README.md new file mode 100644 index 0000000..1afc7c6 --- /dev/null +++ b/example/.fluentci/.fluentci/example/.fluentci/README.md @@ -0,0 +1,58 @@ +# Deno Pipeline + +[![deno module](https://shield.deno.dev/x/deno_pipeline)](https://deno.land/x/deno_pipeline) +![deno compatibility](https://shield.deno.dev/deno/^1.34) +[![](https://img.shields.io/codecov/c/gh/fluent-ci-templates/deno-pipeline)](https://codecov.io/gh/fluent-ci-templates/deno-pipeline) + +A ready-to-use CI/CD Pipeline for your Deno projects. + +## ๐Ÿš€ Usage + +Run the following command: + +```bash +dagger run fluentci deno_pipeline +``` + +Or, if you want to use it as a template: + +```bash +fluentci init -t deno +``` + +This will create a `.fluentci` folder in your project. + +Now you can run the pipeline with: + +```bash +dagger run fluentci . +``` + +## Jobs + +| Job | Description | Options | +| ----- | ---------------- | ---------------------- | +| fmt | Format your code | | +| lint | Lint your code | | +| test | Run your tests | `{ ignore: string[] }` | + +## Programmatic usage + +You can also use this pipeline programmatically: + +```ts +import Client, { connect } from "@dagger.io/dagger"; +import { Dagger } from "https://deno.land/x/deno_pipeline/mod.ts"; + +const { fmt, lint, test } = Dagger; + +function pipeline(src = ".") { + connect(async (client: Client) => { + await fmt(client, src); + await lint(client, src); + await test(client, src); + }); +} + +pipeline(); +``` diff --git a/example/.fluentci/.fluentci/example/.fluentci/ci.ts b/example/.fluentci/.fluentci/example/.fluentci/ci.ts new file mode 100644 index 0000000..67e5a80 --- /dev/null +++ b/example/.fluentci/.fluentci/example/.fluentci/ci.ts @@ -0,0 +1,12 @@ +const command = new Deno.Command(Deno.execPath(), { + args: [ + "run", + "-A", + "--import-map=https://deno.land/x/deno_pipeline/import_map.json", + "https://deno.land/x/deno_pipeline/src/dagger/runner.ts", + ], +}); + +const { stdout } = await command.output(); + +console.log(new TextDecoder().decode(stdout)); diff --git a/example/.fluentci/.fluentci/example/.fluentci/deno.json b/example/.fluentci/.fluentci/example/.fluentci/deno.json new file mode 100644 index 0000000..4240219 --- /dev/null +++ b/example/.fluentci/.fluentci/example/.fluentci/deno.json @@ -0,0 +1,9 @@ +{ + "importMap": "import_map.json", + "tasks": { + "esm:add": "deno run -A https://esm.sh/v128 add", + "esm:update": "deno run -A https://esm.sh/v128 update", + "esm:remove": "deno run -A https://esm.sh/v128 remove", + "ci:dagger": "dagger run deno run -A src/dagger/runner.ts" + } +} diff --git a/example/.fluentci/.fluentci/example/.fluentci/deno.lock b/example/.fluentci/.fluentci/example/.fluentci/deno.lock new file mode 100644 index 0000000..f8af4c3 --- /dev/null +++ b/example/.fluentci/.fluentci/example/.fluentci/deno.lock @@ -0,0 +1,67 @@ +{ + "version": "2", + "remote": { + "https://deno.land/std@0.150.0/media_types/_util.ts": "ce9b4fc4ba1c447dafab619055e20fd88236ca6bdd7834a21f98bd193c3fbfa1", + "https://deno.land/std@0.150.0/media_types/mod.ts": "2d4b6f32a087029272dc59e0a55ae3cc4d1b27b794ccf528e94b1925795b3118", + "https://deno.land/std@0.150.0/media_types/vendor/mime-db.v1.52.0.ts": "724cee25fa40f1a52d3937d6b4fbbfdd7791ff55e1b7ac08d9319d5632c7f5af", + "https://deno.land/std@0.191.0/fmt/colors.ts": "d67e3cd9f472535241a8e410d33423980bec45047e343577554d3356e1f0ef4e", + "https://deno.land/x/nix_installer_pipeline@v0.3.6/src/dagger/steps.ts": "a34aea3753c7079de5877f592ce31f30d05d552155729ff3e695d77326405133", + "https://deno.land/x/xhr@0.3.0/mod.ts": "094aacd627fd9635cd942053bf8032b5223b909858fa9dc8ffa583752ff63b20", + "https://esm.sh/stringify-tree@1.1.1": "8d994a105481fa944515323d89bd2596c1de79f3d9bd1386266463934716eca0", + "https://esm.sh/v128/*@dagger.io/dagger@0.6.3": "cb691a77c0cdaee22f2b8393731b5143c83ce22dbbea204cdbfd203768d15b64", + "https://esm.sh/v128/@dagger.io/dagger@0.6.3/X-ZS8q/denonext/dagger.mjs": "fd0901784d75b99615b5409c3654b5c7edfc5ba377c9e1a5a67ffff4f7d3ac32", + "https://esm.sh/v128/adm-zip@0.5.10": "d9c54d6d2dd788462781a57d923295bd79304e6fd74b242fd4b30e35b39c5dcf", + "https://esm.sh/v128/adm-zip@0.5.10/denonext/adm-zip.mjs": "07a9731547905e0ca55ae917e1969d7f6d04fb3773f906ce3306891337eb4849", + "https://esm.sh/v128/chownr@2.0.0/denonext/chownr.mjs": "30b8f17084dfbe475a5052b615f706b06ddd17dca0535103340d485c6b94e952", + "https://esm.sh/v128/cross-fetch@3.1.8/denonext/cross-fetch.mjs": "8fba9e7c3fbaf0d2168beb63ce0cd21b5bfbfbd77e2fcbf8d957d533a71222f6", + "https://esm.sh/v128/cross-spawn@7.0.3/denonext/cross-spawn.mjs": "0569a26e7ad4b3376516cbc9b1942e10961a58030eadcea8c848e6b956eb355c", + "https://esm.sh/v128/data-uri-to-buffer@4.0.1/denonext/data-uri-to-buffer.mjs": "70ef987b1da58391495ecfad9888d996469224faf3cd996d81dc2e059feb9f31", + "https://esm.sh/v128/env-paths@3.0.0": "8400fb23319be9b30d7b40d1c865541c5b3c7726cdf9b74000bc0f1678d52ecf", + "https://esm.sh/v128/env-paths@3.0.0/denonext/env-paths.mjs": "77984a05eb16450087f25060a070ed500ec546719d471143e16d976ca73ca956", + "https://esm.sh/v128/execa@7.1.1": "a40c7030df81ab0847a5d844f4c5c6420af973dff05fef88e53cbb9b8667fdc2", + "https://esm.sh/v128/execa@7.1.1/denonext/execa.mjs": "9d5943544c0df3761b52f2c095f89a03ca6c028d818a8f0475ff883b0408f154", + "https://esm.sh/v128/fetch-blob@3.2.0/denonext/fetch-blob.mjs": "0531568b36c0f6db3e9825fbb2d08dee51100eb675c2bf1d98d6971a92010721", + "https://esm.sh/v128/fetch-blob@3.2.0/denonext/file.js": "fd82828163a4e7bdc15190d8c3dbfd92f93274d05bd7f7f5ab81093e3ad7e9c2", + "https://esm.sh/v128/fetch-blob@3.2.0/denonext/from.js": "7d3258c7960755497f90879806f0b815d5e564c2ac1523238af5cb9552ff5c45", + "https://esm.sh/v128/formdata-polyfill@4.0.10/denonext/esm.min.js": "b6d65a204e81eca699d9eb6f867e9efffa42db39a8f161690915a89e5eb1766f", + "https://esm.sh/v128/fs-minipass@2.1.0/denonext/fs-minipass.mjs": "74b00283d556b281bdfd6a669576d852f2c43702043c411985f8f8188d208c5d", + "https://esm.sh/v128/get-stream@6.0.1/denonext/get-stream.mjs": "a947a16f8cb3052fd654a84f8b36b40ce96b6a5acfb3ad4ab69d814bcf3351fb", + "https://esm.sh/v128/graphql-request@6.1.0": "17f00c323eb825811ce14e2b0e88a0c873acb666c382ac963d1edeb03e01f372", + "https://esm.sh/v128/graphql-request@6.1.0/denonext/graphql-request.mjs": "0b15f49d44489423ae6f06004725b6d050b6359da4969e6569bd6ad45065bd94", + "https://esm.sh/v128/graphql-tag@2.12.6": "5bfa27da9c9918fb52a01b8579891e804e0365d91118df1f2e0957a72dacdc39", + "https://esm.sh/v128/graphql-tag@2.12.6/denonext/graphql-tag.mjs": "331d09949efc4ac60c84a69b52a7da8b333210493900e54953ae4604c9874527", + "https://esm.sh/v128/graphql@16.7.1/denonext/graphql.mjs": "418ad7c07b0f2d687f33b6275d3b5f317f4afbef1f462f318229f458dff45416", + "https://esm.sh/v128/human-signals@4.3.1/denonext/human-signals.mjs": "3889110cedd907804443d018cffe0a1d892d5e7467661376caf967feff55cbe9", + "https://esm.sh/v128/is-stream@3.0.0/denonext/is-stream.mjs": "5c8b65f2fa051c4b18e88bbae11dac8bba9caf57752577d69bcea86d1f05c5b7", + "https://esm.sh/v128/isexe@2.0.0/denonext/isexe.mjs": "3cfefd270d1bfdfb864ee98dbb8f41d150cbf480925158f4a8f0ade8a9e17d6c", + "https://esm.sh/v128/merge-stream@2.0.0/denonext/merge-stream.mjs": "2c2af22401c294158d6bff659d157e3d2c028c218cc1bd2246534a45a4c03c61", + "https://esm.sh/v128/mimic-fn@4.0.0/denonext/mimic-fn.mjs": "10bcf0f2f20cbbba0c289ef7bf4d2422639bbc1c36c247be876afd6fe2d67138", + "https://esm.sh/v128/minipass@3.3.6/denonext/minipass.mjs": "59bbe430514455e78cb30c389b21af66efb2bf010cda071820a17d8c76d0d1cf", + "https://esm.sh/v128/minipass@5.0.0/denonext/minipass.mjs": "de0e049728f8c387b58c86439eb9d69a16b6a88756a6bc694e2fecbd7fd00401", + "https://esm.sh/v128/minizlib@2.1.2/denonext/minizlib.mjs": "0d919b6a0c60d5a31e14d748ff9d62aeae2923b604bcc6a22f90fa4bbd400d68", + "https://esm.sh/v128/mkdirp@1.0.4/denonext/mkdirp.mjs": "ee129b32e55dd8bede6b1bbd1978f7775fa5e2720d5a7ae07bf1e8c99abd77c7", + "https://esm.sh/v128/node-color-log@10.0.2": "05a277987c64153af1252167135076155fdc6b39ca260b2bdc39750da12d2a2d", + "https://esm.sh/v128/node-color-log@10.0.2/denonext/node-color-log.mjs": "2504391bd0ce1dd4c2bf0ed0b839b8a3ad84c028d9dd17cc58dccd2e14dacfde", + "https://esm.sh/v128/node-domexception@1.0.0/denonext/node-domexception.mjs": "bb35ba54c1a2b35870618876c0c96310a28ae58aecff33c8eed58a582e270ff4", + "https://esm.sh/v128/node-fetch@3.3.1": "916dcee177a69fb0e46970c528cb66fcd4973488f861844c0a235bfc645b0506", + "https://esm.sh/v128/node-fetch@3.3.1/denonext/node-fetch.mjs": "dc3a8f1f2fc9eb26d0d33e49f3750acc265d51a1a54bbd670c5d9f640b633a93", + "https://esm.sh/v128/node-fetch@3.3.1/denonext/src/utils/multipart-parser.js": "713b1b8cbafc4bfb7358debeb35d507e0d2328f0a28b8a2a7d79a3e5e4f5e5b8", + "https://esm.sh/v128/npm-run-path@5.1.0/denonext/npm-run-path.mjs": "3540b8c2dd1430f10d580f323f3a51aa30094da27a9220cce03ce69884b163bb", + "https://esm.sh/v128/onetime@6.0.0/denonext/onetime.mjs": "6e362222575d815f37fb813168d7069dd6a0f6bb6f972ed54d1bccb0f9fb3e1b", + "https://esm.sh/v128/original-fs@1.2.0/denonext/original-fs.mjs": "2b1098818e54d2c6748ff5b0dd9ea5f6a61b4b6d0f63fb625f21773d11cfc667", + "https://esm.sh/v128/path-key@3.1.1/denonext/path-key.mjs": "add83c631278b7df9b33ae84e41142db88bb291295bcc27eb4e77a1cbdfa71d0", + "https://esm.sh/v128/path-key@4.0.0/denonext/path-key.mjs": "2c2e3922bd0e6e414fa2752ff800bdc6b9208035ce797fa22e49b859f8259417", + "https://esm.sh/v128/shebang-command@2.0.0/denonext/shebang-command.mjs": "404e0fb09a782ca9495d53c721bb84b673b7b2e1054e021852143a6b91ca0e4f", + "https://esm.sh/v128/shebang-regex@3.0.0/denonext/shebang-regex.mjs": "03983ba59dd2cba9402935e21b46d05f5249364cba9f5757aef23c6c2fea65b9", + "https://esm.sh/v128/signal-exit@3.0.7/denonext/signal-exit.mjs": "2a176e5f9b351fa8057213c627a1503d63bf308b64447ef47f1ca6fbb2a91c81", + "https://esm.sh/v128/strip-final-newline@3.0.0/denonext/strip-final-newline.mjs": "03d9be4e8a249d63cbbddeb2fb675a1bbbcb335283e604d4ce56c88c90e6f102", + "https://esm.sh/v128/tar@6.1.15": "0460339f8aba5f287e8bebe258fe3fe13cb12f85820693f25724f0d98ef1258e", + "https://esm.sh/v128/tar@6.1.15/denonext/tar.mjs": "6194d892de8457b3b1f11d5cbacda1d540b453b45e8cb9f5f610abfb3e490b65", + "https://esm.sh/v128/tslib@2.6.0/denonext/tslib.mjs": "2215292e6fcf28a7a081eee911f127bb3c44cdd61ff0651e3e384d7a49b4e42b", + "https://esm.sh/v128/web-streams-polyfill@3.2.1/denonext/dist/ponyfill.es2018.js": "a2edb52a93494cda06386b3d6a168016b366e78f02c5eff1f94a0240be12ac96", + "https://esm.sh/v128/which@2.0.2/denonext/which.mjs": "86bf76e4937edb7fa3464d7bb9a426ef273684d1cefbec5ba5f1bdcb5cafff91", + "https://esm.sh/v128/yallist@4.0.0/denonext/yallist.mjs": "61f180d807dda50bac17028eda05d5722a3fecef6e98a9064e2353ea6864fd82", + "https://esm.sh/v130/lodash.flatten@4.4.0/denonext/lodash.flatten.mjs": "8e86ab607deea15cc3c1acfb5eae278ecbc5b80f24167b4e8f4c56df3278cd55", + "https://esm.sh/v130/stringify-tree@1.1.1/denonext/stringify-tree.mjs": "40a9d40e0282b5432302a3da68b88aa11685bc0b8a0b70246168deed5c5773fe" + } +} diff --git a/example/.fluentci/.fluentci/example/.fluentci/fixtures/.gitlab-ci.yml b/example/.fluentci/.fluentci/example/.fluentci/fixtures/.gitlab-ci.yml new file mode 100644 index 0000000..299e4c6 --- /dev/null +++ b/example/.fluentci/.fluentci/example/.fluentci/fixtures/.gitlab-ci.yml @@ -0,0 +1,19 @@ +# Do not edit this file directly. It is generated by Fluent GitLab CI + +image: denoland/deno:alpine + +fmt: + image: denoland/deno:alpine + script: + - deno fmt --check + +lint: + image: denoland/deno:alpine + script: + - deno lint + +test: + image: denoland/deno:alpine + script: + - deno test + diff --git a/example/.fluentci/.fluentci/example/.fluentci/flake.lock b/example/.fluentci/.fluentci/example/.fluentci/flake.lock new file mode 100644 index 0000000..af7453c --- /dev/null +++ b/example/.fluentci/.fluentci/example/.fluentci/flake.lock @@ -0,0 +1,61 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1687709756, + "narHash": "sha256-Y5wKlQSkgEK2weWdOu4J3riRd+kV/VCgHsqLNTTWQ/0=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "dbabf0ca0c0c4bce6ea5eaf65af5cb694d2082c7", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1688910226, + "narHash": "sha256-kLTsFu9CAU2Gb288JhIBN/WlX4UUUDz4WiC/U59nvwk=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "2540432a940aee979be6ccfefba9ea0652c273a0", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "release-23.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/example/.fluentci/.fluentci/example/.fluentci/flake.nix b/example/.fluentci/.fluentci/example/.fluentci/flake.nix new file mode 100644 index 0000000..b13ea7d --- /dev/null +++ b/example/.fluentci/.fluentci/example/.fluentci/flake.nix @@ -0,0 +1,26 @@ +{ + description = "A Nix-flake-based Deno development environment"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/release-23.05"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { + self, + nixpkgs, + flake-utils, + }: + flake-utils.lib.eachDefaultSystem + (system: let + pkgs = import nixpkgs { + inherit system; + }; + in { + devShells.default = pkgs.mkShell { + buildInputs = [ + pkgs.deno + ]; + }; + }); +} \ No newline at end of file diff --git a/example/.fluentci/.fluentci/example/.fluentci/import_map.json b/example/.fluentci/.fluentci/example/.fluentci/import_map.json new file mode 100644 index 0000000..801ea9a --- /dev/null +++ b/example/.fluentci/.fluentci/example/.fluentci/import_map.json @@ -0,0 +1,27 @@ +{ + "imports": { + "@dagger.io/dagger": "https://esm.sh/v128/*@dagger.io/dagger@0.6.3", + "fluent_gitlab_ci": "https://deno.land/x/fluent_gitlab_ci@v0.3.2/mod.ts", + "url": "node:url", + "readline": "node:readline", + "process": "node:process", + "path": "node:path", + "os": "node:os", + "fs": "node:fs", + "crypto": "node:crypto" + }, + "scopes": { + "https://esm.sh/v128/": { + "@lifeomic/axios-fetch": "https://esm.sh/v128/@lifeomic/axios-fetch@3.0.1", + "adm-zip": "https://esm.sh/v128/adm-zip@0.5.10", + "env-paths": "https://esm.sh/v128/env-paths@3.0.0", + "execa": "https://esm.sh/v128/execa@7.1.1", + "graphql-request": "https://esm.sh/v128/graphql-request@6.1.0", + "graphql-tag": "https://esm.sh/v128/graphql-tag@2.12.6", + "graphql": "https://esm.sh/v128/graphql@16.7.1", + "node-color-log": "https://esm.sh/v128/node-color-log@10.0.2", + "node-fetch": "https://esm.sh/v128/node-fetch@3.3.1", + "tar": "https://esm.sh/v128/tar@6.1.15" + } + } +} diff --git a/example/.fluentci/.fluentci/example/.fluentci/mod.ts b/example/.fluentci/.fluentci/example/.fluentci/mod.ts new file mode 100644 index 0000000..6152fb6 --- /dev/null +++ b/example/.fluentci/.fluentci/example/.fluentci/mod.ts @@ -0,0 +1,4 @@ +import * as GitLab from "./src/gitlab/index.ts"; +import * as Dagger from "./src/dagger/index.ts"; + +export { Dagger, GitLab }; diff --git a/example/.fluentci/.fluentci/example/.fluentci/src/dagger/index.ts b/example/.fluentci/.fluentci/example/.fluentci/src/dagger/index.ts new file mode 100644 index 0000000..392c001 --- /dev/null +++ b/example/.fluentci/.fluentci/example/.fluentci/src/dagger/index.ts @@ -0,0 +1,4 @@ +import pipeline from "./pipeline.ts"; +import { fmt, lint, test } from "./jobs.ts"; + +export { fmt, lint, pipeline, test }; diff --git a/example/.fluentci/.fluentci/example/.fluentci/src/dagger/jobs.ts b/example/.fluentci/.fluentci/example/.fluentci/src/dagger/jobs.ts new file mode 100644 index 0000000..611a5e0 --- /dev/null +++ b/example/.fluentci/.fluentci/example/.fluentci/src/dagger/jobs.ts @@ -0,0 +1,188 @@ +import Client from "@dagger.io/dagger"; +import { withDevbox } from "https://deno.land/x/nix_installer_pipeline@v0.3.6/src/dagger/steps.ts"; +import { existsSync } from "fs"; + +export enum Job { + fmt = "fmt", + lint = "lint", + test = "test", + deploy = "deploy", +} + +const baseCtr = (client: Client, pipeline: string) => { + if (existsSync("devbox.json")) { + return withDevbox( + client + .pipeline(pipeline) + .container() + .from("alpine:latest") + .withExec(["apk", "update"]) + .withExec(["apk", "add", "bash", "curl"]) + .withMountedCache("/nix", client.cacheVolume("nix")) + .withMountedCache("/etc/nix", client.cacheVolume("nix-etc")) + ); + } + return client.pipeline(pipeline).container().from("denoland/deno:alpine"); +}; + +export const lint = async (client: Client, src = ".") => { + const context = client.host().directory(src); + let command = ["deno", "lint"]; + + if (existsSync("devbox.json")) { + command = ["sh", "-c", `devbox run -- ${command.join(" ")}`]; + } + + const ctr = baseCtr(client, Job.lint) + .withDirectory("/app", context, { + exclude: [".git", ".devbox", ".fluentci"], + }) + .withWorkdir("/app") + .withExec(command); + + const result = await ctr.stdout(); + + console.log(result); +}; + +export const fmt = async (client: Client, src = ".") => { + const context = client.host().directory(src); + let command = ["deno", "fmt"]; + + if (existsSync("devbox.json")) { + command = ["sh", "-c", `devbox run -- ${command.join(" ")}`]; + } + + const ctr = baseCtr(client, Job.fmt) + .withDirectory("/app", context, { + exclude: [".git", ".devbox", ".fluentci"], + }) + .withWorkdir("/app") + .withExec(command); + + const result = await ctr.stdout(); + + console.log(result); +}; + +export const test = async ( + client: Client, + src = ".", + options: { ignore: string[] } = { ignore: [] } +) => { + const context = client.host().directory(src); + let command = ["deno", "test", "-A", "--lock-write"]; + + if (options.ignore.length > 0) { + command = command.concat([`--ignore=${options.ignore.join(",")}`]); + } + + if (existsSync("devbox.json")) { + command = ["sh", "-c", `devbox run -- ${command.join(" ")}`]; + } + + const ctr = baseCtr(client, Job.test) + .from("denoland/deno:alpine") + .withDirectory("/app", context, { + exclude: [".git", ".devbox", ".fluentci"], + }) + .withWorkdir("/app") + .withMountedCache("/root/.cache/deno", client.cacheVolume("deno-cache")) + .withExec(command); + + const result = await ctr.stdout(); + + console.log(result); +}; + +export const deploy = async (client: Client, src = ".") => { + const context = client.host().directory(src); + let installDeployCtl = [ + "deno", + "install", + "--allow-all", + "--no-check", + "-r", + "-f", + "https://deno.land/x/deploy/deployctl.ts", + ]; + const project = Deno.env.get("DENO_PROJECT"); + const noStatic = Deno.env.get("NO_STATIC"); + const exclude = Deno.env.get("EXCLUDE"); + + let command = ["deployctl", "deploy"]; + + if (noStatic) { + command = command.concat(["--no-static"]); + } + + if (exclude) { + command = command.concat([`--exclude=${exclude}`]); + } + + if (!Deno.env.get("DENO_DEPLOY_TOKEN")) { + throw new Error("DENO_DEPLOY_TOKEN environment variable is not set"); + } + + if (!project) { + throw new Error("DENO_PROJECT environment variable is not set"); + } + + const script = Deno.env.get("DENO_MAIN_SCRIPT") || "main.tsx"; + command = command.concat([`--project=${project}`, script]); + + if (existsSync("devbox.json")) { + command = ["sh", "-c", `devbox run -- ${command.join(" ")}`]; + installDeployCtl = [ + "sh", + "-c", + `devbox run -- ${installDeployCtl.join(" ")}`, + ]; + } + + const ctr = baseCtr(client, Job.deploy) + .from("denoland/deno:alpine") + .withDirectory("/app", context, { + exclude: [".git", ".devbox", ".fluentci"], + }) + .withWorkdir("/app") + .withEnvVariable("PATH", "/root/.deno/bin:$PATH", { expand: true }) + .withEnvVariable("DENO_DEPLOY_TOKEN", Deno.env.get("DENO_DEPLOY_TOKEN")!) + .withEnvVariable( + "DENO_MAIN_SCRIPT", + Deno.env.get("DENO_MAIN_SCRIPT") || "main.tsx" + ) + .withExec(installDeployCtl) + .withExec(command); + + const result = await ctr.stdout(); + + console.log(result); +}; + +export type JobExec = ( + client: Client, + src?: string +) => + | Promise + | (( + client: Client, + src?: string, + options?: { + ignore: string[]; + } + ) => Promise); + +export const runnableJobs: Record = { + [Job.fmt]: fmt, + [Job.lint]: lint, + [Job.test]: test, + [Job.deploy]: deploy, +}; + +export const jobDescriptions: Record = { + [Job.fmt]: "Format your code", + [Job.lint]: "Lint your code", + [Job.test]: "Run your tests", + [Job.deploy]: "Deploy your code to Deno Deploy", +}; diff --git a/example/.fluentci/.fluentci/example/.fluentci/src/dagger/list_jobs.ts b/example/.fluentci/.fluentci/example/.fluentci/src/dagger/list_jobs.ts new file mode 100644 index 0000000..12bb3cb --- /dev/null +++ b/example/.fluentci/.fluentci/example/.fluentci/src/dagger/list_jobs.ts @@ -0,0 +1,21 @@ +import { brightGreen } from "https://deno.land/std@0.191.0/fmt/colors.ts"; +import { runnableJobs, jobDescriptions, Job } from "./jobs.ts"; +import { stringifyTree } from "https://esm.sh/stringify-tree@1.1.1"; + +const tree = { + name: brightGreen("deno_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/.fluentci/example/.fluentci/src/dagger/pipeline.ts b/example/.fluentci/.fluentci/example/.fluentci/src/dagger/pipeline.ts new file mode 100644 index 0000000..bad7372 --- /dev/null +++ b/example/.fluentci/.fluentci/example/.fluentci/src/dagger/pipeline.ts @@ -0,0 +1,27 @@ +import Client, { connect } from "@dagger.io/dagger"; +import * as jobs from "./jobs.ts"; + +const { fmt, lint, test, runnableJobs } = jobs; + +export default function pipeline(src = ".", args: string[] = []) { + connect(async (client: Client) => { + if (args.length > 0) { + await runSpecificJobs(client, args as jobs.Job[]); + return; + } + + await fmt(client, src); + await lint(client, src); + await test(client, src); + }); +} + +async function runSpecificJobs(client: Client, args: jobs.Job[]) { + for (const name of args) { + const job = runnableJobs[name]; + if (!job) { + throw new Error(`Job ${name} not found`); + } + await job(client); + } +} diff --git a/example/.fluentci/.fluentci/example/.fluentci/src/dagger/runner.ts b/example/.fluentci/.fluentci/example/.fluentci/src/dagger/runner.ts new file mode 100644 index 0000000..e23879e --- /dev/null +++ b/example/.fluentci/.fluentci/example/.fluentci/src/dagger/runner.ts @@ -0,0 +1,3 @@ +import pipeline from "./pipeline.ts"; + +pipeline(".", Deno.args); diff --git a/example/.fluentci/.fluentci/example/.fluentci/src/gitlab/index.ts b/example/.fluentci/.fluentci/example/.fluentci/src/gitlab/index.ts new file mode 100644 index 0000000..392c001 --- /dev/null +++ b/example/.fluentci/.fluentci/example/.fluentci/src/gitlab/index.ts @@ -0,0 +1,4 @@ +import pipeline from "./pipeline.ts"; +import { fmt, lint, test } from "./jobs.ts"; + +export { fmt, lint, pipeline, test }; diff --git a/example/.fluentci/.fluentci/example/.fluentci/src/gitlab/jobs.ts b/example/.fluentci/.fluentci/example/.fluentci/src/gitlab/jobs.ts new file mode 100644 index 0000000..46be50c --- /dev/null +++ b/example/.fluentci/.fluentci/example/.fluentci/src/gitlab/jobs.ts @@ -0,0 +1,9 @@ +import { Job } from "https://deno.land/x/fluent_gitlab_ci@v0.3.2/mod.ts"; + +export const fmt = new Job() + .image("denoland/deno:alpine") + .script("deno fmt --check"); + +export const lint = new Job().image("denoland/deno:alpine").script("deno lint"); + +export const test = new Job().image("denoland/deno:alpine").script("deno test"); diff --git a/example/.fluentci/.fluentci/example/.fluentci/src/gitlab/pipeline.ts b/example/.fluentci/.fluentci/example/.fluentci/src/gitlab/pipeline.ts new file mode 100644 index 0000000..366de64 --- /dev/null +++ b/example/.fluentci/.fluentci/example/.fluentci/src/gitlab/pipeline.ts @@ -0,0 +1,10 @@ +import { GitlabCI } from "https://deno.land/x/fluent_gitlab_ci@v0.3.2/mod.ts"; +import { fmt, lint, test } from "./jobs.ts"; + +const pipeline = new GitlabCI() + .image("denoland/deno:alpine") + .addJob("fmt", fmt) + .addJob("lint", lint) + .addJob("test", test); + +export default pipeline; diff --git a/example/.fluentci/.fluentci/example/.fluentci/src/gitlab/pipeline_test.ts b/example/.fluentci/.fluentci/example/.fluentci/src/gitlab/pipeline_test.ts new file mode 100644 index 0000000..ca24710 --- /dev/null +++ b/example/.fluentci/.fluentci/example/.fluentci/src/gitlab/pipeline_test.ts @@ -0,0 +1,8 @@ +import pipeline from "./pipeline.ts"; +import { assertEquals } from "https://deno.land/std@0.191.0/testing/asserts.ts"; + +Deno.test(function pipelineTest() { + const expected = Deno.readTextFileSync("./fixtures/.gitlab-ci.yml"); + const actual = pipeline.toString(); + assertEquals(actual, expected); +}); diff --git a/example/.fluentci/.fluentci/example/.vscode/settings.json b/example/.fluentci/.fluentci/example/.vscode/settings.json new file mode 100644 index 0000000..cbac569 --- /dev/null +++ b/example/.fluentci/.fluentci/example/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "deno.enable": true +} diff --git a/example/.fluentci/.fluentci/example/README.md b/example/.fluentci/.fluentci/example/README.md new file mode 100644 index 0000000..a6193e1 --- /dev/null +++ b/example/.fluentci/.fluentci/example/README.md @@ -0,0 +1,16 @@ +# Deno Pipeline Example + +This is an example using the [Deno Pipeline](https://github.com/fluent-ci-templates/deno-pipeline). + +## ๐Ÿš€ Usage + +You need to set the following environment variables: + +- `DENO_DEPLOY_TOKEN`: Your Deno Deploy token. +- `DENO_PROJECT`: Your project name. + +Then, run the following command: + +```bash +dagger run fluentci . fmt lint deploy +``` \ No newline at end of file diff --git a/example/.fluentci/.fluentci/example/main.tsx b/example/.fluentci/.fluentci/example/main.tsx new file mode 100644 index 0000000..dd48266 --- /dev/null +++ b/example/.fluentci/.fluentci/example/main.tsx @@ -0,0 +1,20 @@ +/** @jsx h */ +import { serve } from "https://deno.land/std@0.190.0/http/server.ts"; +import html, { h } from "https://deno.land/x/htm@0.2.1/mod.ts"; + +const handler = (req: Request) => + html({ + title: "Hello World!", + styles: [ + "html, body { margin: 0; height: 100%; }", + "body { background: #86efac; display: flex; flex-direction: column; align-items: center; justify-content: center; }", + ], + body: ( + + +

Hello Patricia!

+ + ), + }); + +serve(handler); diff --git a/example/.fluentci/.fluentci/fixtures/.gitlab-ci.yml b/example/.fluentci/.fluentci/fixtures/.gitlab-ci.yml new file mode 100644 index 0000000..299e4c6 --- /dev/null +++ b/example/.fluentci/.fluentci/fixtures/.gitlab-ci.yml @@ -0,0 +1,19 @@ +# Do not edit this file directly. It is generated by Fluent GitLab CI + +image: denoland/deno:alpine + +fmt: + image: denoland/deno:alpine + script: + - deno fmt --check + +lint: + image: denoland/deno:alpine + script: + - deno lint + +test: + image: denoland/deno:alpine + script: + - deno test + diff --git a/example/.fluentci/.fluentci/flake.lock b/example/.fluentci/.fluentci/flake.lock new file mode 100644 index 0000000..af7453c --- /dev/null +++ b/example/.fluentci/.fluentci/flake.lock @@ -0,0 +1,61 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1687709756, + "narHash": "sha256-Y5wKlQSkgEK2weWdOu4J3riRd+kV/VCgHsqLNTTWQ/0=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "dbabf0ca0c0c4bce6ea5eaf65af5cb694d2082c7", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1688910226, + "narHash": "sha256-kLTsFu9CAU2Gb288JhIBN/WlX4UUUDz4WiC/U59nvwk=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "2540432a940aee979be6ccfefba9ea0652c273a0", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "release-23.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/example/.fluentci/.fluentci/flake.nix b/example/.fluentci/.fluentci/flake.nix new file mode 100644 index 0000000..b13ea7d --- /dev/null +++ b/example/.fluentci/.fluentci/flake.nix @@ -0,0 +1,26 @@ +{ + description = "A Nix-flake-based Deno development environment"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/release-23.05"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { + self, + nixpkgs, + flake-utils, + }: + flake-utils.lib.eachDefaultSystem + (system: let + pkgs = import nixpkgs { + inherit system; + }; + in { + devShells.default = pkgs.mkShell { + buildInputs = [ + pkgs.deno + ]; + }; + }); +} \ No newline at end of file diff --git a/example/.fluentci/.fluentci/import_map.json b/example/.fluentci/.fluentci/import_map.json new file mode 100644 index 0000000..12c59ff --- /dev/null +++ b/example/.fluentci/.fluentci/import_map.json @@ -0,0 +1,28 @@ +{ + "imports": { + "@dagger.io/dagger": "https://esm.sh/v128/*@dagger.io/dagger@0.6.3", + "fluent_gitlab_ci": "https://deno.land/x/fluent_gitlab_ci@v0.3.2/mod.ts", + "fluent_github_actions": "https://deno.land/x/fluent_github_actions@v0.1.2/mod.ts", + "url": "node:url", + "readline": "node:readline", + "process": "node:process", + "path": "node:path", + "os": "node:os", + "fs": "node:fs", + "crypto": "node:crypto" + }, + "scopes": { + "https://esm.sh/v128/": { + "@lifeomic/axios-fetch": "https://esm.sh/v128/@lifeomic/axios-fetch@3.0.1", + "adm-zip": "https://esm.sh/v128/adm-zip@0.5.10", + "env-paths": "https://esm.sh/v128/env-paths@3.0.0", + "execa": "https://esm.sh/v128/execa@7.1.1", + "graphql-request": "https://esm.sh/v128/graphql-request@6.1.0", + "graphql-tag": "https://esm.sh/v128/graphql-tag@2.12.6", + "graphql": "https://esm.sh/v128/graphql@16.7.1", + "node-color-log": "https://esm.sh/v128/node-color-log@10.0.2", + "node-fetch": "https://esm.sh/v128/node-fetch@3.3.1", + "tar": "https://esm.sh/v128/tar@6.1.15" + } + } +} \ No newline at end of file diff --git a/example/.fluentci/.fluentci/mod.ts b/example/.fluentci/.fluentci/mod.ts new file mode 100644 index 0000000..6152fb6 --- /dev/null +++ b/example/.fluentci/.fluentci/mod.ts @@ -0,0 +1,4 @@ +import * as GitLab from "./src/gitlab/index.ts"; +import * as Dagger from "./src/dagger/index.ts"; + +export { Dagger, GitLab }; diff --git a/example/.fluentci/.fluentci/src/dagger/index.ts b/example/.fluentci/.fluentci/src/dagger/index.ts new file mode 100644 index 0000000..392c001 --- /dev/null +++ b/example/.fluentci/.fluentci/src/dagger/index.ts @@ -0,0 +1,4 @@ +import pipeline from "./pipeline.ts"; +import { fmt, lint, test } from "./jobs.ts"; + +export { fmt, lint, pipeline, test }; diff --git a/example/.fluentci/.fluentci/src/dagger/jobs.ts b/example/.fluentci/.fluentci/src/dagger/jobs.ts new file mode 100644 index 0000000..862b599 --- /dev/null +++ b/example/.fluentci/.fluentci/src/dagger/jobs.ts @@ -0,0 +1,197 @@ +import Client from "@dagger.io/dagger"; +import { upload } from "https://deno.land/x/codecov_pipeline@v0.1.1/src/dagger/jobs.ts"; +import { withDevbox } from "https://deno.land/x/nix_installer_pipeline@v0.3.6/src/dagger/steps.ts"; +import { existsSync } from "fs"; + +export enum Job { + fmt = "fmt", + lint = "lint", + test = "test", + deploy = "deploy", + codecov = "codecov", +} + +const baseCtr = (client: Client, pipeline: string) => { + if (existsSync("devbox.json")) { + return withDevbox( + client + .pipeline(pipeline) + .container() + .from("alpine:latest") + .withExec(["apk", "update"]) + .withExec(["apk", "add", "bash", "curl"]) + .withMountedCache("/nix", client.cacheVolume("nix")) + .withMountedCache("/etc/nix", client.cacheVolume("nix-etc")) + ); + } + return client.pipeline(pipeline).container().from("denoland/deno:alpine"); +}; + +export const lint = async (client: Client, src = ".") => { + const context = client.host().directory(src); + let command = ["deno", "lint"]; + + if (existsSync("devbox.json")) { + command = ["sh", "-c", `devbox run -- ${command.join(" ")}`]; + } + + const ctr = baseCtr(client, Job.lint) + .withDirectory("/app", context, { + exclude: [".git", ".devbox", ".fluentci"], + }) + .withWorkdir("/app") + .withExec(command); + + const result = await ctr.stdout(); + + console.log(result); +}; + +export const fmt = async (client: Client, src = ".") => { + const context = client.host().directory(src); + let command = ["deno", "fmt"]; + + if (existsSync("devbox.json")) { + command = ["sh", "-c", `devbox run -- ${command.join(" ")}`]; + } + + const ctr = baseCtr(client, Job.fmt) + .withDirectory("/app", context, { + exclude: [".git", ".devbox", ".fluentci"], + }) + .withWorkdir("/app") + .withExec(command); + + const result = await ctr.stdout(); + + console.log(result); +}; + +export const test = async ( + client: Client, + src = ".", + options: { ignore: string[] } = { ignore: [] } +) => { + const context = client.host().directory(src); + let command = ["deno", "test", "-A", "--coverage=coverage", "--lock-write"]; + + if (options.ignore.length > 0) { + command = command.concat([`--ignore=${options.ignore.join(",")}`]); + } + + if (existsSync("devbox.json")) { + command = ["sh", "-c", `devbox run -- ${command.join(" ")}`]; + } + + const ctr = baseCtr(client, Job.test) + .from("denoland/deno:alpine") + .withDirectory("/app", context, { + exclude: [".git", ".devbox", ".fluentci"], + }) + .withWorkdir("/app") + .withMountedCache("/root/.cache/deno", client.cacheVolume("deno-cache")) + .withExec(command) + .withExec(["sh", "-c", "deno coverage ./coverage --lcov > coverage.lcov"]); + + const result = await ctr.stdout(); + + await ctr.file("/app/coverage.lcov").export("./coverage.lcov"); + + console.log(result); +}; + +export const deploy = async (client: Client, src = ".") => { + const context = client.host().directory(src); + let installDeployCtl = [ + "deno", + "install", + "--allow-all", + "--no-check", + "-r", + "-f", + "https://deno.land/x/deploy/deployctl.ts", + ]; + const project = Deno.env.get("DENO_PROJECT"); + const noStatic = Deno.env.get("NO_STATIC"); + const exclude = Deno.env.get("EXCLUDE"); + + let command = ["deployctl", "deploy"]; + + if (noStatic) { + command = command.concat(["--no-static"]); + } + + if (exclude) { + command = command.concat([`--exclude=${exclude}`]); + } + + if (!Deno.env.get("DENO_DEPLOY_TOKEN")) { + throw new Error("DENO_DEPLOY_TOKEN environment variable is not set"); + } + + if (!project) { + throw new Error("DENO_PROJECT environment variable is not set"); + } + + const script = Deno.env.get("DENO_MAIN_SCRIPT") || "main.tsx"; + command = command.concat([`--project=${project}`, script]); + + if (existsSync("devbox.json")) { + command = ["sh", "-c", `devbox run -- ${command.join(" ")}`]; + installDeployCtl = [ + "sh", + "-c", + `devbox run -- ${installDeployCtl.join(" ")}`, + ]; + } + + const ctr = baseCtr(client, Job.deploy) + .from("denoland/deno:alpine") + .withDirectory("/app", context, { + exclude: [".git", ".devbox", ".fluentci"], + }) + .withWorkdir("/app") + .withEnvVariable("PATH", "/root/.deno/bin:$PATH", { expand: true }) + .withEnvVariable("DENO_DEPLOY_TOKEN", Deno.env.get("DENO_DEPLOY_TOKEN")!) + .withEnvVariable( + "DENO_MAIN_SCRIPT", + Deno.env.get("DENO_MAIN_SCRIPT") || "main.tsx" + ) + .withExec(installDeployCtl) + .withExec(command); + + const result = await ctr.stdout(); + + console.log(result); +}; + +export type JobExec = ( + client: Client, + src?: string +) => + | Promise + | (( + client: Client, + src?: string, + options?: { + ignore: string[]; + } + ) => Promise); + +export const codecov = upload; + +export const runnableJobs: Record = { + [Job.fmt]: fmt, + [Job.lint]: lint, + [Job.test]: test, + [Job.deploy]: deploy, + [Job.codecov]: upload, +}; + +export const jobDescriptions: Record = { + [Job.fmt]: "Format your code", + [Job.lint]: "Lint your code", + [Job.test]: "Run your tests", + [Job.deploy]: "Deploy your code to Deno Deploy", + [Job.codecov]: "Upload your code coverage to Codecov", +}; diff --git a/example/.fluentci/.fluentci/src/dagger/list_jobs.ts b/example/.fluentci/.fluentci/src/dagger/list_jobs.ts new file mode 100644 index 0000000..12bb3cb --- /dev/null +++ b/example/.fluentci/.fluentci/src/dagger/list_jobs.ts @@ -0,0 +1,21 @@ +import { brightGreen } from "https://deno.land/std@0.191.0/fmt/colors.ts"; +import { runnableJobs, jobDescriptions, Job } from "./jobs.ts"; +import { stringifyTree } from "https://esm.sh/stringify-tree@1.1.1"; + +const tree = { + name: brightGreen("deno_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/.fluentci/src/dagger/pipeline.ts b/example/.fluentci/.fluentci/src/dagger/pipeline.ts new file mode 100644 index 0000000..bad7372 --- /dev/null +++ b/example/.fluentci/.fluentci/src/dagger/pipeline.ts @@ -0,0 +1,27 @@ +import Client, { connect } from "@dagger.io/dagger"; +import * as jobs from "./jobs.ts"; + +const { fmt, lint, test, runnableJobs } = jobs; + +export default function pipeline(src = ".", args: string[] = []) { + connect(async (client: Client) => { + if (args.length > 0) { + await runSpecificJobs(client, args as jobs.Job[]); + return; + } + + await fmt(client, src); + await lint(client, src); + await test(client, src); + }); +} + +async function runSpecificJobs(client: Client, args: jobs.Job[]) { + for (const name of args) { + const job = runnableJobs[name]; + if (!job) { + throw new Error(`Job ${name} not found`); + } + await job(client); + } +} diff --git a/example/.fluentci/.fluentci/src/dagger/runner.ts b/example/.fluentci/.fluentci/src/dagger/runner.ts new file mode 100644 index 0000000..e23879e --- /dev/null +++ b/example/.fluentci/.fluentci/src/dagger/runner.ts @@ -0,0 +1,3 @@ +import pipeline from "./pipeline.ts"; + +pipeline(".", Deno.args); diff --git a/example/.fluentci/.fluentci/src/github/config.ts b/example/.fluentci/.fluentci/src/github/config.ts new file mode 100644 index 0000000..1e6b7a0 --- /dev/null +++ b/example/.fluentci/.fluentci/src/github/config.ts @@ -0,0 +1,52 @@ +import { JobSpec, Workflow } from "fluent_github_actions"; + +export function generateYaml() { + const workflow = new Workflow("Codecov"); + + const push = { + branches: ["main"], + }; + + const setupDagger = `\ + curl -L https://dl.dagger.io/dagger/install.sh | DAGGER_VERSION=0.8.1 sh + sudo mv bin/dagger /usr/local/bin + dagger version`; + + const tests: JobSpec = { + "runs-on": "ubuntu-latest", + steps: [ + { + uses: "actions/checkout@v2", + }, + { + uses: "denolib/setup-deno@v2", + with: { + "deno-version": "v1.36", + }, + }, + { + name: "Setup Fluent CI CLI", + run: "deno install -A -r https://cli.fluentci.io -n fluentci", + }, + { + name: "Setup Dagger", + run: setupDagger, + }, + { + name: "Run Dagger Pipelines", + run: "dagger run fluentci . fmt lint test", + }, + { + name: "Upload to Codecov", + run: "dagger run fluentci codecov_pipeline", + env: { + CODECOV_TOKEN: "${{ secrets.CODECOV_TOKEN }}", + }, + }, + ], + }; + + workflow.on({ push }).jobs({ tests }); + + workflow.save(".github/workflows/ci.yml"); +} diff --git a/example/.fluentci/.fluentci/src/github/init.ts b/example/.fluentci/.fluentci/src/github/init.ts new file mode 100644 index 0000000..6097dd5 --- /dev/null +++ b/example/.fluentci/.fluentci/src/github/init.ts @@ -0,0 +1,3 @@ +import { generateYaml } from "./config.ts"; + +generateYaml(); diff --git a/example/.fluentci/.fluentci/src/gitlab/index.ts b/example/.fluentci/.fluentci/src/gitlab/index.ts new file mode 100644 index 0000000..392c001 --- /dev/null +++ b/example/.fluentci/.fluentci/src/gitlab/index.ts @@ -0,0 +1,4 @@ +import pipeline from "./pipeline.ts"; +import { fmt, lint, test } from "./jobs.ts"; + +export { fmt, lint, pipeline, test }; diff --git a/example/.fluentci/.fluentci/src/gitlab/jobs.ts b/example/.fluentci/.fluentci/src/gitlab/jobs.ts new file mode 100644 index 0000000..46be50c --- /dev/null +++ b/example/.fluentci/.fluentci/src/gitlab/jobs.ts @@ -0,0 +1,9 @@ +import { Job } from "https://deno.land/x/fluent_gitlab_ci@v0.3.2/mod.ts"; + +export const fmt = new Job() + .image("denoland/deno:alpine") + .script("deno fmt --check"); + +export const lint = new Job().image("denoland/deno:alpine").script("deno lint"); + +export const test = new Job().image("denoland/deno:alpine").script("deno test"); diff --git a/example/.fluentci/.fluentci/src/gitlab/pipeline.ts b/example/.fluentci/.fluentci/src/gitlab/pipeline.ts new file mode 100644 index 0000000..366de64 --- /dev/null +++ b/example/.fluentci/.fluentci/src/gitlab/pipeline.ts @@ -0,0 +1,10 @@ +import { GitlabCI } from "https://deno.land/x/fluent_gitlab_ci@v0.3.2/mod.ts"; +import { fmt, lint, test } from "./jobs.ts"; + +const pipeline = new GitlabCI() + .image("denoland/deno:alpine") + .addJob("fmt", fmt) + .addJob("lint", lint) + .addJob("test", test); + +export default pipeline; diff --git a/example/.fluentci/.fluentci/src/gitlab/pipeline_test.ts b/example/.fluentci/.fluentci/src/gitlab/pipeline_test.ts new file mode 100644 index 0000000..ca24710 --- /dev/null +++ b/example/.fluentci/.fluentci/src/gitlab/pipeline_test.ts @@ -0,0 +1,8 @@ +import pipeline from "./pipeline.ts"; +import { assertEquals } from "https://deno.land/std@0.191.0/testing/asserts.ts"; + +Deno.test(function pipelineTest() { + const expected = Deno.readTextFileSync("./fixtures/.gitlab-ci.yml"); + const actual = pipeline.toString(); + assertEquals(actual, expected); +}); diff --git a/example/.fluentci/.github/workflows/ci.yml b/example/.fluentci/.github/workflows/ci.yml index 3ac7dd7..faabe80 100644 --- a/example/.fluentci/.github/workflows/ci.yml +++ b/example/.fluentci/.github/workflows/ci.yml @@ -1,28 +1,28 @@ -name: Codecov +# Do not edit this file directly. It is generated by Fluent Github Actions -# Controls when the action will run. Triggers the workflow on push or pull request -# events but only for the master branch +name: Codecov on: push: - branches: [main] - pull_request: - branches: [main] - + branches: + - main jobs: - test: + tests: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - uses: denolib/setup-deno@v2 with: - deno-version: v1.34 - - name: Create coverage files - run: deno test --allow-read --coverage=coverage --lock-write # create coverage files - - name: Create coverage report - run: deno coverage ./coverage --lcov > coverage.lcov # create coverage report - - name: Collect coverage - uses: codecov/codecov-action@v3 # upload the report on Codecov + deno-version: v1.36 + - 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: dagger run fluentci . fmt lint test + - name: Upload to Codecov + run: dagger run fluentci codecov_pipeline env: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - with: - file: ./coverage.lcov diff --git a/example/.fluentci/README.md b/example/.fluentci/README.md index 172bf64..8783228 100644 --- a/example/.fluentci/README.md +++ b/example/.fluentci/README.md @@ -4,95 +4,42 @@ ![deno compatibility](https://shield.deno.dev/deno/^1.34) [![](https://img.shields.io/codecov/c/gh/fluent-ci-templates/django-pipeline)](https://codecov.io/gh/fluent-ci-templates/django-pipeline) -A ready-to-use GitLab CI Pipeline and Jobs for your Django projects. +A ready-to-use CI/CD Pipeline for your Django projects. ## ๐Ÿš€ Usage -Quick start: +Run the following command: -```ts -import { GitLab } from "https://deno.land/x/django_pipeline/mod.ts"; +```bash +dagger run fluentci django_pipeline +``` -const { pipeline } = GitLab; +Or, if you want to use it as a template: -pipeline.write(); // Write the pipeline to the file .gitlab-ci.yml +```bash +fluentci init -t django ``` -Or, if you want to use the predefined jobs: +This will create a `.fluentci` folder in your project. -```ts -import { GitlabCI } from "https://deno.land/x/fluent_gitlab_ci/mod.ts"; -import { GitLab } from "https://deno.land/x/django_pipeline/mod.ts"; - -const { install, migrations, djangoTests } = GitLab; - -const const pipeline = new GitlabCI() - .variables({ - MYSQL_DATABASE: "$MYSQL_DB", - MYSQL_ROOT_PASSWORD: "$MYSQL_PASS", - MYSQL_USER: "$MYSQL_USER", - MYSQL_PASSWORD: "$MYSQL_PASS", - }) - .addJob("install", install) - .addJob("migrations", migrations) - .addJob("django-tests", djangoTests); - -pipeline.write(); // Write the pipeline to the file .gitlab-ci.yml -``` +Now you can run the pipeline with: -It will generate the following `.gitlab-ci.yml` file: - -```yaml -# Do not edit this file directly. It is generated by Fluent GitLab CI - -variables: - MYSQL_DATABASE: $MYSQL_DB - MYSQL_ROOT_PASSWORD: $MYSQL_PASS - MYSQL_USER: $MYSQL_USER - MYSQL_PASSWORD: $MYSQL_PASS - -install: - image: ubuntu:20.04 - services: - - mysql:8.0 - cache: - paths: - - ~/.cache/pip/ - before_script: - - apt -y update - - apt -y install apt-utils - - apt -y install net-tools python3.8 python3-pip mysql-client libmysqlclient-dev - - apt -y upgrade - - pip3 install -r requirements.txt - -migrations: - stage: build - script: - - python3 manage.py makemigrations - - python3 manage.py migrate - - python3 manage.py check - -django-tests: - stage: test - script: - - echo "GRANT ALL on *.* to '${MYSQL_USER}';"| mysql -u root --password="${MYSQL_ROOT_PASSWORD}" -h mysql - - python3 manage.py test +```bash +dagger run fluentci . ``` +## Jobs -## ๐Ÿงช Advanced Usage +| Job | Description | +| ----------- | ---------------- | +| djangoTests | Run your tests | -This package also provides a ready-to-use pipeline for -[Dagger](https://dagger.io/), just run the following command on your Django project: +## Programmatic usage -```sh -dagger run deno run -A https://deno.land/x/django_pipeline/ci.ts -``` - -Or, if you want to use the predefined jobs: +You can also use this pipeline programmatically: ```ts -import Client, { connect } from "@dagger.io/dagger"; +import { Client, connect } from "https://esm.sh/@dagger.io/dagger@0.8.1"; import { Dagger } from "https://deno.land/x/django_pipeline/mod.ts"; const { djangoTests } = Dagger; @@ -104,4 +51,4 @@ function pipeline(src = ".") { } pipeline(); -``` \ No newline at end of file +``` diff --git a/example/.fluentci/deno.json b/example/.fluentci/deno.json index 9f6bbca..d976349 100644 --- a/example/.fluentci/deno.json +++ b/example/.fluentci/deno.json @@ -4,5 +4,14 @@ "esm:add": "deno run -A https://esm.sh/v128 add", "esm:update": "deno run -A https://esm.sh/v128 update", "esm:remove": "deno run -A https://esm.sh/v128 remove" + }, + "fmt": { + "exclude": ["example/", ".fluentci/"] + }, + "lint": { + "exclude": ["example/", ".fluentci/"] + }, + "test": { + "exclude": ["example/", ".fluentci/"] } -} \ No newline at end of file +} diff --git a/example/.fluentci/deno.lock b/example/.fluentci/deno.lock index ff48dad..3d0a650 100644 --- a/example/.fluentci/deno.lock +++ b/example/.fluentci/deno.lock @@ -1,94 +1,50 @@ { "version": "2", "remote": { - "https://deno.land/std@0.150.0/media_types/_util.ts": "ce9b4fc4ba1c447dafab619055e20fd88236ca6bdd7834a21f98bd193c3fbfa1", - "https://deno.land/std@0.150.0/media_types/mod.ts": "2d4b6f32a087029272dc59e0a55ae3cc4d1b27b794ccf528e94b1925795b3118", - "https://deno.land/std@0.150.0/media_types/vendor/mime-db.v1.52.0.ts": "724cee25fa40f1a52d3937d6b4fbbfdd7791ff55e1b7ac08d9319d5632c7f5af", "https://deno.land/std@0.191.0/fmt/colors.ts": "d67e3cd9f472535241a8e410d33423980bec45047e343577554d3356e1f0ef4e", "https://deno.land/std@0.191.0/testing/_diff.ts": "1a3c044aedf77647d6cac86b798c6417603361b66b54c53331b312caeb447aea", "https://deno.land/std@0.191.0/testing/_format.ts": "a69126e8a469009adf4cf2a50af889aca364c349797e63174884a52ff75cf4c7", "https://deno.land/std@0.191.0/testing/asserts.ts": "e16d98b4d73ffc4ed498d717307a12500ae4f2cbe668f1a215632d19fcffc22f", - "https://deno.land/x/fluent_gitlab_ci@v0.3.2/mod.ts": "3becefe569f5c9814dffa1b534794a42b948481753a5903fa1b48d5337206ced", - "https://deno.land/x/fluent_gitlab_ci@v0.3.2/src/environment.ts": "f12ee4fb50e5100fccec29dc1d35aa430bfe8373e84286a8ab9f7b8e178f14e3", - "https://deno.land/x/fluent_gitlab_ci@v0.3.2/src/gitlabci.ts": "85d2335622c2def4a9554a9d8b8de4e62156f5d76d59a553e157bab4e6b6591f", - "https://deno.land/x/fluent_gitlab_ci@v0.3.2/src/gitlabci_spec.ts": "b60f40ecf26d243db2391aee70fdf71b133de3faaf789052020f58f98cf1b500", - "https://deno.land/x/fluent_gitlab_ci@v0.3.2/src/index.ts": "b5e374a24e3bca1d6fead0861f2c1b1e09e087a17e59297263f681ee71c972fe", - "https://deno.land/x/fluent_gitlab_ci@v0.3.2/src/job.ts": "a1ddf8d37ca33239de9d2c61f98835e585f6671748b37af8d647ebba5e1a9974", - "https://deno.land/x/nix_installer_pipeline@v0.3.1/mod.ts": "60bbaf1da28b5324666c42469dc19ca15114956f98c2854a02073ed83c02284f", - "https://deno.land/x/nix_installer_pipeline@v0.3.1/src/dagger/index.ts": "d513528cce932d77b76519af86b44f2b249c867bcfa9f6349242b88c5a99f079", - "https://deno.land/x/nix_installer_pipeline@v0.3.1/src/dagger/steps.ts": "1dbeeb6d60ffdccd19fee88d35fa983619555be6ba55404be491bffa0874648e", - "https://deno.land/x/nix_installer_pipeline@v0.3.1/src/gitlab/index.ts": "1724b883cf33830a46160fcb048acddb1003be571dabf8df076db365d5349b80", - "https://deno.land/x/nix_installer_pipeline@v0.3.1/src/gitlab/pipeline.ts": "ed6eefe6f7bad5732ef8eb21860d77e6782ab5c7ce09377bc3e38411494c7ad8", - "https://deno.land/x/nix_installer_pipeline@v0.3.2/mod.ts": "60bbaf1da28b5324666c42469dc19ca15114956f98c2854a02073ed83c02284f", - "https://deno.land/x/nix_installer_pipeline@v0.3.2/src/dagger/index.ts": "d513528cce932d77b76519af86b44f2b249c867bcfa9f6349242b88c5a99f079", - "https://deno.land/x/nix_installer_pipeline@v0.3.2/src/dagger/steps.ts": "a5c7917898bf73e66c81e6634f8b2357440ccd12919aca9888671def49403d2b", - "https://deno.land/x/nix_installer_pipeline@v0.3.2/src/gitlab/index.ts": "1724b883cf33830a46160fcb048acddb1003be571dabf8df076db365d5349b80", - "https://deno.land/x/nix_installer_pipeline@v0.3.2/src/gitlab/pipeline.ts": "ed6eefe6f7bad5732ef8eb21860d77e6782ab5c7ce09377bc3e38411494c7ad8", - "https://deno.land/x/nix_installer_pipeline@v0.3.3/mod.ts": "60bbaf1da28b5324666c42469dc19ca15114956f98c2854a02073ed83c02284f", - "https://deno.land/x/nix_installer_pipeline@v0.3.3/src/dagger/index.ts": "d513528cce932d77b76519af86b44f2b249c867bcfa9f6349242b88c5a99f079", - "https://deno.land/x/nix_installer_pipeline@v0.3.3/src/dagger/steps.ts": "05ef2931080fe9771f27f322a6ace921bf3df8143b5599cd92409fe25568e613", - "https://deno.land/x/nix_installer_pipeline@v0.3.3/src/gitlab/index.ts": "1724b883cf33830a46160fcb048acddb1003be571dabf8df076db365d5349b80", - "https://deno.land/x/nix_installer_pipeline@v0.3.3/src/gitlab/pipeline.ts": "ed6eefe6f7bad5732ef8eb21860d77e6782ab5c7ce09377bc3e38411494c7ad8", - "https://deno.land/x/nix_installer_pipeline@v0.3.6/src/dagger/steps.ts": "a34aea3753c7079de5877f592ce31f30d05d552155729ff3e695d77326405133", - "https://deno.land/x/xhr@0.3.0/mod.ts": "094aacd627fd9635cd942053bf8032b5223b909858fa9dc8ffa583752ff63b20", - "https://esm.sh/stringify-tree@1.1.1": "8d994a105481fa944515323d89bd2596c1de79f3d9bd1386266463934716eca0", - "https://esm.sh/v128/*@dagger.io/dagger@0.6.3": "cb691a77c0cdaee22f2b8393731b5143c83ce22dbbea204cdbfd203768d15b64", - "https://esm.sh/v128/@dagger.io/dagger@0.6.3/X-ZS8q/denonext/dagger.mjs": "fd0901784d75b99615b5409c3654b5c7edfc5ba377c9e1a5a67ffff4f7d3ac32", - "https://esm.sh/v128/adm-zip@0.5.10": "d9c54d6d2dd788462781a57d923295bd79304e6fd74b242fd4b30e35b39c5dcf", - "https://esm.sh/v128/adm-zip@0.5.10/denonext/adm-zip.mjs": "07a9731547905e0ca55ae917e1969d7f6d04fb3773f906ce3306891337eb4849", - "https://esm.sh/v128/chownr@2.0.0/denonext/chownr.mjs": "30b8f17084dfbe475a5052b615f706b06ddd17dca0535103340d485c6b94e952", - "https://esm.sh/v128/cross-fetch@3.1.8/denonext/cross-fetch.mjs": "8fba9e7c3fbaf0d2168beb63ce0cd21b5bfbfbd77e2fcbf8d957d533a71222f6", - "https://esm.sh/v128/cross-spawn@7.0.3/denonext/cross-spawn.mjs": "0569a26e7ad4b3376516cbc9b1942e10961a58030eadcea8c848e6b956eb355c", - "https://esm.sh/v128/data-uri-to-buffer@4.0.1/denonext/data-uri-to-buffer.mjs": "70ef987b1da58391495ecfad9888d996469224faf3cd996d81dc2e059feb9f31", - "https://esm.sh/v128/env-paths@3.0.0": "8400fb23319be9b30d7b40d1c865541c5b3c7726cdf9b74000bc0f1678d52ecf", - "https://esm.sh/v128/env-paths@3.0.0/denonext/env-paths.mjs": "77984a05eb16450087f25060a070ed500ec546719d471143e16d976ca73ca956", - "https://esm.sh/v128/execa@7.1.1": "a40c7030df81ab0847a5d844f4c5c6420af973dff05fef88e53cbb9b8667fdc2", - "https://esm.sh/v128/execa@7.1.1/denonext/execa.mjs": "9d5943544c0df3761b52f2c095f89a03ca6c028d818a8f0475ff883b0408f154", - "https://esm.sh/v128/fetch-blob@3.2.0/denonext/fetch-blob.mjs": "0531568b36c0f6db3e9825fbb2d08dee51100eb675c2bf1d98d6971a92010721", - "https://esm.sh/v128/fetch-blob@3.2.0/denonext/file.js": "fd82828163a4e7bdc15190d8c3dbfd92f93274d05bd7f7f5ab81093e3ad7e9c2", - "https://esm.sh/v128/fetch-blob@3.2.0/denonext/from.js": "7d3258c7960755497f90879806f0b815d5e564c2ac1523238af5cb9552ff5c45", - "https://esm.sh/v128/formdata-polyfill@4.0.10/denonext/esm.min.js": "b6d65a204e81eca699d9eb6f867e9efffa42db39a8f161690915a89e5eb1766f", - "https://esm.sh/v128/fs-minipass@2.1.0/denonext/fs-minipass.mjs": "74b00283d556b281bdfd6a669576d852f2c43702043c411985f8f8188d208c5d", - "https://esm.sh/v128/get-stream@6.0.1/denonext/get-stream.mjs": "a947a16f8cb3052fd654a84f8b36b40ce96b6a5acfb3ad4ab69d814bcf3351fb", - "https://esm.sh/v128/graphql-request@6.1.0": "17f00c323eb825811ce14e2b0e88a0c873acb666c382ac963d1edeb03e01f372", - "https://esm.sh/v128/graphql-request@6.1.0/denonext/graphql-request.mjs": "0b15f49d44489423ae6f06004725b6d050b6359da4969e6569bd6ad45065bd94", - "https://esm.sh/v128/graphql-tag@2.12.6": "5bfa27da9c9918fb52a01b8579891e804e0365d91118df1f2e0957a72dacdc39", - "https://esm.sh/v128/graphql-tag@2.12.6/denonext/graphql-tag.mjs": "331d09949efc4ac60c84a69b52a7da8b333210493900e54953ae4604c9874527", - "https://esm.sh/v128/graphql@16.7.1/denonext/graphql.mjs": "418ad7c07b0f2d687f33b6275d3b5f317f4afbef1f462f318229f458dff45416", - "https://esm.sh/v128/human-signals@4.3.1/denonext/human-signals.mjs": "3889110cedd907804443d018cffe0a1d892d5e7467661376caf967feff55cbe9", - "https://esm.sh/v128/is-stream@3.0.0/denonext/is-stream.mjs": "5c8b65f2fa051c4b18e88bbae11dac8bba9caf57752577d69bcea86d1f05c5b7", - "https://esm.sh/v128/isexe@2.0.0/denonext/isexe.mjs": "3cfefd270d1bfdfb864ee98dbb8f41d150cbf480925158f4a8f0ade8a9e17d6c", - "https://esm.sh/v128/merge-stream@2.0.0/denonext/merge-stream.mjs": "2c2af22401c294158d6bff659d157e3d2c028c218cc1bd2246534a45a4c03c61", - "https://esm.sh/v128/mimic-fn@4.0.0/denonext/mimic-fn.mjs": "10bcf0f2f20cbbba0c289ef7bf4d2422639bbc1c36c247be876afd6fe2d67138", - "https://esm.sh/v128/minipass@3.3.6/denonext/minipass.mjs": "59bbe430514455e78cb30c389b21af66efb2bf010cda071820a17d8c76d0d1cf", - "https://esm.sh/v128/minipass@5.0.0/denonext/minipass.mjs": "de0e049728f8c387b58c86439eb9d69a16b6a88756a6bc694e2fecbd7fd00401", - "https://esm.sh/v128/minizlib@2.1.2/denonext/minizlib.mjs": "0d919b6a0c60d5a31e14d748ff9d62aeae2923b604bcc6a22f90fa4bbd400d68", - "https://esm.sh/v128/mkdirp@1.0.4/denonext/mkdirp.mjs": "ee129b32e55dd8bede6b1bbd1978f7775fa5e2720d5a7ae07bf1e8c99abd77c7", - "https://esm.sh/v128/node-color-log@10.0.2": "05a277987c64153af1252167135076155fdc6b39ca260b2bdc39750da12d2a2d", - "https://esm.sh/v128/node-color-log@10.0.2/denonext/node-color-log.mjs": "2504391bd0ce1dd4c2bf0ed0b839b8a3ad84c028d9dd17cc58dccd2e14dacfde", - "https://esm.sh/v128/node-domexception@1.0.0/denonext/node-domexception.mjs": "bb35ba54c1a2b35870618876c0c96310a28ae58aecff33c8eed58a582e270ff4", - "https://esm.sh/v128/node-fetch@3.3.1": "916dcee177a69fb0e46970c528cb66fcd4973488f861844c0a235bfc645b0506", - "https://esm.sh/v128/node-fetch@3.3.1/denonext/node-fetch.mjs": "dc3a8f1f2fc9eb26d0d33e49f3750acc265d51a1a54bbd670c5d9f640b633a93", - "https://esm.sh/v128/node-fetch@3.3.1/denonext/src/utils/multipart-parser.js": "713b1b8cbafc4bfb7358debeb35d507e0d2328f0a28b8a2a7d79a3e5e4f5e5b8", - "https://esm.sh/v128/npm-run-path@5.1.0/denonext/npm-run-path.mjs": "3540b8c2dd1430f10d580f323f3a51aa30094da27a9220cce03ce69884b163bb", - "https://esm.sh/v128/onetime@6.0.0/denonext/onetime.mjs": "6e362222575d815f37fb813168d7069dd6a0f6bb6f972ed54d1bccb0f9fb3e1b", - "https://esm.sh/v128/original-fs@1.2.0/denonext/original-fs.mjs": "2b1098818e54d2c6748ff5b0dd9ea5f6a61b4b6d0f63fb625f21773d11cfc667", - "https://esm.sh/v128/path-key@3.1.1/denonext/path-key.mjs": "add83c631278b7df9b33ae84e41142db88bb291295bcc27eb4e77a1cbdfa71d0", - "https://esm.sh/v128/path-key@4.0.0/denonext/path-key.mjs": "2c2e3922bd0e6e414fa2752ff800bdc6b9208035ce797fa22e49b859f8259417", - "https://esm.sh/v128/shebang-command@2.0.0/denonext/shebang-command.mjs": "404e0fb09a782ca9495d53c721bb84b673b7b2e1054e021852143a6b91ca0e4f", - "https://esm.sh/v128/shebang-regex@3.0.0/denonext/shebang-regex.mjs": "03983ba59dd2cba9402935e21b46d05f5249364cba9f5757aef23c6c2fea65b9", - "https://esm.sh/v128/signal-exit@3.0.7/denonext/signal-exit.mjs": "2a176e5f9b351fa8057213c627a1503d63bf308b64447ef47f1ca6fbb2a91c81", - "https://esm.sh/v128/strip-final-newline@3.0.0/denonext/strip-final-newline.mjs": "03d9be4e8a249d63cbbddeb2fb675a1bbbcb335283e604d4ce56c88c90e6f102", - "https://esm.sh/v128/tar@6.1.15": "0460339f8aba5f287e8bebe258fe3fe13cb12f85820693f25724f0d98ef1258e", - "https://esm.sh/v128/tar@6.1.15/denonext/tar.mjs": "6194d892de8457b3b1f11d5cbacda1d540b453b45e8cb9f5f610abfb3e490b65", - "https://esm.sh/v128/tslib@2.6.0/denonext/tslib.mjs": "2215292e6fcf28a7a081eee911f127bb3c44cdd61ff0651e3e384d7a49b4e42b", - "https://esm.sh/v128/web-streams-polyfill@3.2.1/denonext/dist/ponyfill.es2018.js": "a2edb52a93494cda06386b3d6a168016b366e78f02c5eff1f94a0240be12ac96", - "https://esm.sh/v128/which@2.0.2/denonext/which.mjs": "86bf76e4937edb7fa3464d7bb9a426ef273684d1cefbec5ba5f1bdcb5cafff91", - "https://esm.sh/v128/yallist@4.0.0/denonext/yallist.mjs": "61f180d807dda50bac17028eda05d5722a3fecef6e98a9064e2353ea6864fd82", + "https://deno.land/x/fluent_aws_codepipeline@v0.2.3/mod.ts": "79cc758901d20a3573d7e3cc2db9f0a5fe56833f4d9befcedc072b94d542eec7", + "https://deno.land/x/fluent_aws_codepipeline@v0.2.3/src/buildspec.ts": "fb07cbbf9473586cea66c0c508412080c2d4ba4e7f4ea0985661afeed445710b", + "https://deno.land/x/fluent_aws_codepipeline@v0.2.3/src/spec.ts": "c0ce4c6e2685e23a3abdeb9fc18012253199dae355b06189d8248b052301a63e", + "https://deno.land/x/fluent_azure_pipelines@v0.2.0/mod.ts": "6f3c62419b96251dd1b5d8d6a172c0a8724a73b7feec786e540f51f0c8a0f0fd", + "https://deno.land/x/fluent_azure_pipelines@v0.2.0/src/config.ts": "619f4c64dad9b510c5788d4939a8afe013cb7dfc993dfd32f2ff4d0a2140075e", + "https://deno.land/x/fluent_azure_pipelines@v0.2.0/src/spec.ts": "cab6e4a6afb0f16e6c406cfab87264a963734720c468532c4f778228d1f1758d", + "https://deno.land/x/fluent_circleci@v0.2.5/mod.ts": "6a885bf35dbe08a7e971aa105763d724dd2a09c237b6292c9cd5de540237af37", + "https://deno.land/x/fluent_circleci@v0.2.5/src/config.ts": "d7e9902b4c2fddfa61ff6a509f3a09adee161fae9f93029dcbc8ec7a7bbd990b", + "https://deno.land/x/fluent_circleci@v0.2.5/src/job.ts": "b6ffb66ef10cf0e26460a88e1614ef864b606571e8d72376eeb09254f66a9926", + "https://deno.land/x/fluent_circleci@v0.2.5/src/spec.ts": "eda462e9ff535dbc7d3eb7e47253948d40ebaaf34d964e0931a6a25cdd823736", + "https://deno.land/x/fluent_github_actions@v0.2.1/mod.ts": "dc62b622791da77bc27f68e33cba618983a0770a9a12dcc9e0f9a61161bb90e5", + "https://deno.land/x/fluent_github_actions@v0.2.1/src/event.ts": "d44d42356a04aea7ba64ff9e9a12090f477605c27a940bbf80aba612e4e96d1e", + "https://deno.land/x/fluent_github_actions@v0.2.1/src/job_spec.ts": "93aa5b8b79cd8baaf875901322c4c38c27d4458439a831cb0ad86401b207a3dc", + "https://deno.land/x/fluent_github_actions@v0.2.1/src/step_spec.ts": "b399949d1fd9c45873cdda70d82c92e3d9d96ba9a1d5749f3010a1f242b20e35", + "https://deno.land/x/fluent_github_actions@v0.2.1/src/workflow.ts": "c9e3b7b3a59f7edff958eae8f27a8542f2a24889ea27c8aa016d0c0b0ca416c6", + "https://deno.land/x/fluent_github_actions@v0.2.1/src/workflow_spec.ts": "b5c696dc70ee3f777a565197c6a3a379d87d026e12d59942fef5b9dc72124c3a", + "https://deno.land/x/fluent_gitlab_ci@v0.4.2/mod.ts": "3becefe569f5c9814dffa1b534794a42b948481753a5903fa1b48d5337206ced", + "https://deno.land/x/fluent_gitlab_ci@v0.4.2/src/environment.ts": "f12ee4fb50e5100fccec29dc1d35aa430bfe8373e84286a8ab9f7b8e178f14e3", + "https://deno.land/x/fluent_gitlab_ci@v0.4.2/src/gitlabci.ts": "ef36465c41412ae94b919cfcb80b99ec1c04536dbf42ad09cd73abf3ea4d52a6", + "https://deno.land/x/fluent_gitlab_ci@v0.4.2/src/gitlabci_spec.ts": "37f4ecef3ea414f57c54a360bc0178f5fad21b4a9db59d29d1961cd368febaed", + "https://deno.land/x/fluent_gitlab_ci@v0.4.2/src/index.ts": "b5e374a24e3bca1d6fead0861f2c1b1e09e087a17e59297263f681ee71c972fe", + "https://deno.land/x/fluent_gitlab_ci@v0.4.2/src/job.ts": "65a5be7f5816846919907aab00530044b571570a54a8a0bc967f4269a2ce99b7", + "https://deno.land/x/zod@v3.22.1/ZodError.ts": "4de18ff525e75a0315f2c12066b77b5c2ae18c7c15ef7df7e165d63536fdf2ea", + "https://deno.land/x/zod@v3.22.1/errors.ts": "5285922d2be9700cc0c70c95e4858952b07ae193aa0224be3cbd5cd5567eabef", + "https://deno.land/x/zod@v3.22.1/external.ts": "a6cfbd61e9e097d5f42f8a7ed6f92f93f51ff927d29c9fbaec04f03cbce130fe", + "https://deno.land/x/zod@v3.22.1/helpers/enumUtil.ts": "54efc393cc9860e687d8b81ff52e980def00fa67377ad0bf8b3104f8a5bf698c", + "https://deno.land/x/zod@v3.22.1/helpers/errorUtil.ts": "7a77328240be7b847af6de9189963bd9f79cab32bbc61502a9db4fe6683e2ea7", + "https://deno.land/x/zod@v3.22.1/helpers/parseUtil.ts": "f791e6e65a0340d85ad37d26cd7a3ba67126cd9957eac2b7163162155283abb1", + "https://deno.land/x/zod@v3.22.1/helpers/partialUtil.ts": "998c2fe79795257d4d1cf10361e74492f3b7d852f61057c7c08ac0a46488b7e7", + "https://deno.land/x/zod@v3.22.1/helpers/typeAliases.ts": "0fda31a063c6736fc3cf9090dd94865c811dfff4f3cb8707b932bf937c6f2c3e", + "https://deno.land/x/zod@v3.22.1/helpers/util.ts": "8baf19b19b2fca8424380367b90364b32503b6b71780269a6e3e67700bb02774", + "https://deno.land/x/zod@v3.22.1/index.ts": "d27aabd973613985574bc31f39e45cb5d856aa122ef094a9f38a463b8ef1a268", + "https://deno.land/x/zod@v3.22.1/locales/en.ts": "a7a25cd23563ccb5e0eed214d9b31846305ddbcdb9c5c8f508b108943366ab4c", + "https://deno.land/x/zod@v3.22.1/mod.ts": "64e55237cb4410e17d968cd08975566059f27638ebb0b86048031b987ba251c4", + "https://deno.land/x/zod@v3.22.1/types.ts": "4edc1823385f446532c8c9f676d84550c6dc54b17135e34508576647d9612d0e", + "https://esm.sh/v128/yaml@2.3.1": "8ef3aee065e93b03cebf8fd5a3418bc30131344b7f2b8c8ae27bf9f277416087", "https://esm.sh/v128/yaml@2.3.1/denonext/yaml.mjs": "71f677b4bfc69271af9d98db5194e354f9a1863955e208e26d32a9ef78bd89f5", - "https://esm.sh/v130/lodash.flatten@4.4.0/denonext/lodash.flatten.mjs": "8e86ab607deea15cc3c1acfb5eae278ecbc5b80f24167b4e8f4c56df3278cd55", - "https://esm.sh/v130/stringify-tree@1.1.1/denonext/stringify-tree.mjs": "40a9d40e0282b5432302a3da68b88aa11685bc0b8a0b70246168deed5c5773fe", - "https://esm.sh/yaml@v2.3.1": "8ef3aee065e93b03cebf8fd5a3418bc30131344b7f2b8c8ae27bf9f277416087" + "https://esm.sh/v131/yaml@2.3.1": "1fe2490feb3d9c6d2c71c64dbdbed90acd4164b00628b3c68a311b6731ca38b5", + "https://esm.sh/v131/yaml@2.3.1/denonext/yaml.mjs": "71f677b4bfc69271af9d98db5194e354f9a1863955e208e26d32a9ef78bd89f5", + "https://esm.sh/yaml@v2.3.1": "1fe2490feb3d9c6d2c71c64dbdbed90acd4164b00628b3c68a311b6731ca38b5" }, "npm": { "specifiers": { diff --git a/example/.fluentci/example/.fluentci/.devcontainer/devcontainer.json b/example/.fluentci/example/.fluentci/.devcontainer/devcontainer.json new file mode 100644 index 0000000..c127882 --- /dev/null +++ b/example/.fluentci/example/.fluentci/.devcontainer/devcontainer.json @@ -0,0 +1,26 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/debian +{ + "name": "Debian", + // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile + "image": "mcr.microsoft.com/devcontainers/base:bullseye", + "features": { + "ghcr.io/devcontainers/features/github-cli:1": {}, + "ghcr.io/devcontainers/features/nix:1": {} + }, + + // Features to add to the dev container. More info: https://containers.dev/features. + // "features": {}, + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], + + // Use 'postCreateCommand' to run commands after the container is created. + "postCreateCommand": "nix develop --experimental-features \"nix-command flakes\"" + + // Configure tool-specific properties. + // "customizations": {}, + + // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. + // "remoteUser": "root" +} diff --git a/example/.fluentci/example/.fluentci/.github/workflows/ci.yml b/example/.fluentci/example/.fluentci/.github/workflows/ci.yml new file mode 100644 index 0000000..3ac7dd7 --- /dev/null +++ b/example/.fluentci/example/.fluentci/.github/workflows/ci.yml @@ -0,0 +1,28 @@ +name: Codecov + +# Controls when the action will run. Triggers the workflow on push or pull request +# events but only for the master branch +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: denolib/setup-deno@v2 + with: + deno-version: v1.34 + - name: Create coverage files + run: deno test --allow-read --coverage=coverage --lock-write # create coverage files + - name: Create coverage report + run: deno coverage ./coverage --lcov > coverage.lcov # create coverage report + - name: Collect coverage + uses: codecov/codecov-action@v3 # upload the report on Codecov + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + with: + file: ./coverage.lcov diff --git a/example/.fluentci/example/.fluentci/.vscode/settings.json b/example/.fluentci/example/.fluentci/.vscode/settings.json new file mode 100644 index 0000000..4b9fb22 --- /dev/null +++ b/example/.fluentci/example/.fluentci/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "deno.enable": true +} \ No newline at end of file diff --git a/example/.fluentci/example/.fluentci/CODE_OF_CONDUCT.md b/example/.fluentci/example/.fluentci/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..eb6d4f8 --- /dev/null +++ b/example/.fluentci/example/.fluentci/CODE_OF_CONDUCT.md @@ -0,0 +1,132 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +We as members, contributors, and leaders pledge to make participation in our +community a harassment-free experience for everyone, regardless of age, body +size, visible or invisible disability, ethnicity, sex characteristics, gender +identity and expression, level of experience, education, socio-economic status, +nationality, personal appearance, race, caste, color, religion, or sexual +identity and orientation. + +We pledge to act and interact in ways that contribute to an open, welcoming, +diverse, inclusive, and healthy community. + +## Our Standards + +Examples of behavior that contributes to a positive environment for our +community include: + +* Demonstrating empathy and kindness toward other people +* Being respectful of differing opinions, viewpoints, and experiences +* Giving and gracefully accepting constructive feedback +* Accepting responsibility and apologizing to those affected by our mistakes, + and learning from the experience +* Focusing on what is best not just for us as individuals, but for the overall + community + +Examples of unacceptable behavior include: + +* The use of sexualized language or imagery, and sexual attention or advances of + any kind +* Trolling, insulting or derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or email address, + without their explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Enforcement Responsibilities + +Community leaders are responsible for clarifying and enforcing our standards of +acceptable behavior and will take appropriate and fair corrective action in +response to any behavior that they deem inappropriate, threatening, offensive, +or harmful. + +Community leaders have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions that are +not aligned to this Code of Conduct, and will communicate reasons for moderation +decisions when appropriate. + +## Scope + +This Code of Conduct applies within all community spaces, and also applies when +an individual is officially representing the community in public spaces. +Examples of representing our community include using an official e-mail address, +posting via an official social media account, or acting as an appointed +representative at an online or offline event. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported to the community leaders responsible for enforcement at +[GitHub Issues](https://github.com/fluent-ci-templates/django-pipeline/issues). +All complaints will be reviewed and investigated promptly and fairly. + +All community leaders are obligated to respect the privacy and security of the +reporter of any incident. + +## Enforcement Guidelines + +Community leaders will follow these Community Impact Guidelines in determining +the consequences for any action they deem in violation of this Code of Conduct: + +### 1. Correction + +**Community Impact**: Use of inappropriate language or other behavior deemed +unprofessional or unwelcome in the community. + +**Consequence**: A private, written warning from community leaders, providing +clarity around the nature of the violation and an explanation of why the +behavior was inappropriate. A public apology may be requested. + +### 2. Warning + +**Community Impact**: A violation through a single incident or series of +actions. + +**Consequence**: A warning with consequences for continued behavior. No +interaction with the people involved, including unsolicited interaction with +those enforcing the Code of Conduct, for a specified period of time. This +includes avoiding interactions in community spaces as well as external channels +like social media. Violating these terms may lead to a temporary or permanent +ban. + +### 3. Temporary Ban + +**Community Impact**: A serious violation of community standards, including +sustained inappropriate behavior. + +**Consequence**: A temporary ban from any sort of interaction or public +communication with the community for a specified period of time. No public or +private interaction with the people involved, including unsolicited interaction +with those enforcing the Code of Conduct, is allowed during this period. +Violating these terms may lead to a permanent ban. + +### 4. Permanent Ban + +**Community Impact**: Demonstrating a pattern of violation of community +standards, including sustained inappropriate behavior, harassment of an +individual, or aggression toward or disparagement of classes of individuals. + +**Consequence**: A permanent ban from any sort of public interaction within the +community. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], +version 2.1, available at +[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1]. + +Community Impact Guidelines were inspired by +[Mozilla's code of conduct enforcement ladder][Mozilla CoC]. + +For answers to common questions about this code of conduct, see the FAQ at +[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at +[https://www.contributor-covenant.org/translations][translations]. + +[homepage]: https://www.contributor-covenant.org +[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html +[Mozilla CoC]: https://github.com/mozilla/diversity +[FAQ]: https://www.contributor-covenant.org/faq +[translations]: https://www.contributor-covenant.org/translations \ No newline at end of file diff --git a/example/.fluentci/example/.fluentci/CONTRIBUTING.md b/example/.fluentci/example/.fluentci/CONTRIBUTING.md new file mode 100644 index 0000000..e97da7c --- /dev/null +++ b/example/.fluentci/example/.fluentci/CONTRIBUTING.md @@ -0,0 +1,53 @@ +# Contributing Guidelines + +Thank you for your interest in contributing to our project. Whether it's a bug report, new feature, correction, or additional +documentation, we greatly value feedback and contributions from our community. + +Please read through this document before submitting any issues or pull requests to ensure we have all the necessary +information to effectively respond to your bug report or contribution. + + +## Reporting Bugs/Feature Requests + +We welcome you to use the GitHub issue tracker to report bugs or suggest features. + +When filing an issue, please check existing open, or recently closed, issues to make sure somebody else hasn't already +reported the issue. Please try to include as much information as you can. Details like these are incredibly useful: + +* A reproducible test case or series of steps +* The version of our code being used +* Any modifications you've made relevant to the bug +* Anything unusual about your environment or deployment + + +## Contributing via Pull Requests +Contributions via pull requests are much appreciated. Before sending us a pull request, please ensure that: + +1. You are working against the latest source on the *master* branch. +2. You check existing open, and recently merged, pull requests to make sure someone else hasn't addressed the problem already. +3. You open an issue to discuss any significant work - we would hate for your time to be wasted. + +To send us a pull request, please: + +1. Fork the repository. +2. Modify the source; please focus on the specific change you are contributing. If you also reformat all the code, it will be hard for us to focus on your change. +3. Ensure local tests pass. +4. Commit to your fork using clear commit messages. +5. Send us a pull request, answering any default questions in the pull request interface. +6. Pay attention to any automated CI failures reported in the pull request, and stay involved in the conversation. + +GitHub provides additional document on [forking a repository](https://help.github.com/articles/fork-a-repo/) and +[creating a pull request](https://help.github.com/articles/creating-a-pull-request/). + + +## Finding contributions to work on +Looking at the existing issues is a great way to find something to contribute on. As our projects, by default, use the default GitHub issue labels (enhancement/bug/duplicate/help wanted/invalid/question/wontfix), looking at any 'help wanted' issues is a great place to start. + + +## Code of Conduct +This project has adopted the [Contributor Covenant](https://www.contributor-covenant.org/), version 2.1, available at https://www.contributor-covenant.org/version/2/1/code_of_conduct.html. + + +## Licensing + +See the [LICENSE](LICENSE) file for our project's licensing. We will ask you to confirm the licensing of your contribution. \ No newline at end of file diff --git a/example/.fluentci/example/.fluentci/LICENSE b/example/.fluentci/example/.fluentci/LICENSE new file mode 100644 index 0000000..d9ab36a --- /dev/null +++ b/example/.fluentci/example/.fluentci/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2023 Tsiry Sandratraina + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/example/.fluentci/example/.fluentci/README.md b/example/.fluentci/example/.fluentci/README.md new file mode 100644 index 0000000..172bf64 --- /dev/null +++ b/example/.fluentci/example/.fluentci/README.md @@ -0,0 +1,107 @@ +# Django Pipeline + +[![deno module](https://shield.deno.dev/x/django_pipeline)](https://deno.land/x/django_pipeline) +![deno compatibility](https://shield.deno.dev/deno/^1.34) +[![](https://img.shields.io/codecov/c/gh/fluent-ci-templates/django-pipeline)](https://codecov.io/gh/fluent-ci-templates/django-pipeline) + +A ready-to-use GitLab CI Pipeline and Jobs for your Django projects. + +## ๐Ÿš€ Usage + +Quick start: + +```ts +import { GitLab } from "https://deno.land/x/django_pipeline/mod.ts"; + +const { pipeline } = GitLab; + +pipeline.write(); // Write the pipeline to the file .gitlab-ci.yml +``` + +Or, if you want to use the predefined jobs: + +```ts +import { GitlabCI } from "https://deno.land/x/fluent_gitlab_ci/mod.ts"; +import { GitLab } from "https://deno.land/x/django_pipeline/mod.ts"; + +const { install, migrations, djangoTests } = GitLab; + +const const pipeline = new GitlabCI() + .variables({ + MYSQL_DATABASE: "$MYSQL_DB", + MYSQL_ROOT_PASSWORD: "$MYSQL_PASS", + MYSQL_USER: "$MYSQL_USER", + MYSQL_PASSWORD: "$MYSQL_PASS", + }) + .addJob("install", install) + .addJob("migrations", migrations) + .addJob("django-tests", djangoTests); + +pipeline.write(); // Write the pipeline to the file .gitlab-ci.yml +``` + +It will generate the following `.gitlab-ci.yml` file: + +```yaml +# Do not edit this file directly. It is generated by Fluent GitLab CI + +variables: + MYSQL_DATABASE: $MYSQL_DB + MYSQL_ROOT_PASSWORD: $MYSQL_PASS + MYSQL_USER: $MYSQL_USER + MYSQL_PASSWORD: $MYSQL_PASS + +install: + image: ubuntu:20.04 + services: + - mysql:8.0 + cache: + paths: + - ~/.cache/pip/ + before_script: + - apt -y update + - apt -y install apt-utils + - apt -y install net-tools python3.8 python3-pip mysql-client libmysqlclient-dev + - apt -y upgrade + - pip3 install -r requirements.txt + +migrations: + stage: build + script: + - python3 manage.py makemigrations + - python3 manage.py migrate + - python3 manage.py check + +django-tests: + stage: test + script: + - echo "GRANT ALL on *.* to '${MYSQL_USER}';"| mysql -u root --password="${MYSQL_ROOT_PASSWORD}" -h mysql + - python3 manage.py test +``` + + +## ๐Ÿงช Advanced Usage + +This package also provides a ready-to-use pipeline for +[Dagger](https://dagger.io/), just run the following command on your Django project: + +```sh +dagger run deno run -A https://deno.land/x/django_pipeline/ci.ts +``` + +Or, if you want to use the predefined jobs: + +```ts +import Client, { connect } from "@dagger.io/dagger"; +import { Dagger } from "https://deno.land/x/django_pipeline/mod.ts"; + +const { djangoTests } = Dagger; + +function pipeline(src = ".") { + connect(async (client: Client) => { + await djangoTests(client, src); + }); +} + +pipeline(); +``` \ No newline at end of file diff --git a/example/.fluentci/example/.fluentci/ci.ts b/example/.fluentci/example/.fluentci/ci.ts new file mode 100644 index 0000000..a7bceac --- /dev/null +++ b/example/.fluentci/example/.fluentci/ci.ts @@ -0,0 +1,12 @@ +const command = new Deno.Command(Deno.execPath(), { + args: [ + "run", + "-A", + "--import-map=https://deno.land/x/django_pipeline/import_map.json", + "https://deno.land/x/django_pipeline/src/dagger/runner.ts", + ], +}); + +const { stdout } = await command.output(); + +console.log(new TextDecoder().decode(stdout)); diff --git a/example/.fluentci/example/.fluentci/deno.json b/example/.fluentci/example/.fluentci/deno.json new file mode 100644 index 0000000..9f6bbca --- /dev/null +++ b/example/.fluentci/example/.fluentci/deno.json @@ -0,0 +1,8 @@ +{ + "importMap": "import_map.json", + "tasks": { + "esm:add": "deno run -A https://esm.sh/v128 add", + "esm:update": "deno run -A https://esm.sh/v128 update", + "esm:remove": "deno run -A https://esm.sh/v128 remove" + } +} \ No newline at end of file diff --git a/example/.fluentci/example/.fluentci/deno.lock b/example/.fluentci/example/.fluentci/deno.lock new file mode 100644 index 0000000..ff48dad --- /dev/null +++ b/example/.fluentci/example/.fluentci/deno.lock @@ -0,0 +1,104 @@ +{ + "version": "2", + "remote": { + "https://deno.land/std@0.150.0/media_types/_util.ts": "ce9b4fc4ba1c447dafab619055e20fd88236ca6bdd7834a21f98bd193c3fbfa1", + "https://deno.land/std@0.150.0/media_types/mod.ts": "2d4b6f32a087029272dc59e0a55ae3cc4d1b27b794ccf528e94b1925795b3118", + "https://deno.land/std@0.150.0/media_types/vendor/mime-db.v1.52.0.ts": "724cee25fa40f1a52d3937d6b4fbbfdd7791ff55e1b7ac08d9319d5632c7f5af", + "https://deno.land/std@0.191.0/fmt/colors.ts": "d67e3cd9f472535241a8e410d33423980bec45047e343577554d3356e1f0ef4e", + "https://deno.land/std@0.191.0/testing/_diff.ts": "1a3c044aedf77647d6cac86b798c6417603361b66b54c53331b312caeb447aea", + "https://deno.land/std@0.191.0/testing/_format.ts": "a69126e8a469009adf4cf2a50af889aca364c349797e63174884a52ff75cf4c7", + "https://deno.land/std@0.191.0/testing/asserts.ts": "e16d98b4d73ffc4ed498d717307a12500ae4f2cbe668f1a215632d19fcffc22f", + "https://deno.land/x/fluent_gitlab_ci@v0.3.2/mod.ts": "3becefe569f5c9814dffa1b534794a42b948481753a5903fa1b48d5337206ced", + "https://deno.land/x/fluent_gitlab_ci@v0.3.2/src/environment.ts": "f12ee4fb50e5100fccec29dc1d35aa430bfe8373e84286a8ab9f7b8e178f14e3", + "https://deno.land/x/fluent_gitlab_ci@v0.3.2/src/gitlabci.ts": "85d2335622c2def4a9554a9d8b8de4e62156f5d76d59a553e157bab4e6b6591f", + "https://deno.land/x/fluent_gitlab_ci@v0.3.2/src/gitlabci_spec.ts": "b60f40ecf26d243db2391aee70fdf71b133de3faaf789052020f58f98cf1b500", + "https://deno.land/x/fluent_gitlab_ci@v0.3.2/src/index.ts": "b5e374a24e3bca1d6fead0861f2c1b1e09e087a17e59297263f681ee71c972fe", + "https://deno.land/x/fluent_gitlab_ci@v0.3.2/src/job.ts": "a1ddf8d37ca33239de9d2c61f98835e585f6671748b37af8d647ebba5e1a9974", + "https://deno.land/x/nix_installer_pipeline@v0.3.1/mod.ts": "60bbaf1da28b5324666c42469dc19ca15114956f98c2854a02073ed83c02284f", + "https://deno.land/x/nix_installer_pipeline@v0.3.1/src/dagger/index.ts": "d513528cce932d77b76519af86b44f2b249c867bcfa9f6349242b88c5a99f079", + "https://deno.land/x/nix_installer_pipeline@v0.3.1/src/dagger/steps.ts": "1dbeeb6d60ffdccd19fee88d35fa983619555be6ba55404be491bffa0874648e", + "https://deno.land/x/nix_installer_pipeline@v0.3.1/src/gitlab/index.ts": "1724b883cf33830a46160fcb048acddb1003be571dabf8df076db365d5349b80", + "https://deno.land/x/nix_installer_pipeline@v0.3.1/src/gitlab/pipeline.ts": "ed6eefe6f7bad5732ef8eb21860d77e6782ab5c7ce09377bc3e38411494c7ad8", + "https://deno.land/x/nix_installer_pipeline@v0.3.2/mod.ts": "60bbaf1da28b5324666c42469dc19ca15114956f98c2854a02073ed83c02284f", + "https://deno.land/x/nix_installer_pipeline@v0.3.2/src/dagger/index.ts": "d513528cce932d77b76519af86b44f2b249c867bcfa9f6349242b88c5a99f079", + "https://deno.land/x/nix_installer_pipeline@v0.3.2/src/dagger/steps.ts": "a5c7917898bf73e66c81e6634f8b2357440ccd12919aca9888671def49403d2b", + "https://deno.land/x/nix_installer_pipeline@v0.3.2/src/gitlab/index.ts": "1724b883cf33830a46160fcb048acddb1003be571dabf8df076db365d5349b80", + "https://deno.land/x/nix_installer_pipeline@v0.3.2/src/gitlab/pipeline.ts": "ed6eefe6f7bad5732ef8eb21860d77e6782ab5c7ce09377bc3e38411494c7ad8", + "https://deno.land/x/nix_installer_pipeline@v0.3.3/mod.ts": "60bbaf1da28b5324666c42469dc19ca15114956f98c2854a02073ed83c02284f", + "https://deno.land/x/nix_installer_pipeline@v0.3.3/src/dagger/index.ts": "d513528cce932d77b76519af86b44f2b249c867bcfa9f6349242b88c5a99f079", + "https://deno.land/x/nix_installer_pipeline@v0.3.3/src/dagger/steps.ts": "05ef2931080fe9771f27f322a6ace921bf3df8143b5599cd92409fe25568e613", + "https://deno.land/x/nix_installer_pipeline@v0.3.3/src/gitlab/index.ts": "1724b883cf33830a46160fcb048acddb1003be571dabf8df076db365d5349b80", + "https://deno.land/x/nix_installer_pipeline@v0.3.3/src/gitlab/pipeline.ts": "ed6eefe6f7bad5732ef8eb21860d77e6782ab5c7ce09377bc3e38411494c7ad8", + "https://deno.land/x/nix_installer_pipeline@v0.3.6/src/dagger/steps.ts": "a34aea3753c7079de5877f592ce31f30d05d552155729ff3e695d77326405133", + "https://deno.land/x/xhr@0.3.0/mod.ts": "094aacd627fd9635cd942053bf8032b5223b909858fa9dc8ffa583752ff63b20", + "https://esm.sh/stringify-tree@1.1.1": "8d994a105481fa944515323d89bd2596c1de79f3d9bd1386266463934716eca0", + "https://esm.sh/v128/*@dagger.io/dagger@0.6.3": "cb691a77c0cdaee22f2b8393731b5143c83ce22dbbea204cdbfd203768d15b64", + "https://esm.sh/v128/@dagger.io/dagger@0.6.3/X-ZS8q/denonext/dagger.mjs": "fd0901784d75b99615b5409c3654b5c7edfc5ba377c9e1a5a67ffff4f7d3ac32", + "https://esm.sh/v128/adm-zip@0.5.10": "d9c54d6d2dd788462781a57d923295bd79304e6fd74b242fd4b30e35b39c5dcf", + "https://esm.sh/v128/adm-zip@0.5.10/denonext/adm-zip.mjs": "07a9731547905e0ca55ae917e1969d7f6d04fb3773f906ce3306891337eb4849", + "https://esm.sh/v128/chownr@2.0.0/denonext/chownr.mjs": "30b8f17084dfbe475a5052b615f706b06ddd17dca0535103340d485c6b94e952", + "https://esm.sh/v128/cross-fetch@3.1.8/denonext/cross-fetch.mjs": "8fba9e7c3fbaf0d2168beb63ce0cd21b5bfbfbd77e2fcbf8d957d533a71222f6", + "https://esm.sh/v128/cross-spawn@7.0.3/denonext/cross-spawn.mjs": "0569a26e7ad4b3376516cbc9b1942e10961a58030eadcea8c848e6b956eb355c", + "https://esm.sh/v128/data-uri-to-buffer@4.0.1/denonext/data-uri-to-buffer.mjs": "70ef987b1da58391495ecfad9888d996469224faf3cd996d81dc2e059feb9f31", + "https://esm.sh/v128/env-paths@3.0.0": "8400fb23319be9b30d7b40d1c865541c5b3c7726cdf9b74000bc0f1678d52ecf", + "https://esm.sh/v128/env-paths@3.0.0/denonext/env-paths.mjs": "77984a05eb16450087f25060a070ed500ec546719d471143e16d976ca73ca956", + "https://esm.sh/v128/execa@7.1.1": "a40c7030df81ab0847a5d844f4c5c6420af973dff05fef88e53cbb9b8667fdc2", + "https://esm.sh/v128/execa@7.1.1/denonext/execa.mjs": "9d5943544c0df3761b52f2c095f89a03ca6c028d818a8f0475ff883b0408f154", + "https://esm.sh/v128/fetch-blob@3.2.0/denonext/fetch-blob.mjs": "0531568b36c0f6db3e9825fbb2d08dee51100eb675c2bf1d98d6971a92010721", + "https://esm.sh/v128/fetch-blob@3.2.0/denonext/file.js": "fd82828163a4e7bdc15190d8c3dbfd92f93274d05bd7f7f5ab81093e3ad7e9c2", + "https://esm.sh/v128/fetch-blob@3.2.0/denonext/from.js": "7d3258c7960755497f90879806f0b815d5e564c2ac1523238af5cb9552ff5c45", + "https://esm.sh/v128/formdata-polyfill@4.0.10/denonext/esm.min.js": "b6d65a204e81eca699d9eb6f867e9efffa42db39a8f161690915a89e5eb1766f", + "https://esm.sh/v128/fs-minipass@2.1.0/denonext/fs-minipass.mjs": "74b00283d556b281bdfd6a669576d852f2c43702043c411985f8f8188d208c5d", + "https://esm.sh/v128/get-stream@6.0.1/denonext/get-stream.mjs": "a947a16f8cb3052fd654a84f8b36b40ce96b6a5acfb3ad4ab69d814bcf3351fb", + "https://esm.sh/v128/graphql-request@6.1.0": "17f00c323eb825811ce14e2b0e88a0c873acb666c382ac963d1edeb03e01f372", + "https://esm.sh/v128/graphql-request@6.1.0/denonext/graphql-request.mjs": "0b15f49d44489423ae6f06004725b6d050b6359da4969e6569bd6ad45065bd94", + "https://esm.sh/v128/graphql-tag@2.12.6": "5bfa27da9c9918fb52a01b8579891e804e0365d91118df1f2e0957a72dacdc39", + "https://esm.sh/v128/graphql-tag@2.12.6/denonext/graphql-tag.mjs": "331d09949efc4ac60c84a69b52a7da8b333210493900e54953ae4604c9874527", + "https://esm.sh/v128/graphql@16.7.1/denonext/graphql.mjs": "418ad7c07b0f2d687f33b6275d3b5f317f4afbef1f462f318229f458dff45416", + "https://esm.sh/v128/human-signals@4.3.1/denonext/human-signals.mjs": "3889110cedd907804443d018cffe0a1d892d5e7467661376caf967feff55cbe9", + "https://esm.sh/v128/is-stream@3.0.0/denonext/is-stream.mjs": "5c8b65f2fa051c4b18e88bbae11dac8bba9caf57752577d69bcea86d1f05c5b7", + "https://esm.sh/v128/isexe@2.0.0/denonext/isexe.mjs": "3cfefd270d1bfdfb864ee98dbb8f41d150cbf480925158f4a8f0ade8a9e17d6c", + "https://esm.sh/v128/merge-stream@2.0.0/denonext/merge-stream.mjs": "2c2af22401c294158d6bff659d157e3d2c028c218cc1bd2246534a45a4c03c61", + "https://esm.sh/v128/mimic-fn@4.0.0/denonext/mimic-fn.mjs": "10bcf0f2f20cbbba0c289ef7bf4d2422639bbc1c36c247be876afd6fe2d67138", + "https://esm.sh/v128/minipass@3.3.6/denonext/minipass.mjs": "59bbe430514455e78cb30c389b21af66efb2bf010cda071820a17d8c76d0d1cf", + "https://esm.sh/v128/minipass@5.0.0/denonext/minipass.mjs": "de0e049728f8c387b58c86439eb9d69a16b6a88756a6bc694e2fecbd7fd00401", + "https://esm.sh/v128/minizlib@2.1.2/denonext/minizlib.mjs": "0d919b6a0c60d5a31e14d748ff9d62aeae2923b604bcc6a22f90fa4bbd400d68", + "https://esm.sh/v128/mkdirp@1.0.4/denonext/mkdirp.mjs": "ee129b32e55dd8bede6b1bbd1978f7775fa5e2720d5a7ae07bf1e8c99abd77c7", + "https://esm.sh/v128/node-color-log@10.0.2": "05a277987c64153af1252167135076155fdc6b39ca260b2bdc39750da12d2a2d", + "https://esm.sh/v128/node-color-log@10.0.2/denonext/node-color-log.mjs": "2504391bd0ce1dd4c2bf0ed0b839b8a3ad84c028d9dd17cc58dccd2e14dacfde", + "https://esm.sh/v128/node-domexception@1.0.0/denonext/node-domexception.mjs": "bb35ba54c1a2b35870618876c0c96310a28ae58aecff33c8eed58a582e270ff4", + "https://esm.sh/v128/node-fetch@3.3.1": "916dcee177a69fb0e46970c528cb66fcd4973488f861844c0a235bfc645b0506", + "https://esm.sh/v128/node-fetch@3.3.1/denonext/node-fetch.mjs": "dc3a8f1f2fc9eb26d0d33e49f3750acc265d51a1a54bbd670c5d9f640b633a93", + "https://esm.sh/v128/node-fetch@3.3.1/denonext/src/utils/multipart-parser.js": "713b1b8cbafc4bfb7358debeb35d507e0d2328f0a28b8a2a7d79a3e5e4f5e5b8", + "https://esm.sh/v128/npm-run-path@5.1.0/denonext/npm-run-path.mjs": "3540b8c2dd1430f10d580f323f3a51aa30094da27a9220cce03ce69884b163bb", + "https://esm.sh/v128/onetime@6.0.0/denonext/onetime.mjs": "6e362222575d815f37fb813168d7069dd6a0f6bb6f972ed54d1bccb0f9fb3e1b", + "https://esm.sh/v128/original-fs@1.2.0/denonext/original-fs.mjs": "2b1098818e54d2c6748ff5b0dd9ea5f6a61b4b6d0f63fb625f21773d11cfc667", + "https://esm.sh/v128/path-key@3.1.1/denonext/path-key.mjs": "add83c631278b7df9b33ae84e41142db88bb291295bcc27eb4e77a1cbdfa71d0", + "https://esm.sh/v128/path-key@4.0.0/denonext/path-key.mjs": "2c2e3922bd0e6e414fa2752ff800bdc6b9208035ce797fa22e49b859f8259417", + "https://esm.sh/v128/shebang-command@2.0.0/denonext/shebang-command.mjs": "404e0fb09a782ca9495d53c721bb84b673b7b2e1054e021852143a6b91ca0e4f", + "https://esm.sh/v128/shebang-regex@3.0.0/denonext/shebang-regex.mjs": "03983ba59dd2cba9402935e21b46d05f5249364cba9f5757aef23c6c2fea65b9", + "https://esm.sh/v128/signal-exit@3.0.7/denonext/signal-exit.mjs": "2a176e5f9b351fa8057213c627a1503d63bf308b64447ef47f1ca6fbb2a91c81", + "https://esm.sh/v128/strip-final-newline@3.0.0/denonext/strip-final-newline.mjs": "03d9be4e8a249d63cbbddeb2fb675a1bbbcb335283e604d4ce56c88c90e6f102", + "https://esm.sh/v128/tar@6.1.15": "0460339f8aba5f287e8bebe258fe3fe13cb12f85820693f25724f0d98ef1258e", + "https://esm.sh/v128/tar@6.1.15/denonext/tar.mjs": "6194d892de8457b3b1f11d5cbacda1d540b453b45e8cb9f5f610abfb3e490b65", + "https://esm.sh/v128/tslib@2.6.0/denonext/tslib.mjs": "2215292e6fcf28a7a081eee911f127bb3c44cdd61ff0651e3e384d7a49b4e42b", + "https://esm.sh/v128/web-streams-polyfill@3.2.1/denonext/dist/ponyfill.es2018.js": "a2edb52a93494cda06386b3d6a168016b366e78f02c5eff1f94a0240be12ac96", + "https://esm.sh/v128/which@2.0.2/denonext/which.mjs": "86bf76e4937edb7fa3464d7bb9a426ef273684d1cefbec5ba5f1bdcb5cafff91", + "https://esm.sh/v128/yallist@4.0.0/denonext/yallist.mjs": "61f180d807dda50bac17028eda05d5722a3fecef6e98a9064e2353ea6864fd82", + "https://esm.sh/v128/yaml@2.3.1/denonext/yaml.mjs": "71f677b4bfc69271af9d98db5194e354f9a1863955e208e26d32a9ef78bd89f5", + "https://esm.sh/v130/lodash.flatten@4.4.0/denonext/lodash.flatten.mjs": "8e86ab607deea15cc3c1acfb5eae278ecbc5b80f24167b4e8f4c56df3278cd55", + "https://esm.sh/v130/stringify-tree@1.1.1/denonext/stringify-tree.mjs": "40a9d40e0282b5432302a3da68b88aa11685bc0b8a0b70246168deed5c5773fe", + "https://esm.sh/yaml@v2.3.1": "8ef3aee065e93b03cebf8fd5a3418bc30131344b7f2b8c8ae27bf9f277416087" + }, + "npm": { + "specifiers": { + "@types/node": "@types/node@18.16.19" + }, + "packages": { + "@types/node@18.16.19": { + "integrity": "sha512-IXl7o+R9iti9eBW4Wg2hx1xQDig183jj7YLn8F7udNceyfkbn1ZxmzZXuak20gR40D7pIkIY1kYGx5VIGbaHKA==", + "dependencies": {} + } + } + } +} diff --git a/example/.fluentci/example/.fluentci/example/.gitignore b/example/.fluentci/example/.fluentci/example/.gitignore new file mode 100644 index 0000000..872bcd4 --- /dev/null +++ b/example/.fluentci/example/.fluentci/example/.gitignore @@ -0,0 +1 @@ +.devbox \ No newline at end of file diff --git a/example/.fluentci/example/.fluentci/example/README.md b/example/.fluentci/example/.fluentci/example/README.md new file mode 100644 index 0000000..a234919 --- /dev/null +++ b/example/.fluentci/example/.fluentci/example/README.md @@ -0,0 +1,8 @@ +# Django Project Example + Dagger Pipeline + +Run the following commands to run Django Pipeline on this project: + +```bash +dagger run deno run -A https://deno.land/x/django_pipeline/ci.ts +``` + diff --git a/example/.fluentci/example/.fluentci/example/devbox.json b/example/.fluentci/example/.fluentci/example/devbox.json new file mode 100644 index 0000000..78826bf --- /dev/null +++ b/example/.fluentci/example/.fluentci/example/devbox.json @@ -0,0 +1,21 @@ +{ + "packages": [ + "python@3.11", + "python311Packages.pip@latest", + "mysql80@latest", + "pkg-config@latest", + "libmysqlclient@latest" + ], + "shell": { + "init_hook": [ + "echo 'Welcome to devbox!' > /dev/null", + ". $VENV_DIR/bin/activate", + "python -m pip install -r requirements.txt --use-pep517" + ], + "scripts": { + "test": [ + "echo \"Error: no test specified\" && exit 1" + ] + } + } +} \ No newline at end of file diff --git a/example/.fluentci/example/.fluentci/example/devbox.lock b/example/.fluentci/example/.fluentci/example/devbox.lock new file mode 100644 index 0000000..d860e03 --- /dev/null +++ b/example/.fluentci/example/.fluentci/example/devbox.lock @@ -0,0 +1,31 @@ +{ + "lockfile_version": "1", + "packages": { + "libmysqlclient@3.2.5": { + "last_modified": "2023-06-29T16:20:38Z", + "resolved": "github:NixOS/nixpkgs/3c614fbc76fc152f3e1bc4b2263da6d90adf80fb#libmysqlclient", + "version": "3.2.5" + }, + "mysql80@8.0.33": { + "last_modified": "2023-06-29T16:20:38Z", + "resolved": "github:NixOS/nixpkgs/3c614fbc76fc152f3e1bc4b2263da6d90adf80fb#mysql80", + "version": "8.0.33" + }, + "pkg-config@0.29.2": { + "last_modified": "2023-06-29T16:20:38Z", + "resolved": "github:NixOS/nixpkgs/3c614fbc76fc152f3e1bc4b2263da6d90adf80fb#pkg-config", + "version": "0.29.2" + }, + "python311Packages.pip@23.0.1": { + "last_modified": "2023-06-29T16:20:38Z", + "resolved": "github:NixOS/nixpkgs/3c614fbc76fc152f3e1bc4b2263da6d90adf80fb#python311Packages.pip", + "version": "23.0.1" + }, + "python@3.11": { + "last_modified": "2023-06-29T16:20:38Z", + "plugin_version": "0.0.1", + "resolved": "github:NixOS/nixpkgs/3c614fbc76fc152f3e1bc4b2263da6d90adf80fb#python311", + "version": "3.11.4" + } + } +} \ No newline at end of file diff --git a/example/.fluentci/example/.fluentci/example/requirements.txt b/example/.fluentci/example/.fluentci/example/requirements.txt new file mode 100644 index 0000000..2a64df8 --- /dev/null +++ b/example/.fluentci/example/.fluentci/example/requirements.txt @@ -0,0 +1,4 @@ +asgiref==3.6.0 +Django==4.2.3 +mysqlclient==2.2.0 +sqlparse==0.4.4 diff --git a/example/.fluentci/example/.fluentci/example/todo_project/manage.py b/example/.fluentci/example/.fluentci/example/todo_project/manage.py new file mode 100755 index 0000000..0662a32 --- /dev/null +++ b/example/.fluentci/example/.fluentci/example/todo_project/manage.py @@ -0,0 +1,22 @@ +#!/nix/store/c9ihc3ynkvyjr4piwbdaji8bn145r3yj-python3-3.10.9/bin/python +"""Django's command-line utility for administrative tasks.""" +import os +import sys + + +def main(): + """Run administrative tasks.""" + os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'todo_project.settings') + try: + from django.core.management import execute_from_command_line + except ImportError as exc: + raise ImportError( + "Couldn't import Django. Are you sure it's installed and " + "available on your PYTHONPATH environment variable? Did you " + "forget to activate a virtual environment?" + ) from exc + execute_from_command_line(sys.argv) + + +if __name__ == '__main__': + main() diff --git a/example/.fluentci/example/.fluentci/example/todo_project/todo_app/__init__.py b/example/.fluentci/example/.fluentci/example/todo_project/todo_app/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/example/.fluentci/example/.fluentci/example/todo_project/todo_app/admin.py b/example/.fluentci/example/.fluentci/example/todo_project/todo_app/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/example/.fluentci/example/.fluentci/example/todo_project/todo_app/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/example/.fluentci/example/.fluentci/example/todo_project/todo_app/apps.py b/example/.fluentci/example/.fluentci/example/todo_project/todo_app/apps.py new file mode 100644 index 0000000..d8f1498 --- /dev/null +++ b/example/.fluentci/example/.fluentci/example/todo_project/todo_app/apps.py @@ -0,0 +1,6 @@ +from django.apps import AppConfig + + +class TodoAppConfig(AppConfig): + default_auto_field = 'django.db.models.BigAutoField' + name = 'todo_app' diff --git a/example/.fluentci/example/.fluentci/example/todo_project/todo_app/migrations/0001_initial.py b/example/.fluentci/example/.fluentci/example/todo_project/todo_app/migrations/0001_initial.py new file mode 100644 index 0000000..e0cdbfa --- /dev/null +++ b/example/.fluentci/example/.fluentci/example/todo_project/todo_app/migrations/0001_initial.py @@ -0,0 +1,23 @@ +# Generated by Django 3.2.16 on 2023-02-02 01:33 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='Todo', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('title', models.CharField(max_length=255)), + ('completed', models.BooleanField(default=False)), + ('created_att', models.DateTimeField(auto_now_add=True)), + ], + ), + ] diff --git a/example/.fluentci/example/.fluentci/example/todo_project/todo_app/migrations/__init__.py b/example/.fluentci/example/.fluentci/example/todo_project/todo_app/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/example/.fluentci/example/.fluentci/example/todo_project/todo_app/models.py b/example/.fluentci/example/.fluentci/example/todo_project/todo_app/models.py new file mode 100644 index 0000000..d6eb24c --- /dev/null +++ b/example/.fluentci/example/.fluentci/example/todo_project/todo_app/models.py @@ -0,0 +1,10 @@ +from django.db import models + +# Create your models here. +class Todo(models.Model): + title = models.CharField(max_length=255) + completed = models.BooleanField(default=False) + created_att = models.DateTimeField(auto_now_add=True) + + class Meta: + app_label = 'todo_app' \ No newline at end of file diff --git a/example/.fluentci/example/.fluentci/example/todo_project/todo_app/templates/todo_app/create_todo.html b/example/.fluentci/example/.fluentci/example/todo_project/todo_app/templates/todo_app/create_todo.html new file mode 100644 index 0000000..c359a4a --- /dev/null +++ b/example/.fluentci/example/.fluentci/example/todo_project/todo_app/templates/todo_app/create_todo.html @@ -0,0 +1,26 @@ + + + + + + + + + Create a Todo + + + +
+

Create Todo

+
+ {% csrf_token %} +
+ + +
+ +
+
+ + + \ No newline at end of file diff --git a/example/.fluentci/example/.fluentci/example/todo_project/todo_app/templates/todo_app/todo_list.html b/example/.fluentci/example/.fluentci/example/todo_project/todo_app/templates/todo_app/todo_list.html new file mode 100644 index 0000000..f227500 --- /dev/null +++ b/example/.fluentci/example/.fluentci/example/todo_project/todo_app/templates/todo_app/todo_list.html @@ -0,0 +1,36 @@ + + + + + + + + + Todos + + + +
+

List

+ Create Todo + + + + + + + + {% for todo in todos %} + + + + {% endfor %} + +
Title
+ {{todo.title}} +
+
+ + + + \ No newline at end of file diff --git a/example/.fluentci/example/.fluentci/example/todo_project/todo_app/tests.py b/example/.fluentci/example/.fluentci/example/todo_project/todo_app/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/example/.fluentci/example/.fluentci/example/todo_project/todo_app/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/example/.fluentci/example/.fluentci/example/todo_project/todo_app/views.py b/example/.fluentci/example/.fluentci/example/todo_project/todo_app/views.py new file mode 100644 index 0000000..2b61509 --- /dev/null +++ b/example/.fluentci/example/.fluentci/example/todo_project/todo_app/views.py @@ -0,0 +1,15 @@ +from django.shortcuts import render, redirect +from .models import Todo + +def todo_list(request): + todos = Todo.objects.all() + context = {'todos': todos} + return render(request, 'todo_app/todo_list.html', context) + +def create_todo(request): + if request.method == 'POST': + title = request.POST.get('title') + todo = Todo(title = title) + todo.save() + return redirect(todo_list) + return render(request, 'todo_app/create_todo.html') diff --git a/example/.fluentci/example/.fluentci/example/todo_project/todo_project/__init__.py b/example/.fluentci/example/.fluentci/example/todo_project/todo_project/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/example/.fluentci/example/.fluentci/example/todo_project/todo_project/asgi.py b/example/.fluentci/example/.fluentci/example/todo_project/todo_project/asgi.py new file mode 100644 index 0000000..e793c4b --- /dev/null +++ b/example/.fluentci/example/.fluentci/example/todo_project/todo_project/asgi.py @@ -0,0 +1,16 @@ +""" +ASGI config for todo_project project. + +It exposes the ASGI callable as a module-level variable named ``application``. + +For more information on this file, see +https://docs.djangoproject.com/en/3.2/howto/deployment/asgi/ +""" + +import os + +from django.core.asgi import get_asgi_application + +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'todo_project.settings') + +application = get_asgi_application() diff --git a/example/.fluentci/example/.fluentci/example/todo_project/todo_project/settings.py b/example/.fluentci/example/.fluentci/example/todo_project/todo_project/settings.py new file mode 100644 index 0000000..ee25f53 --- /dev/null +++ b/example/.fluentci/example/.fluentci/example/todo_project/todo_project/settings.py @@ -0,0 +1,130 @@ +""" +Django settings for todo_project project. + +Generated by 'django-admin startproject' using Django 3.2.16. + +For more information on this file, see +https://docs.djangoproject.com/en/3.2/topics/settings/ + +For the full list of settings and their values, see +https://docs.djangoproject.com/en/3.2/ref/settings/ +""" + +from pathlib import Path + +# Build paths inside the project like this: BASE_DIR / 'subdir'. +BASE_DIR = Path(__file__).resolve().parent.parent + + +# Quick-start development settings - unsuitable for production +# See https://docs.djangoproject.com/en/3.2/howto/deployment/checklist/ + +# SECURITY WARNING: keep the secret key used in production secret! +SECRET_KEY = 'django-insecure-m*389n=@xec5!ta*^4f8l&@*1nl5#(cm%8rt+-qe2)#ay+o%96' + +# SECURITY WARNING: don't run with debug turned on in production! +DEBUG = True + +ALLOWED_HOSTS = [] + + +# Application definition + +INSTALLED_APPS = [ + 'todo_app', + 'django.contrib.admin', + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'django.contrib.messages', + 'django.contrib.staticfiles', +] + +MIDDLEWARE = [ + 'django.middleware.security.SecurityMiddleware', + 'django.contrib.sessions.middleware.SessionMiddleware', + 'django.middleware.common.CommonMiddleware', + 'django.middleware.csrf.CsrfViewMiddleware', + 'django.contrib.auth.middleware.AuthenticationMiddleware', + 'django.contrib.messages.middleware.MessageMiddleware', + 'django.middleware.clickjacking.XFrameOptionsMiddleware', +] + +ROOT_URLCONF = 'todo_project.urls' + +TEMPLATES = [ + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'DIRS': [], + 'APP_DIRS': True, + 'OPTIONS': { + 'context_processors': [ + 'django.template.context_processors.debug', + 'django.template.context_processors.request', + 'django.contrib.auth.context_processors.auth', + 'django.contrib.messages.context_processors.messages', + ], + }, + }, +] + +WSGI_APPLICATION = 'todo_project.wsgi.application' + + +# Database +# https://docs.djangoproject.com/en/3.2/ref/settings/#databases + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.mysql', + 'NAME': 'todo_db', + 'USER': 'root', + 'PASSWORD': '', + 'HOST': 'localhost', + 'PORT': '3306', + } +} + + +# Password validation +# https://docs.djangoproject.com/en/3.2/ref/settings/#auth-password-validators + +AUTH_PASSWORD_VALIDATORS = [ + { + 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', + }, +] + + +# Internationalization +# https://docs.djangoproject.com/en/3.2/topics/i18n/ + +LANGUAGE_CODE = 'en-us' + +TIME_ZONE = 'UTC' + +USE_I18N = True + +USE_L10N = True + +USE_TZ = True + + +# Static files (CSS, JavaScript, Images) +# https://docs.djangoproject.com/en/3.2/howto/static-files/ + +STATIC_URL = '/static/' + +# Default primary key field type +# https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field + +DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' diff --git a/example/.fluentci/example/.fluentci/example/todo_project/todo_project/urls.py b/example/.fluentci/example/.fluentci/example/todo_project/todo_project/urls.py new file mode 100644 index 0000000..4cff88a --- /dev/null +++ b/example/.fluentci/example/.fluentci/example/todo_project/todo_project/urls.py @@ -0,0 +1,24 @@ +"""todo_project URL Configuration + +The `urlpatterns` list routes URLs to views. For more information please see: + https://docs.djangoproject.com/en/3.2/topics/http/urls/ +Examples: +Function views + 1. Add an import: from my_app import views + 2. Add a URL to urlpatterns: path('', views.home, name='home') +Class-based views + 1. Add an import: from other_app.views import Home + 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') +Including another URLconf + 1. Import the include() function: from django.urls import include, path + 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) +""" +from django.contrib import admin +from django.urls import path +from todo_app.views import todo_list, create_todo + +urlpatterns = [ + path('admin/', admin.site.urls), + path('', todo_list, name = 'todo_list'), + path('create/', create_todo, name='create_todo') +] diff --git a/example/.fluentci/example/.fluentci/example/todo_project/todo_project/wsgi.py b/example/.fluentci/example/.fluentci/example/todo_project/todo_project/wsgi.py new file mode 100644 index 0000000..5c55983 --- /dev/null +++ b/example/.fluentci/example/.fluentci/example/todo_project/todo_project/wsgi.py @@ -0,0 +1,16 @@ +""" +WSGI config for todo_project project. + +It exposes the WSGI callable as a module-level variable named ``application``. + +For more information on this file, see +https://docs.djangoproject.com/en/3.2/howto/deployment/wsgi/ +""" + +import os + +from django.core.wsgi import get_wsgi_application + +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'todo_project.settings') + +application = get_wsgi_application() diff --git a/example/.fluentci/example/.fluentci/fixtures/.gitlab-ci.yml b/example/.fluentci/example/.fluentci/fixtures/.gitlab-ci.yml new file mode 100644 index 0000000..8960566 --- /dev/null +++ b/example/.fluentci/example/.fluentci/fixtures/.gitlab-ci.yml @@ -0,0 +1,35 @@ +# Do not edit this file directly. It is generated by Fluent GitLab CI + +variables: + MYSQL_DATABASE: $MYSQL_DB + MYSQL_ROOT_PASSWORD: $MYSQL_PASS + MYSQL_USER: $MYSQL_USER + MYSQL_PASSWORD: $MYSQL_PASS + +install: + image: ubuntu:20.04 + services: + - mysql:8.0 + cache: + paths: + - ~/.cache/pip/ + before_script: + - apt -y update + - apt -y install apt-utils + - apt -y install net-tools python3.8 python3-pip mysql-client libmysqlclient-dev + - apt -y upgrade + - pip3 install -r requirements.txt + +migrations: + stage: build + script: + - python3 manage.py makemigrations + - python3 manage.py migrate + - python3 manage.py check + +django-tests: + stage: test + script: + - echo "GRANT ALL on *.* to '${MYSQL_USER}';"| mysql -u root --password="${MYSQL_ROOT_PASSWORD}" -h mysql + - python3 manage.py test + diff --git a/example/.fluentci/example/.fluentci/flake.lock b/example/.fluentci/example/.fluentci/flake.lock new file mode 100644 index 0000000..0f54683 --- /dev/null +++ b/example/.fluentci/example/.fluentci/flake.lock @@ -0,0 +1,61 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1687709756, + "narHash": "sha256-Y5wKlQSkgEK2weWdOu4J3riRd+kV/VCgHsqLNTTWQ/0=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "dbabf0ca0c0c4bce6ea5eaf65af5cb694d2082c7", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1688652023, + "narHash": "sha256-a3mdaPxDTp5L/joHAPfduOC5i5GlpnOcWBBT7Av6nEQ=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "86f8abf1a7007b1c020c7074bd8da11383e4602a", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "release-23.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/example/.fluentci/example/.fluentci/flake.nix b/example/.fluentci/example/.fluentci/flake.nix new file mode 100644 index 0000000..b13ea7d --- /dev/null +++ b/example/.fluentci/example/.fluentci/flake.nix @@ -0,0 +1,26 @@ +{ + description = "A Nix-flake-based Deno development environment"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/release-23.05"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { + self, + nixpkgs, + flake-utils, + }: + flake-utils.lib.eachDefaultSystem + (system: let + pkgs = import nixpkgs { + inherit system; + }; + in { + devShells.default = pkgs.mkShell { + buildInputs = [ + pkgs.deno + ]; + }; + }); +} \ No newline at end of file diff --git a/example/.fluentci/example/.fluentci/import_map.json b/example/.fluentci/example/.fluentci/import_map.json new file mode 100644 index 0000000..a7058d9 --- /dev/null +++ b/example/.fluentci/example/.fluentci/import_map.json @@ -0,0 +1,28 @@ +{ + "imports": { + "@dagger.io/dagger": "https://esm.sh/v128/*@dagger.io/dagger@0.6.3", + "fluent_gitlab_ci": "https://deno.land/x/fluent_gitlab_ci@v0.3.2/mod.ts", + "nix_installer_pipeline": "https://deno.land/x/nix_installer_pipeline@v0.3.3/mod.ts", + "url": "node:url", + "readline": "node:readline", + "process": "node:process", + "path": "node:path", + "os": "node:os", + "fs": "node:fs", + "crypto": "node:crypto" + }, + "scopes": { + "https://esm.sh/v128/": { + "@lifeomic/axios-fetch": "https://esm.sh/v128/@lifeomic/axios-fetch@3.0.1", + "adm-zip": "https://esm.sh/v128/adm-zip@0.5.10", + "env-paths": "https://esm.sh/v128/env-paths@3.0.0", + "execa": "https://esm.sh/v128/execa@7.1.1", + "graphql-request": "https://esm.sh/v128/graphql-request@6.1.0", + "graphql-tag": "https://esm.sh/v128/graphql-tag@2.12.6", + "graphql": "https://esm.sh/v128/graphql@16.7.1", + "node-color-log": "https://esm.sh/v128/node-color-log@10.0.2", + "node-fetch": "https://esm.sh/v128/node-fetch@3.3.1", + "tar": "https://esm.sh/v128/tar@6.1.15" + } + } +} \ No newline at end of file diff --git a/example/.fluentci/example/.fluentci/mod.ts b/example/.fluentci/example/.fluentci/mod.ts new file mode 100644 index 0000000..fa306a1 --- /dev/null +++ b/example/.fluentci/example/.fluentci/mod.ts @@ -0,0 +1,4 @@ +import * as GitLab from "./src/gitlab/index.ts"; +import * as Dagger from "./src/dagger/index.ts"; + +export { GitLab, Dagger }; diff --git a/example/.fluentci/example/.fluentci/src/dagger/index.ts b/example/.fluentci/example/.fluentci/src/dagger/index.ts new file mode 100644 index 0000000..127f9ef --- /dev/null +++ b/example/.fluentci/example/.fluentci/src/dagger/index.ts @@ -0,0 +1,4 @@ +import pipeline from "./pipeline.ts"; +import { djangoTests } from "./jobs.ts"; + +export { pipeline, djangoTests }; diff --git a/example/.fluentci/example/.fluentci/src/dagger/jobs.ts b/example/.fluentci/example/.fluentci/src/dagger/jobs.ts new file mode 100644 index 0000000..a251048 --- /dev/null +++ b/example/.fluentci/example/.fluentci/src/dagger/jobs.ts @@ -0,0 +1,80 @@ +import Client from "@dagger.io/dagger"; +import { withDevbox } from "https://deno.land/x/nix_installer_pipeline@v0.3.6/src/dagger/steps.ts"; + +export enum Job { + djangoTests = "django-tests", +} + +export const djangoTests = async (client: Client, src = ".") => { + // get MariaDB base image + const mariadb = client + .container() + .from("mariadb:10.11.2") + .withEnvVariable("MARIADB_USER", Deno.env.get("MARIADB_USER") || "user") + .withEnvVariable( + "MARIADB_PASSWORD", + Deno.env.get("MARIADB_PASSWORD") || "password" + ) + .withEnvVariable("MARIADB_DATABASE", "test_db") + .withEnvVariable( + "MARIADB_ROOT_PASSWORD", + Deno.env.get("MARIADB_ROOT_PASSWORD") || "root" + ) + .withExposedPort(3306); + + const context = client.host().directory(src); + const baseCtr = withDevbox( + client + .pipeline(Job.djangoTests) + .container() + .from("alpine:latest") + .withExec(["apk", "update"]) + .withExec(["apk", "add", "bash", "curl"]) + .withMountedCache("/nix", client.cacheVolume("nix")) + .withMountedCache("/etc/nix", client.cacheVolume("nix-etc")) + ); + + const ctr = baseCtr + .withDirectory("/app", context, { + exclude: [".git", ".devbox", ".fluentci"], + }) + .withWorkdir("/app") + .withServiceBinding("db", mariadb) + .withEnvVariable("MARIADB_USER", Deno.env.get("MARIADB_USER") || "user") + .withEnvVariable( + "MARIADB_PASSWORD", + Deno.env.get("MARIADB_PASSWORD") || "password" + ) + .withEnvVariable("MARIADB_DATABASE", "test_db") + .withEnvVariable( + "MARIADB_ROOT_PASSWORD", + Deno.env.get("MARIADB_ROOT_PASSWORD") || "root" + ) + .withEnvVariable("MARIADB_HOST", Deno.env.get("MARIADB_HOST") || "db") + .withExec([ + "sh", + "-c", + "eval $(devbox shell --print-env) && \ + python3 -m venv $VENV_DIR && \ + . $VENV_DIR/bin/activate && \ + python -m pip install -r requirements.txt --use-pep517 && \ + cd todo_project && \ + python3 manage.py makemigrations && \ + python3 manage.py migrate && \ + python3 manage.py check && \ + python3 manage.py test", + ]); + const result = await ctr.stdout(); + + console.log(result); +}; + +export type JobExec = (client: Client, src?: string) => Promise; + +export const runnableJobs: Record = { + [Job.djangoTests]: djangoTests, +}; + +export const jobDescriptions: Record = { + [Job.djangoTests]: "Run django tests", +}; diff --git a/example/.fluentci/example/.fluentci/src/dagger/list_jobs.ts b/example/.fluentci/example/.fluentci/src/dagger/list_jobs.ts new file mode 100644 index 0000000..857b0de --- /dev/null +++ b/example/.fluentci/example/.fluentci/src/dagger/list_jobs.ts @@ -0,0 +1,21 @@ +import { brightGreen } from "https://deno.land/std@0.191.0/fmt/colors.ts"; +import { runnableJobs, jobDescriptions, Job } from "./jobs.ts"; +import { stringifyTree } from "https://esm.sh/stringify-tree@1.1.1"; + +const tree = { + name: brightGreen("django_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/example/.fluentci/src/dagger/pipeline.ts b/example/.fluentci/example/.fluentci/src/dagger/pipeline.ts new file mode 100644 index 0000000..cda743f --- /dev/null +++ b/example/.fluentci/example/.fluentci/src/dagger/pipeline.ts @@ -0,0 +1,25 @@ +import Client, { connect } from "@dagger.io/dagger"; +import * as jobs from "./jobs.ts"; + +const { djangoTests, runnableJobs } = jobs; + +export default function pipeline(src = ".", args: string[] = []) { + connect(async (client: Client) => { + if (args.length > 0) { + await runSpecificJobs(client, args as jobs.Job[]); + return; + } + + await djangoTests(client, src); + }); +} + +async function runSpecificJobs(client: Client, args: jobs.Job[]) { + for (const name of args) { + const job = runnableJobs[name]; + if (!job) { + throw new Error(`Job ${name} not found`); + } + await job(client); + } +} diff --git a/example/.fluentci/example/.fluentci/src/dagger/runner.ts b/example/.fluentci/example/.fluentci/src/dagger/runner.ts new file mode 100644 index 0000000..e23879e --- /dev/null +++ b/example/.fluentci/example/.fluentci/src/dagger/runner.ts @@ -0,0 +1,3 @@ +import pipeline from "./pipeline.ts"; + +pipeline(".", Deno.args); diff --git a/example/.fluentci/src/gitlab/index.ts b/example/.fluentci/example/.fluentci/src/gitlab/index.ts similarity index 100% rename from example/.fluentci/src/gitlab/index.ts rename to example/.fluentci/example/.fluentci/src/gitlab/index.ts diff --git a/example/.fluentci/src/gitlab/jobs.ts b/example/.fluentci/example/.fluentci/src/gitlab/jobs.ts similarity index 100% rename from example/.fluentci/src/gitlab/jobs.ts rename to example/.fluentci/example/.fluentci/src/gitlab/jobs.ts diff --git a/example/.fluentci/src/gitlab/pipeline.ts b/example/.fluentci/example/.fluentci/src/gitlab/pipeline.ts similarity index 100% rename from example/.fluentci/src/gitlab/pipeline.ts rename to example/.fluentci/example/.fluentci/src/gitlab/pipeline.ts diff --git a/example/.fluentci/example/.fluentci/src/gitlab/pipeline_test.ts b/example/.fluentci/example/.fluentci/src/gitlab/pipeline_test.ts new file mode 100644 index 0000000..ca24710 --- /dev/null +++ b/example/.fluentci/example/.fluentci/src/gitlab/pipeline_test.ts @@ -0,0 +1,8 @@ +import pipeline from "./pipeline.ts"; +import { assertEquals } from "https://deno.land/std@0.191.0/testing/asserts.ts"; + +Deno.test(function pipelineTest() { + const expected = Deno.readTextFileSync("./fixtures/.gitlab-ci.yml"); + const actual = pipeline.toString(); + assertEquals(actual, expected); +}); diff --git a/example/.fluentci/example/todo_project/todo_project/settings.py b/example/.fluentci/example/todo_project/todo_project/settings.py index ee25f53..4f71dc4 100644 --- a/example/.fluentci/example/todo_project/todo_project/settings.py +++ b/example/.fluentci/example/todo_project/todo_project/settings.py @@ -12,6 +12,8 @@ from pathlib import Path +import os + # Build paths inside the project like this: BASE_DIR / 'subdir'. BASE_DIR = Path(__file__).resolve().parent.parent @@ -77,10 +79,10 @@ DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', - 'NAME': 'todo_db', - 'USER': 'root', - 'PASSWORD': '', - 'HOST': 'localhost', + 'NAME': os.getenv('MARIADB_DATABASE', 'todo_db'), + 'USER': os.getenv('MARIADB_USER', 'user'), + 'PASSWORD': os.getenv('MARIADB_PASSWORD', 'password'), + 'HOST': os.getenv('MARIADB_HOST', 'localhost'), 'PORT': '3306', } } diff --git a/example/.fluentci/fixtures/.gitlab-ci.yml b/example/.fluentci/fixtures/.gitlab-ci.yml index 8960566..8084bbf 100644 --- a/example/.fluentci/fixtures/.gitlab-ci.yml +++ b/example/.fluentci/fixtures/.gitlab-ci.yml @@ -1,35 +1,28 @@ -# Do not edit this file directly. It is generated by Fluent GitLab CI +# Do not edit this file directly. It is generated by https://deno.land/x/fluent_gitlab_ci -variables: - MYSQL_DATABASE: $MYSQL_DB - MYSQL_ROOT_PASSWORD: $MYSQL_PASS - MYSQL_USER: $MYSQL_USER - MYSQL_PASSWORD: $MYSQL_PASS - -install: - image: ubuntu:20.04 +.docker: + image: denoland/deno:alpine services: - - mysql:8.0 - cache: - paths: - - ~/.cache/pip/ - before_script: - - apt -y update - - apt -y install apt-utils - - apt -y install net-tools python3.8 python3-pip mysql-client libmysqlclient-dev - - apt -y upgrade - - pip3 install -r requirements.txt + - 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 -migrations: - stage: build - script: - - python3 manage.py makemigrations - - python3 manage.py migrate - - python3 manage.py check +.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 -django-tests: - stage: test +tests: + extends: .dagger script: - - echo "GRANT ALL on *.* to '${MYSQL_USER}';"| mysql -u root --password="${MYSQL_ROOT_PASSWORD}" -h mysql - - python3 manage.py test + - dagger run fluentci django_pipeline diff --git a/example/.fluentci/fixtures/azure-pipelines.yml b/example/.fluentci/fixtures/azure-pipelines.yml new file mode 100644 index 0000000..0fe5b1a --- /dev/null +++ b/example/.fluentci/fixtures/azure-pipelines.yml @@ -0,0 +1,22 @@ +# 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: dagger run fluentci django_pipeline + displayName: Run Dagger Pipelines diff --git a/example/.fluentci/fixtures/buildspec.yml b/example/.fluentci/fixtures/buildspec.yml new file mode 100644 index 0000000..63e7d7c --- /dev/null +++ b/example/.fluentci/fixtures/buildspec.yml @@ -0,0 +1,19 @@ +# 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 + build: + commands: + - dagger run fluentci django_pipeline + post_build: + commands: + - echo Build completed on `date` diff --git a/example/.fluentci/fixtures/config.yml b/example/.fluentci/fixtures/config.yml new file mode 100644 index 0000000..f1699ec --- /dev/null +++ b/example/.fluentci/fixtures/config.yml @@ -0,0 +1,26 @@ +# 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: dagger run fluentci django_pipeline + machine: + image: ubuntu-2004:2023.07.1 +workflows: + dagger: + jobs: + - tests diff --git a/example/.fluentci/fixtures/workflow.yml b/example/.fluentci/fixtures/workflow.yml new file mode 100644 index 0000000..301f463 --- /dev/null +++ b/example/.fluentci/fixtures/workflow.yml @@ -0,0 +1,24 @@ +# Do not edit this file directly. It is generated by https://deno.land/x/fluent_github_actions + +name: Test +on: + push: + branches: + - main +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: denolib/setup-deno@v2 + with: + deno-version: v1.36 + - 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: dagger run fluentci django_pipeline diff --git a/example/.fluentci/import_map.json b/example/.fluentci/import_map.json index a7058d9..5ed74ff 100644 --- a/example/.fluentci/import_map.json +++ b/example/.fluentci/import_map.json @@ -1,7 +1,11 @@ { "imports": { "@dagger.io/dagger": "https://esm.sh/v128/*@dagger.io/dagger@0.6.3", - "fluent_gitlab_ci": "https://deno.land/x/fluent_gitlab_ci@v0.3.2/mod.ts", + "fluent_gitlab_ci": "https://deno.land/x/fluent_gitlab_ci@v0.4.2/mod.ts", + "fluent_github_actions": "https://deno.land/x/fluent_github_actions@v0.2.1/mod.ts", + "fluent_circleci": "https://deno.land/x/fluent_circleci@v0.2.5/mod.ts", + "fluent_azure_pipelines": "https://deno.land/x/fluent_azure_pipelines@v0.2.0/mod.ts", + "fluent_aws_codepipeline": "https://deno.land/x/fluent_aws_codepipeline@v0.2.3/mod.ts", "nix_installer_pipeline": "https://deno.land/x/nix_installer_pipeline@v0.3.3/mod.ts", "url": "node:url", "readline": "node:readline", diff --git a/example/.fluentci/mod.ts b/example/.fluentci/mod.ts index fa306a1..2c3acca 100644 --- a/example/.fluentci/mod.ts +++ b/example/.fluentci/mod.ts @@ -1,4 +1,3 @@ -import * as GitLab from "./src/gitlab/index.ts"; import * as Dagger from "./src/dagger/index.ts"; -export { GitLab, Dagger }; +export { Dagger }; diff --git a/example/.fluentci/src/aws/README.md b/example/.fluentci/src/aws/README.md new file mode 100644 index 0000000..b3f234d --- /dev/null +++ b/example/.fluentci/src/aws/README.md @@ -0,0 +1,38 @@ +# AWS CodePipeline + +[![deno module](https://shield.deno.dev/x/django_pipeline)](https://deno.land/x/django_pipeline) +![deno compatibility](https://shield.deno.dev/deno/^1.34) +[![](https://img.shields.io/codecov/c/gh/fluent-ci-templates/django-pipeline)](https://codecov.io/gh/fluent-ci-templates/django-pipeline) + +The following command will generate a `buildspec.yml` file in your project: + +```bash +fluentci ac init -t django_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 + build: + commands: + - dagger run fluentci django_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 new file mode 100644 index 0000000..0b72f79 --- /dev/null +++ b/example/.fluentci/src/aws/config.ts @@ -0,0 +1,24 @@ +import { BuildSpec } from "fluent_aws_codepipeline"; + +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: ["dagger run fluentci django_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 new file mode 100644 index 0000000..97bed68 --- /dev/null +++ b/example/.fluentci/src/aws/config_test.ts @@ -0,0 +1,9 @@ +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 new file mode 100644 index 0000000..83944b7 --- /dev/null +++ b/example/.fluentci/src/aws/init.ts @@ -0,0 +1,3 @@ +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 new file mode 100644 index 0000000..737b26f --- /dev/null +++ b/example/.fluentci/src/azure/README.md @@ -0,0 +1,41 @@ +# Azure Pipelines + +[![deno module](https://shield.deno.dev/x/django_pipeline)](https://deno.land/x/django_pipeline) +![deno compatibility](https://shield.deno.dev/deno/^1.34) +[![](https://img.shields.io/codecov/c/gh/fluent-ci-templates/django-pipeline)](https://codecov.io/gh/fluent-ci-templates/django-pipeline) + +The following command will generate a `azure-pipelines.yml` file in your project: + +```bash +fluentci ap init -t django_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: dagger run fluentci django_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 new file mode 100644 index 0000000..4c50e61 --- /dev/null +++ b/example/.fluentci/src/azure/config.ts @@ -0,0 +1,41 @@ +import { AzurePipeline } from "fluent_azure_pipelines"; + +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: "dagger run fluentci django_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 new file mode 100644 index 0000000..0311f55 --- /dev/null +++ b/example/.fluentci/src/azure/config_test.ts @@ -0,0 +1,9 @@ +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 new file mode 100644 index 0000000..2e71b2e --- /dev/null +++ b/example/.fluentci/src/azure/init.ts @@ -0,0 +1,3 @@ +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 new file mode 100644 index 0000000..72da1c9 --- /dev/null +++ b/example/.fluentci/src/circleci/README.md @@ -0,0 +1,46 @@ +# Circle CI + +[![deno module](https://shield.deno.dev/x/django_pipeline)](https://deno.land/x/django_pipeline) +![deno compatibility](https://shield.deno.dev/deno/^1.34) +[![](https://img.shields.io/codecov/c/gh/fluent-ci-templates/django-pipeline)](https://codecov.io/gh/fluent-ci-templates/django-pipeline) + + +The following command will generate a `.circleci/config.yml` file in your project: + +```bash +fluentci cci init -t django_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: Upload Coverage + command: dagger run fluentci django_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 new file mode 100644 index 0000000..a892e00 --- /dev/null +++ b/example/.fluentci/src/circleci/config.ts @@ -0,0 +1,37 @@ +import { CircleCI, Job } from "fluent_circleci"; + +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: "dagger run fluentci django_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 new file mode 100644 index 0000000..283a9c3 --- /dev/null +++ b/example/.fluentci/src/circleci/config_test.ts @@ -0,0 +1,9 @@ +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 new file mode 100644 index 0000000..1f71248 --- /dev/null +++ b/example/.fluentci/src/circleci/init.ts @@ -0,0 +1,3 @@ +import { generateYaml } from "./config.ts"; + +generateYaml().save(".circleci/config.yml"); diff --git a/example/.fluentci/src/github/README.md b/example/.fluentci/src/github/README.md new file mode 100644 index 0000000..97f03f5 --- /dev/null +++ b/example/.fluentci/src/github/README.md @@ -0,0 +1,49 @@ +# Github Actions + +[![deno module](https://shield.deno.dev/x/django_pipeline)](https://deno.land/x/django_pipeline) +![deno compatibility](https://shield.deno.dev/deno/^1.34) +[![](https://img.shields.io/codecov/c/gh/fluent-ci-templates/django-pipeline)](https://codecov.io/gh/fluent-ci-templates/django-pipeline) + +The following command will generate a `.github/workflows/tests.yml` file in your project: + +```bash +fluentci gh init -t django_pipeline +``` + +Or, if you already have a `.fluentci` folder (generated from `fluentci init -t django`) in your project: + +```bash +fluentci gh init +``` + +Generated file: + +```yaml +# Do not edit this file directly. It is generated by Fluent Github Actions + +name: Test +on: + push: + branches: + - main +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: denolib/setup-deno@v2 + with: + deno-version: v1.36 + - 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: dagger run fluentci django_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 new file mode 100644 index 0000000..77682e7 --- /dev/null +++ b/example/.fluentci/src/github/config.ts @@ -0,0 +1,45 @@ +import { JobSpec, Workflow } from "fluent_github_actions"; + +export function generateYaml(): Workflow { + const workflow = new Workflow("Test"); + + const push = { + branches: ["main"], + }; + + const setupDagger = `\ + curl -L https://dl.dagger.io/dagger/install.sh | DAGGER_VERSION=0.8.1 sh + sudo mv bin/dagger /usr/local/bin + dagger version`; + + const test: JobSpec = { + "runs-on": "ubuntu-latest", + steps: [ + { + uses: "actions/checkout@v2", + }, + { + uses: "denolib/setup-deno@v2", + with: { + "deno-version": "v1.36", + }, + }, + { + name: "Setup Fluent CI CLI", + run: "deno install -A -r https://cli.fluentci.io -n fluentci", + }, + { + name: "Setup Dagger", + run: setupDagger, + }, + { + name: "Run Dagger Pipelines", + run: "dagger run fluentci django_pipeline", + }, + ], + }; + + workflow.on({ push }).jobs({ test }); + + return workflow; +} diff --git a/example/.fluentci/src/github/config_test.ts b/example/.fluentci/src/github/config_test.ts new file mode 100644 index 0000000..88bf54f --- /dev/null +++ b/example/.fluentci/src/github/config_test.ts @@ -0,0 +1,9 @@ +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 new file mode 100644 index 0000000..0d5e00f --- /dev/null +++ b/example/.fluentci/src/github/init.ts @@ -0,0 +1,3 @@ +import { generateYaml } from "./config.ts"; + +generateYaml().save(".github/workflows/deploy.yml"); diff --git a/example/.fluentci/src/gitlab/README.md b/example/.fluentci/src/gitlab/README.md new file mode 100644 index 0000000..860b57e --- /dev/null +++ b/example/.fluentci/src/gitlab/README.md @@ -0,0 +1,46 @@ +# Gitlab CI + +[![deno module](https://shield.deno.dev/x/django_pipeline)](https://deno.land/x/django_pipeline) +![deno compatibility](https://shield.deno.dev/deno/^1.34) +[![](https://img.shields.io/codecov/c/gh/fluent-ci-templates/django-pipeline)](https://codecov.io/gh/fluent-ci-templates/django-pipeline) + +The following command will generate a `.gitlab-ci.yml` file in your project: + +```bash +fluentci gl init -t django_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: + - dagger run fluentci django_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 new file mode 100644 index 0000000..240bbbe --- /dev/null +++ b/example/.fluentci/src/gitlab/config.ts @@ -0,0 +1,34 @@ +import { GitlabCI, Job } from "fluent_gitlab_ci"; + +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("dagger run fluentci django_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 new file mode 100644 index 0000000..bf5c856 --- /dev/null +++ b/example/.fluentci/src/gitlab/config_test.ts @@ -0,0 +1,9 @@ +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 new file mode 100644 index 0000000..4da66cf --- /dev/null +++ b/example/.fluentci/src/gitlab/init.ts @@ -0,0 +1,3 @@ +import { generateYaml } from "./config.ts"; + +generateYaml().write();