CI (continuous integration) means every code change is automatically built and tested when pushed. CD means the tested change is then delivered or deployed. A pipeline is the ordered set of automated stages: build, test, package, deploy. It catches breakage within minutes and makes releases routine instead of risky.
On this page
What CI and CD mean, and how delivery differs from deploymentA working GitHub Actions workflow for a Python projectPipeline stages and what each one catchesDeploy strategies: rolling, blue-green and canaryCommon pipeline failures and fixesFrequently asked questionsThis page is for students building their first project who want the pipeline to be more than a copied YAML file. The workflow below was checked against GitHub's current documentation on 1 December 2026, its YAML was parsed with PyYAML, and its test command was run locally on a two-file project. It has not run on GitHub itself, so the first run in your repository is the real test.
A pipeline is the automation around Git. If you are shaky on branches and pull requests, start with the Git commands cheat sheet; to package what the pipeline ships, read Docker for beginners.
- 1Commita push or pull request triggers the run
- 2Buildinstall dependencies, compile
- 3Testunit tests, lint, security scan
- 4Packagebuild an image or artifact
- 5Deployrelease to staging, then production
What CI and CD mean, and how delivery differs from deployment
Continuous integration is the habit of merging small changes often and having a server build and test each one automatically. Continuous delivery extends it: every change that passes is packaged and ready to release, with a person pressing the button. Continuous deployment removes the button: a passing change goes to production by itself. Atlassian's CI vs CD page covers the three terms and says CD can mean either delivery or deployment, with deployment going one step further. Where a team draws the line on manual approval varies, so ask.
So "CD" means two different things. Ask which one a team means. Most teams practise continuous delivery with a manual approval before production, and that is a perfectly good setup for a student project too.
A working GitHub Actions workflow for a Python project
GitHub Actions reads YAML files from .github/workflows/ in your repository. This one tests on two Python versions for every push to main and every pull request, and deploys only after tests pass on main. Put an app.py, a test_app.py and a requirements.txt (empty is fine) in the repository to try it.
# .github/workflows/ci.yml
name: CI
on:
push:
branches: [main]
pull_request:
permissions:
contents: read
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
matrix:
python-version: ["3.11", "3.12"]
steps:
- uses: actions/checkout@v6
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run tests
run: python -m unittest discover -v
deploy:
needs: test
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
environment: production
steps:
- name: Deploy
run: echo "Replace this step with your real deploy command"
onsets the triggers: pushes tomainand any pull request.workflow_dispatchadds a manual run button if you want one.permissions: contents: readlimits the automaticGITHUB_TOKENto the minimum. GitHub's syntax page says to allow only the access required.concurrencywithcancel-in-progress: truecancels an older run of the same branch when you push again, saving minutes.runs-on: ubuntu-latestpicks a GitHub-hosted Linux runner.timeout-minutesstops a hung job from burning your allowance.strategy.matrixruns the job once per Python version.actions/setup-python@v5installs it;actions/checkout@v6fetches your code. Both version tags are the ones in GitHub's Python guide as read on 1 December 2026; check the actions' pages for newer tags.needs: testmakesdeploywait for every matrix run to pass. Theiflimits it to pushes onmain, so pull requests never deploy.environment: productionlets you add required reviewers in repository settings, which gives you continuous delivery with an approval.
The test step is plain python -m unittest discover -v. Swap in pytest once you add it to requirements.txt. The Python guide is at GitHub's building and testing Python, and every key above is defined in the workflow syntax reference.
What it costs on the free plan, as of 1 December 2026
GitHub's Actions billing page says standard GitHub-hosted runners are free in public repositories and do not use up your included allowance. For private repositories the GitHub Free plan includes $12 USD of compute per month, 500 MB of artifact storage and 10 GB of cache per repository. The page says the allowance is a money amount, not a fixed number of minutes, and its own example prices a standard Linux runner at $0.006 USD per minute, so by our arithmetic $12 covers about 2,000 Linux minutes. Rates differ by runner type and can change, so check the page. Failed runs also use minutes.
Pipeline stages and what each one catches
| Stage | What runs | Fails when | Keep it under |
|---|---|---|---|
| Trigger | Push, pull request or schedule | Wrong branch filter, workflow file has a YAML error | Not applicable |
| Build | Install dependencies, compile | Missing or unpinned dependency, wrong language version | A few minutes |
| Lint and format | ruff, eslint, black --check | Style or obvious bug patterns | 1 minute |
| Unit tests | Fast tests of your own code | A real regression | Under 5 minutes |
| Integration tests | Code with a real database or service | Wiring, schema or config mistakes | Under 10 minutes |
| Security scan | Dependency and secret scanning | Known-vulnerable package, committed key | Run in parallel |
| Package | Build a Docker image or artifact | Bad Dockerfile, missing file | A few minutes |
| Deploy to staging | Release to a test copy of production | Config or migration problem | Automatic |
| Deploy to production | Release to users | Health check fails | Approval, then automatic |
The time budgets are our rule of thumb, not a standard. The principle behind them: slow pipelines get skipped, so keep the first feedback fast and push slow checks later. Common tools besides GitHub Actions: GitLab CI/CD (built into GitLab), Jenkins (self-hosted, open source, plugin-heavy), CircleCI (hosted) and Azure Pipelines. The concepts transfer; only the YAML changes.
Deploy strategies: rolling, blue-green and canary
A deploy strategy decides how new code replaces old code in production. The choice trades speed, cost and how fast you can undo a bad release.
| Strategy | How it works | Rollback | Cost and catch |
|---|---|---|---|
| Recreate | Stop the old version, start the new one | Redeploy the old one | Cheapest; brief downtime |
| Rolling | Replace instances a few at a time; old and new run together briefly. Kubernetes Deployments update this way | Roll the rollout back, again gradually | No extra environment; both versions must work with the same database |
| Blue-green | Two identical production environments. Test the new one while idle, then switch the router to it | Switch the router back, fast | Double the infrastructure; database changes still need care |
| Canary | Send a small share of users to the new version, watch metrics, then widen | Route users back to the old version | Needs traffic splitting and monitoring |
The definitions of blue-green and canary come from Martin Fowler's BlueGreenDeployment and CanaryRelease notes, and rolling updates from the Kubernetes update tutorial, which describes incrementally replacing Pods with zero downtime. Fowler notes that databases are the hard part, especially schema changes, and suggests deploying a schema change that supports both versions first, then the new application. Make migrations backward-compatible, such as adding a column before using it, so old and new code can run at once.
Common pipeline failures and fixes
| Symptom | Likely cause | Fix |
|---|---|---|
| Passes locally, fails in CI | Different language version or an unpinned dependency | Pin versions; use a matrix that includes your local version |
| Workflow never starts | File not under .github/workflows/, YAML indentation, branch filter excludes the push | Check the Actions tab for a parse error; fix filters |
Permission denied or 403 on a step | permissions too strict for what the step writes | Grant only the one permission that step needs, at job level |
| Secret is empty in a pull request from a fork | Forks do not get repository secrets by design | Do not deploy from fork PRs; keep secrets out of test steps |
| Flaky tests, random red runs | Tests depend on time, order or network | Fix or quarantine them; do not just re-run until green |
| Minutes run out | Large matrix, no concurrency, slow install | Cancel superseded runs, cache dependencies, trim the matrix |
| Deploy runs on a pull request | Missing if condition on the deploy job | Gate on github.ref and the event name as above |
Practise by wiring the workflow to a repo from Python projects for beginners. To go further, the DevOps engineer roadmap and DevOps project ideas list pipelines to build and show on a resume. Free options for the deploy step are in deploy a Python API free.
Frequently asked questions
What is a CI/CD pipeline in simple words?
It is an automated assembly line for software. When you push code, a server builds it, runs tests, packages it and, if everything passes, releases it. If any step fails, the line stops and you are told. It replaces manual build-and-copy steps that are slow and easy to get wrong.
What is the difference between continuous delivery and continuous deployment?
Both start after the tests pass. In continuous delivery, the change is ready to release and a person approves the final push to production. In continuous deployment there is no approval: every passing change goes live automatically. Many teams choose delivery to keep a human check.
Is GitHub Actions free?
Standard GitHub-hosted runners are free in public repositories. For private repositories, GitHub's billing page (read 1 December 2026) lists $12 USD of included compute per month on the Free plan, plus 500 MB artifact storage. Usage beyond that is billed, and rates vary by runner, so read the page before relying on it.
How do I write my first GitHub Actions workflow?
Create .github/workflows/ci.yml in your repository. Set on to push and pull_request, add a job with runs-on: ubuntu-latest, then steps: actions/checkout, a setup action for your language, install dependencies and a test command. Commit it, then open the Actions tab to see the run.
What are the most common CI/CD tools?
GitHub Actions, GitLab CI/CD, Jenkins, CircleCI and Azure Pipelines are the common ones. GitHub Actions and GitLab CI live inside the code host; Jenkins is self-hosted. For deployment to Kubernetes, tools such as Argo CD are also used. The ideas are the same everywhere.
What is the difference between blue-green and canary deployment?
Blue-green keeps two full production environments and switches all traffic at once, giving instant rollback but double the infrastructure. Canary sends only a small share of users to the new version first and widens gradually, which limits the damage of a bad release but needs traffic splitting and monitoring.
Learn this with mentors
Programmes for builders and engineers with admissions open: live classes, mentors and project work.


