← Back to Git Course | Chapter 9: CI/CD & DevOps | Lesson 2 of 5

Git CI/CD Pipeline Basics

What is CI/CD?

CI/CD stands for Continuous Integration and Continuous Deployment. It is the practice of automating the testing, building, and deployment of your code on every commit. This keeps your utility tools on cookiescursor.com stable and error-free.

Example: What is CI/CD?

bash
# .github/workflows/ci-cd.yml
on: push
jobs:
  build:
    runs-on: ubuntu-latest

Automating Tests on Push

Continuous Integration means running your test suite automatically on every push, so a broken change gets flagged within minutes rather than being discovered days later when someone else's work collides with it.

Example: Automating Tests on Push

bash
on:
  push:
jobs:
  test:
    steps:
      - run: npm test

Managing Build Artifacts

Once tests pass, the pipeline can compile the project and upload the resulting binaries or archives as build artifacts — downloadable from the run's summary page, and reusable by a later deployment step without rebuilding from scratch.

Example: Managing Build Artifacts

bash
steps:
  - run: npm run build
  - uses: actions/upload-artifact@v4
    with:
      name: build
      path: dist/

Integrating Environment Secrets

Hardcoding an API key or database password directly in a workflow file exposes it to anyone who can read the repository. Repository secrets are encrypted at rest and only injected as environment variables during the run, keeping them out of the actual source code.

Example: Integrating Environment Secrets

bash
steps:
  - run: deploy.sh
    env:
      API_KEY: ${{ secrets.API_KEY }}

Pipeline Status Badges

You can display your active build status directly inside your README.md file using an markdown status badge. This shows visitors if your codebase is currently compiling successfully.

Example: Pipeline Status Badges

bash
![CI](https://github.com/user/repo/actions/workflows/ci.yml/badge.svg)
🔒

Chapter Quiz — Complete all 5 topics to unlock

0/5 topics done

Complete these topics first:

Login to run this code

C/C++/Java/PHP execution requires a free account. Your code is saved — you'll land right back in the editor after logging in.