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-denowith adeno-version. - Check formatting and lint with
deno fmt --checkanddeno lint. - Run
deno testwith 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-envGotchas
- Deno is secure by default; grant only the
--allow-*flags your tests actually need. - Use
deno cache(or--frozenwith a lockfile) to pin remote dependency versions.
Related guides
How to Set Up CI for Bun With GitHub ActionsSet up GitHub Actions CI for a Bun project: install Bun with oven-sh/setup-bun, install dependencies with a f…
How to Set Up CI for Node.js (npm) With GitHub ActionsSet up GitHub Actions CI for a Node.js project that uses npm, with setup-node caching the npm store, npm ci f…