Run install, test, and build using stages.
Section: Pipeline building blocks
Minimal GitLab CI pipeline
yaml
yaml
stages:
- test
- build
default:
image: node:20
cache:
paths:
- node_modules/
test:
stage: test
script:
- npm ci
- npm test
build:
stage: build
script:
- npm ci
- npm run buildExplanation
GitLab pipelines are defined in `.gitlab-ci.yml` and usually organized with `stages` and jobs.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing Pipeline building blocks
Minimal GitHub Actions pipeline
Build and test on pushes and pull requests.
Minimal Jenkins declarative pipeline
Run checkout, install, test, and build in a Jenkinsfile.
Nightly scheduled workflow
Run audits, backups, smoke tests, or dependency checks on a schedule.