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

Git CI/CD Pipeline Basics

CI/CD एक assembly line जैसी है जो automatically हर नए काम के piece को check करती है और उसे deliver करती है, इसलिए कुछ भी तब तक नहीं भेजा जाता जब तक वह pass न हो।

CI/CD क्या है?

CI/CD का मतलब है Continuous Integration और Continuous Deployment। यह हर commit पर आपके code का testing, building, और deployment automate करने की practice है। यह cookiescursor.com पर आपके utility tools को stable और error-free रखता है।

उदाहरण: What is CI/CD?

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

Push पर Tests Automate करना

Continuous Integration का मतलब है हर push पर automatically आपकी test suite चलाना, ताकि एक टूटा हुआ change दिनों बाद discover होने के बजाय, जब किसी और का काम इससे टकराए, मिनटों में flag हो जाए।

उदाहरण: Automating Tests on Push

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

Build Artifacts Manage करना

एक बार tests pass हो जाएँ, pipeline project compile कर सकता है और resulting binaries या archives को build artifacts की तरह upload कर सकता है — run के summary page से downloadable, और scratch से rebuild किए बिना एक बाद के deployment step द्वारा reusable।

उदाहरण: Managing Build Artifacts

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

Environment Secrets Integrate करना

एक workflow file में सीधे एक API key या database password hardcode करना इसे repository पढ़ सकने वाले किसी को भी expose कर देता है। Repository secrets rest पर encrypted होते हैं और सिर्फ run के दौरान environment variables की तरह inject होते हैं, उन्हें actual source code से बाहर रखते हुए।

उदाहरण: Integrating Environment Secrets

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

Pipeline Status Badges

आप अपने README.md file के अंदर सीधे एक markdown status badge इस्तेमाल करके अपना active build status दिखा सकते हैं। यह visitors को दिखाता है कि आपकी codebase इस समय successfully compile हो रही है या नहीं।

उदाहरण: Pipeline Status Badges

bash
![CI](https://github.com/user/repo/actions/workflows/ci.yml/badge.svg)
Related Topics
{# common_mistakes/chapter_summary/browser_support: on Hindi pages the view already swaps in the hi_ translation fields (or blanks these out if untranslated), so this renders correctly for both languages without a lang_code check here. #}
आम गलतियां
  1. pipeline में tests skip करना और सिर्फ build करना, ताकि टूटा हुआ code अभी भी deploy हो जाए।
  2. workflow file में API keys जैसे secrets commit करना, जबकि उन्हें encrypted secrets की तरह store किया जाना चाहिए।
  3. एक red pipeline को ignore करना और फिर भी merge करना, जो continuous integration का purpose खत्म कर देता है।
🔒

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.