Skip to main content

edcb

edcb (for Eibens-Deno Continuous Build) is an opinionated workflow for building a Deno project locally and in a CI environment. It is implemented as a bash script and can be used in a local shell and GitHub Actions.

License Deno doc Deno module Github tag Build Code coverage

Motivation

In order to make a Deno project production ready, the code should be formatted, linted, and tested. This workflow is usually very similar across projects. edcb is an attempt of generalizing these tasks across projects and across local systems and CI environments.

Example

The edcb project is itself built with edcb. Currently, no actual TypeScript API is exported by this project. The answer.ts module serves as a placeholder for testing.

Documentation

The latest version of the edcb.sh file can be installed in a shell:

# Downloads edcb.sh and makes it executable.
curl -sL https://deno.land/x/edcb/edcb.sh > ~/bin/edcb && chmod +x ~/bin/edcb

The edcb version can be specified in the URL:

# Replace {ref} with the desired Git tag or branch.
curl -sL https://deno.land/x/edcb@{ref}/edcb.sh > ~/bin/edcb && chmod +x ~/bin/edcb

Once installed, the upgrade command can be used to install the latest version:

# Let edcb upgrade itself.
edcb upgrade

Building a project is now as simple as running edcb in the project root:

# Formats, lints, and runs tests in the current directory.
edcb

Setting the CI environment variable to true (which is done automatically by GitHub Actions) changes the behavior as follows:

  1. Runs the Deno formatter with the --check flag.
  2. Generates a test coverage file.
  3. Uploads the test coverage file to codecov.io. This step likely fails on local systems, which is the intended behavior.
export CI=true
edcb

The ci.yml workflow file demonstrates how edcb can be used with GitHub Actions. The init command generates the workflow file automatically:

# Generates the workflow file for GitHub Actions.
edcb init