This is a complete, hands-on CircleCI cheat sheet: install, configure, operate, automate and secure it - with copy-paste commands grouped by task. Bookmark it for day-to-day work, incidents and interviews alike.
CircleCI runs pipelines defined in .circleci/config.yml across Docker, VM and macOS executors, with 'orbs' as reusable config packages and strong caching and parallelism.
Why you reach for it
- Fast, cloud-native builds with easy parallelism
- Reusable orbs cut boilerplate
- Docker, machine and macOS executors in one place
Installation
# Validate config locally with the CircleCI CLI
curl -fLSs https://circle.ci/cli | bash
circleci config validateConfiguration reference
Workflow with caching and an orb.
version: 2.1
orbs: { node: circleci/node@5 }
jobs:
test:
docker: [{ image: cimg/node:20.11 }]
steps:
- checkout
- node/install-packages
- run: npm test
workflows:
build: { jobs: [test] }Core commands you use daily
circleci local execute --job test
circleci config process .circleci/config.ymlValidate & run locally
circleci config validate
circleci config process .circleci/config.yml
circleci local execute --job testSplit tests for speed
circleci tests glob 'test/**/*.spec.js' | circleci tests split --split-by=timings | xargs npm testUse it in CI/CD
Fan out slow test suites with parallelism.
test:
parallelism: 4
steps:
- run: circleci tests glob 'test/**/*.spec.js' | circleci tests split | xargs npm testBest-practice checklist
- Cache dependencies and use orbs for common steps
- Store secrets in contexts with restricted access
- Split tests with parallelism for speed
Common pitfalls to avoid
- No caching, so dependencies download every build
- Secrets in config instead of project/context env vars
- One giant job instead of parallel workflows
Security quick wins
- Use contexts and restrict them to protected branches
- Rotate tokens and least-privilege cloud creds (OIDC)
Works well with
- GitHub Actions - CI/CD built into GitHub - event-driven workflows defined in YAML, with a huge marketplace of actions.
- GitLab CI/CD - Pipelines-as-code baked into GitLab, with built-in registry, environments and security scanning.
- Jenkins - The extensible automation server for CI/CD, with pipelines defined as code in a Jenkinsfile.
A cheat sheet is muscle memory on paper - keep it close until the commands live in your fingers.
Want senior help putting CircleCI to work - or a team bootcamp on it? CodeWizard runs Israel's largest DevOps community and embeds named senior engineers with a transparent hours log. Book a free consult or explore the Academy.