Pipelines
Test a Node.js project
Install, lint, test and build a Node.js project with pnpm, keeping the package store between runs.
Available in repositories branchd reads pipeline files for. It is switching repositories on one at a time: until yours is, it keeps running its
.forge-ci.yamlor.xeonr-ci.yaml. See What is available.
# .branchd/pipelines/ci.yaml
# Install, lint, test and build a Node.js project with pnpm, keeping the
# package store between runs.
name: CI
on: [push, pull_request]
jobs:
test:
image: node:24
env:
PNPM_STORE_DIR: .pnpm-store
cache:
key: pnpm
files: [pnpm-lock.yaml]
paths: [.pnpm-store]
steps:
- run: corepack enable
- run: pnpm config set store-dir "$PNPM_STORE_DIR"
- run: pnpm install --frozen-lockfile
- run: pnpm lint
- run: pnpm test
- run: pnpm build
artifacts:
paths: [dist]
expire-in: 7 days
cache:keeps.pnpm-storebetween runs.files: [pnpm-lock.yaml]keys the cache on the lock file's contents, withkeyas the prefix, so a new lock file starts a new cache. Cachepathsare relative to the working directory.- Steps share one shell, so
corepack enablein the first step holds for the rest. artifacts:keepsdistfor 7 days. A job thatneeds: [test]would find it in its own working directory.
For npm, replace the pnpm steps with npm ci and cache ~/.npm by setting
npm_config_cache to a path inside the working directory.