DevTools Logo

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
ConceptGitHub Actions term
Triggeron: push / pull_request / schedule
Jobjobs.<id> with runs-on
Stepssteps[].run or steps[].uses
Envenv: at job/step level
Cacheactions/cache or setup-action cache:
Secretssecrets.NAME (from Settings → Secrets)
Artifactsactions/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
ConceptGitLab CI term
Triggeron:rules / only/except
JobA job key with stage: + script:
Imageimage: per job
Cachecache: with key + paths
Variablesvariables: (or CI/CD variables in UI)
Artifactsartifacts:

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
ConceptJenkins term
Triggertriggers {} (cron, webhook)
Stagestage('Name') { steps { } }
Agentagent any / agent { docker {...} }
Envenvironment { NAME = 'value' }
Post-runpost { success/failure/always }
Parallelparallel { 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
ConceptGitHub ActionsGitLab CIJenkinsCircleCITravis CI
Config file.github/workflows/*.yml.gitlab-ci.ymlJenkinsfile.circleci/config.yml.travis.yml
"Job"jobjobstagejobjob
"Step"stepscript itemstepstepbefore_script/script
Env varsenv: / secretsvariables:environment {}environment:env:
Cacheactions/cachecache:conventionsave_cache/restore_cachecache:
Conditionif: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.

References