CI/CD Pipeline Config Cheat Sheet
Quick reference for CI/CD configuration: GitHub Actions, GitLab CI, Jenkins, CircleCI, and Travis CI syntax compared.
CI/CD & DevOps
ci-cd
github-actions
gitlab-ci
CI/CD configs repeat the same ideas across platforms: a trigger, a set of jobs/stages, steps that run commands, and caching. The concepts transfer; the syntax differs.
GitHub Actions
yaml
name: CI
on:
push:
branches: [main]
pull_request:
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: pnpm
- run: pnpm install
- run: pnpm test
Table
| Concept | GitHub Actions term |
|---|---|
| Trigger | on: push / pull_request / schedule |
| Job | jobs.<id> with runs-on |
| Steps | steps[].run or steps[].uses |
| Env | env: at job/step level |
| Cache | actions/cache or setup-action cache: |
| Secrets | secrets.NAME (from Settings → Secrets) |
| Artifacts | actions/upload-artifact |
GitLab CI
yaml
stages: [test, deploy]
test:
stage: test
image: node:22
script:
- npm ci
- npm test
cache:
key: node-modules
paths: [node_modules]
deploy:
stage: deploy
image: alpine
script:
- echo "deploying"
only:
- main
Table
| Concept | GitLab CI term |
|---|---|
| Trigger | on: → rules / only/except |
| Job | A job key with stage: + script: |
| Image | image: per job |
| Cache | cache: with key + paths |
| Variables | variables: (or CI/CD variables in UI) |
| Artifacts | artifacts: |
Jenkins (Declarative Jenkinsfile)
groovy
pipeline {
agent any
stages {
stage('Test') {
steps {
sh 'npm ci'
sh 'npm test'
}
}
stage('Deploy') {
when { branch 'main' }
steps {
sh 'npm run deploy'
}
}
}
post {
always { echo 'done' }
}
}
Table
| Concept | Jenkins term |
|---|---|
| Trigger | triggers {} (cron, webhook) |
| Stage | stage('Name') { steps { } } |
| Agent | agent any / agent { docker {...} } |
| Env | environment { NAME = 'value' } |
| Post-run | post { success/failure/always } |
| Parallel | parallel { stage('a'){} stage('b'){} } |
CircleCI
yaml
version: 2.1
jobs:
test:
docker:
- image: cimg/node:22.0
steps:
- checkout
- restore_cache:
keys: [deps-{{ checksum "package-lock.json" }}]
- run: npm ci
- save_cache:
key: deps-{{ checksum "package-lock.json" }}
paths: [node_modules]
workflows:
version: 2
main:
jobs: [test]
Concept Comparison Table
Table
| Concept | GitHub Actions | GitLab CI | Jenkins | CircleCI | Travis CI |
|---|---|---|---|---|---|
| Config file | .github/workflows/*.yml | .gitlab-ci.yml | Jenkinsfile | .circleci/config.yml | .travis.yml |
| "Job" | job | job | stage | job | job |
| "Step" | step | script item | step | step | before_script/script |
| Env vars | env: / secrets | variables: | environment {} | environment: | env: |
| Cache | actions/cache | cache: | convention | save_cache/restore_cache | cache: |
| Condition | if: | rules: | when {} | filters: | if:/branches: |
Common Pitfalls
[!WARNING] Never hardcode secrets in the config file — use the platform's secret store (
secrets.NAME,variables, credentials) and keep the file greppable.
[!TIP] Cache dependency directories keyed by the lockfile checksum so installs stay fast but the cache invalidates on any dependency change.