18 Nov, 2026Aishwarya Palta
Run Node.js Builds and Tests on Monk CI
Run Node.js builds and tests on Monk CI with a GitHub Actions workflow, npm ci and dependency caching. Learn what the cache saves and how to check results.
Run Node.js Builds and Tests on Monk CI
To run a Node.js project on Monk CI, use a Monk CI runner label in your GitHub Actions job, select your Node.js version, then install, build and test. You keep the GitHub Actions workflow format while choosing the compute that executes it.
This guide uses npm and a project at the repository root. The goal is a repeatable dependency installation and clear failure reporting, with caching to avoid repeated package downloads.
Prepare the repository
Your GitHub organization must install the Monk CI runner app and grant repository access. Follow the [setup guide].
Commit `package.json` and `package-lock.json`. Ensure `npm run build` builds the application and `npm test` runs real tests, exits on completion and returns a nonzero status on failure. Adapt those commands to your framework.
Add the Node.js workflow
Save this as .github/workflows/node-ci.yml. Change `main` if your default branch differs. The example uses Node.js 24; select a version your application supports.
```yaml
name: Node.js CI
on:
pull_request:
push:
branches: [main]
permissions:
contents: read
jobs:
build-and-test:
runs-on: monkci-ubuntu-24.04-4
timeout-minutes: 15
env:
CI: true
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: '24'
cache: npm
cache-dependency-path: package-lock.json
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
- name: Test
run: npm test
```Action release tags checked on 18 November 2026: checkout v7.0.1 and setup-node v7.1.0.
The selected runner provides 4 vCPUs and 15 GB RAM. Treat it as a starting point; use the runner-size guide
Understand what npm caching saves
On Monk CI, setup-node caches npm downloads; run npm ci each time to install dependencies from your lockfile.
For cache misses and custom keys, follow the [GitHub Actions cache guide]