Skip to content
Latchkey

How to Set Up CI for Deno With GitHub Actions

denoland/setup-deno installs the runtime, and Deno ships fmt, lint, and test as built-in subcommands.

Install Deno with denoland/setup-deno, then run the built-in toolchain: deno fmt --check, deno lint, and deno test. No separate linter or formatter to install.

Steps

  • Check out the code.
  • Run denoland/setup-deno with a deno-version.
  • Check formatting and lint with deno fmt --check and deno lint.
  • Run deno test with the permissions the tests require.

Workflow

.github/workflows/ci.yml
name: CI
on:
  push:
    branches: [main]
  pull_request:
jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: denoland/setup-deno@v2
        with:
          deno-version: v2.x
      - run: deno fmt --check
      - run: deno lint
      - run: deno test --allow-read --allow-env

Gotchas

  • Deno is secure by default; grant only the --allow-* flags your tests actually need.
  • Use deno cache (or --frozen with a lockfile) to pin remote dependency versions.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →