Using Nadle in CI
This page shows a GitHub Actions workflow that installs dependencies, restores the Nadle task cache and runs nadle check, then lists the flags and exit codes that matter when a machine runs your build.
GitHub Actions
name: CI
on:
pull_request:
push:
branches: [main]
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v6
with:
node-version: 24
cache: npm
- run: npm ci
- name: Restore the Nadle task cache
uses: actions/cache@v6
with:
path: node_modules/.cache/nadle
key: nadle-cache-${{ runner.os }}-${{ github.sha }}
restore-keys: |
nadle-cache-${{ runner.os }}-
- run: npx nadle check --reporter agentNotes on the workflow:
- Nadle needs Node.js 22 or later, so any
node-versionfrom 22 up works. npx nadleis used because a local install does not putnadleon thePATH. With pnpm or yarn usepnpm nadleoryarn nadle.- The action versions are the majors that Nadle's own workflow pins. Pin them to whatever your organization requires.
restore-keysstarts each run from the newest cache of the same operating system, and the unique key saves the updated cache afterwards.
The cache directory
Nadle stores task results in node_modules/.cache/nadle of the project root by default. A task that declares neither inputs nor outputs leaves nothing in the directory. Cache this directory between runs, as in the workflow above. Pass --cache-dir <path> to store it elsewhere and cache that path instead.
On a restored cache a task whose inputs did not change is reported as UP-TO-DATE and skipped. Use --no-cache for a run that must execute every task and store nothing.
Flags for CI
| Flag | What it does in CI |
|---|---|
--reporter agent | Plain output without colors, banner or spinners: one stable line per task. |
--no-cache | Runs every task and stores no results. |
--continue | Keeps running tasks whose dependencies succeeded after a task fails, and reports all failures. |
--max-workers <n> | Caps worker threads; the default is the CPU count minus one. |
--since <ref> | Runs only the requested tasks whose workspace changed since the git ref. CI checkouts must contain the ref, for example by fetching full history. |
The live footer is already off in CI: it defaults to enabled only outside CI and on a terminal.
Two behaviours to know before you script around Nadle:
- A mistyped task name is autocorrected and still runs. With
nadle chekcNadle resolves it tocheck, printsResolved tasks:followed bychekc → root:checkand exits0. Spell task names exactly in CI. - Running
nadlewith no task exits0after printingNo tasks were specified.and noRUN SUCCESSFULsummary. A script that passes an empty variable as the task name therefore still exits0without running anything; check the output or the variable before calling Nadle.
Exit codes
| Code | Meaning |
|---|---|
0 | Every requested task succeeded. |
1 | A task failed, or an unexpected error occurred. |
2 | Invalid configuration: config file missing or unloadable, invalid task names or options. |
3 | A requested task or workspace was not found. |
4 | The task graph contains a dependency cycle. |
Other CI systems
The steps are the same on any CI system:
- Check out the repository and install Node.js 22 or later.
- Install dependencies.
- Restore
node_modules/.cache/nadlefrom your CI cache. - Run
npx nadle <tasks> --reporter agent. - Save
node_modules/.cache/nadleback to the cache.
The --reporter agent output of a cached run looks like this:
UP-TO-DATE build
DONE check 0ms
SUCCESS in 6s (done 1 up-to-date 1)