Skip to main content

CI/CD Concepts

CI/CD stands for Continuous Integration and Continuous Delivery (or Deployment). It is the practice of automating the building, testing, and deployment of software so that every change is validated and shipped quickly and reliably.

The Problem Without CI/CD

Without automation, the release process looks like this:

  1. Developers write code for weeks in isolation
  2. Someone manually merges all the changes together
  3. Merge conflicts pile up and take days to resolve
  4. Someone manually runs the tests (if they remember)
  5. Someone manually builds the application
  6. Someone manually deploys to the server
  7. Something breaks in production at 2 AM

This is slow, error-prone, and stressful. CI/CD fixes every step of this process.

Continuous Integration (CI)

Continuous Integration means developers merge their code changes into the main branch frequently — at least once a day. Every merge triggers an automated process that:

  1. Pulls the latest code
  2. Installs dependencies
  3. Builds the application
  4. Runs the test suite
  5. Reports the results

If any step fails, the team is notified immediately. The key principle is: never let the main branch stay broken.

Developer pushes code
        
        
┌──────────────────┐
  CI Pipeline      
                  
  1. Checkout     
  2. Install deps 
  3. Build        
  4. Run tests    
  5. Lint         
  6. Report       
└──────────────────┘
        
   Pass   Fail
   ─────┼──────
              
              
     Merge   Notify
              developer

Continuous Delivery (CD)

Continuous Delivery extends CI by automatically preparing every successful build for release. The code is always in a deployable state, but a human decides when to deploy.

Continuous Deployment goes one step further — every change that passes the pipeline is automatically deployed to production with no human intervention.

PracticeBuildTestDeploy to StagingDeploy to Production
CI onlyAutoAutoManualManual
Continuous DeliveryAutoAutoAutoManual (approval)
Continuous DeploymentAutoAutoAutoAuto

The CI/CD Pipeline

A pipeline is a series of automated stages that code passes through on its way to production:

Code Push  Build  Test  Security Scan  Stage  Approve  Deploy

Each stage acts as a gate. If a stage fails, the pipeline stops and the team is notified.

Typical pipeline stages:

StageWhat It Does
SourceTriggered by a code push or pull request
BuildCompile code, install dependencies
Unit TestsRun fast, isolated tests
Integration TestsTest components working together
Code QualityLinting, formatting, static analysis
SecurityDependency scanning, secret detection
StagingDeploy to a preview environment
AcceptanceEnd-to-end tests or manual review
ProductionDeploy to the live environment

CI/CD Benefits

For developers:

  • Catch bugs within minutes, not weeks
  • Merge smaller changes more frequently
  • Spend less time on manual, repetitive tasks
  • Get confidence that changes work before they reach production

For teams:

  • Consistent, repeatable release process
  • Faster time to market
  • Reduced deployment risk (small, frequent changes)
  • Better collaboration (everyone integrates often)

For the business:

  • Faster delivery of features
  • Fewer production incidents
  • Lower cost of fixing bugs (caught early)
  • Higher software quality

CI/CD Platforms

Several platforms provide CI/CD services:

PlatformDescription
GitHub ActionsBuilt into GitHub, free for public repos
GitLab CI/CDBuilt into GitLab, powerful pipeline syntax
JenkinsSelf-hosted, highly customizable, open source
CircleCICloud-based, fast build times
Travis CICloud-based, popular for open source
Azure DevOpsMicrosoft's CI/CD platform
AWS CodePipelineAmazon's CI/CD service

This course focuses on GitHub Actions because it is free, powerful, and tightly integrated with GitHub where most open-source code lives.

Key CI/CD Practices

1. Commit frequently. Small, frequent commits are easier to review, test, and debug than large batches.

2. Keep the build fast. A CI pipeline that takes 30 minutes discourages frequent commits. Aim for under 10 minutes.

3. Fix broken builds immediately. A broken main branch blocks the entire team. Treat it as the highest priority.

4. Automate everything. If you do it more than twice, automate it — testing, building, deploying, security scanning.

5. Test at multiple levels. Unit tests catch logic errors. Integration tests catch communication errors. End-to-end tests catch user-facing errors.

6. Use feature branches. Develop on branches, test on branches, and only merge to main when the pipeline passes.

7. Deploy to staging first. Always validate in a staging environment that mirrors production before going live.

A Mental Model for CI/CD

Think of CI/CD as a factory assembly line for software:

  • Source control is the raw materials arriving at the factory
  • CI is the quality inspection — every piece is tested before it moves forward
  • CD is the packaging and shipping — once approved, the product goes to the customer
  • The pipeline is the conveyor belt connecting every station

The goal is to make this conveyor belt as fast and reliable as possible, so that a developer can push a code change and see it live in production within minutes — with full confidence that nothing is broken.

What You Will Build

Over the next four lessons, you will:

  1. Create GitHub Actions workflows from scratch
  2. Build a CI pipeline that tests and lints your code on every push
  3. Set up deployment pipelines for staging and production
  4. Implement advanced patterns like matrix builds, caching, and reusable workflows

Summary

CI/CD automates the path from code to production — building, testing, and deploying software on every change. It reduces human error, accelerates delivery, and gives teams confidence in their releases. In the next lesson, you will start building GitHub Actions workflows.