Files
2nd/10_Wiki/Topics/Programming & Language/Continuous Integration (CI).md
T
2026-05-10 22:08:15 +09:00

4.2 KiB

id, title, category, status, canonical_id, aliases, duplicate_of, source_trust_level, confidence_score, verification_status, tags, raw_sources, last_reinforced, github_commit, tech_stack
id title category status canonical_id aliases duplicate_of source_trust_level confidence_score verification_status tags raw_sources last_reinforced github_commit tech_stack
wiki-20260508-continuous-integration-ci--redir Continuous Integration (CI) 10_Wiki/Topics verified self
CI
Continuous Integration
지속적 통합
none A 0.92 applied
cicd
devops
automation
testing
2026-05-10 pending
language framework
yaml GitHub Actions, GitLab CI, Jenkins

Continuous Integration (CI)

매 한 줄

"매 every commit 의 main branch 의 automated build + test". 매 Grady Booch (1991) 의 coin → Martin Fowler (2000) 의 popularize → 매 2026 의 trunk-based dev + GitHub Actions 의 dominant practice. 매 integration hell 의 prevent — 매 small frequent merge + fast feedback (<10 min).

매 핵심

매 Practices

  • Single source repo (trunk-based, optionally short-lived feature branches).
  • Automated build on every push.
  • Self-testing build (unit + integration).
  • Daily commit to main (최소).
  • Build fast (<10 min target).
  • Test in clone of prod (Docker, ephemeral env).
  • Visible status (badge, Slack notify).
  • Fix red main immediately (revert > forward fix).

매 CI vs CD

  • CI: build + test on every push — main 의 always green.
  • CD (Delivery): 매 always-shippable artifact + manual prod gate.
  • CD (Deployment): 매 fully automated to prod.

매 응용

  1. Pre-merge: PR check (lint, test, type, build).
  2. Post-merge: artifact build + push.
  3. Nightly: e2e, perf, security scan.
  4. Release: tag → publish (npm, container).

💻 패턴

GitHub Actions PR check

name: pr
on: { pull_request: { branches: [main] } }
jobs:
  ci:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: pnpm/action-setup@v3
      - uses: actions/setup-node@v4
        with: { node-version: 20, cache: pnpm }
      - run: pnpm install --frozen-lockfile
      - run: pnpm lint
      - run: pnpm typecheck
      - run: pnpm test --coverage
      - run: pnpm build
      - uses: codecov/codecov-action@v4

Branch protection (main)

# .github/branch-protection.yml (or via API)
required_status_checks:
  strict: true
  contexts: [ci/lint, ci/test, ci/build]
required_pull_request_reviews: { required_approving_review_count: 1 }
enforce_admins: true

Parallel matrix

jobs:
  test:
    strategy:
      fail-fast: false
      matrix:
        node: [18, 20, 22]
        os: [ubuntu-latest, macos-latest, windows-latest]
    runs-on: ${{ matrix.os }}

Cache

- uses: actions/cache@v4
  with:
    path: ~/.pnpm-store
    key: pnpm-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }}

Pre-commit (Husky + lint-staged)

{ "lint-staged": { "*.{ts,tsx}": ["eslint --fix", "prettier --write"] } }

매 결정 기준

상황 Approach
GitHub repo GitHub Actions
GitLab self-host GitLab CI
Java enterprise Jenkins (with Jenkinsfile)
Monorepo, perf-critical Nx Cloud / Turborepo Remote Cache
OSS multi-platform GitHub Actions + matrix

기본값: 매 GitHub Actions + branch protection + required check.

🔗 Graph

  • 부모: CI/CD Pipeline · DevOps
  • 변형: Continuous Delivery · Continuous Deployment
  • 응용: Trunk-Based Development · Pull Request Workflow
  • Adjacent: TeamCity · Jenkins · GitOps · Pre-commit Hook

🤖 LLM 활용

언제: 매 workflow YAML 의 generation, action 의 lookup, matrix 의 expansion. 언제 X: 매 secret handling — 매 OIDC + GitHub Secrets manual review.

안티패턴

  • Long-lived feature branch: 매 merge hell — 매 short-lived (<3 day).
  • Skipping tests ([skip ci] 의 abuse): 매 main 의 break.
  • Slow CI (>15 min): 매 PR backlog — 매 cache + parallelize.
  • Flaky tests 의 retry abuse: 매 fix 의 root cause.
  • Manual deploy from laptop: 매 reproducibility 의 zero — 매 CI 의 only.

🧪 검증 / 중복

  • Verified (Fowler "Continuous Integration", GitHub Actions docs).
  • 신뢰도 A.

🕓 Changelog

날짜 변경
2026-05-08 Phase 1
2026-05-10 Manual cleanup — practices + Actions/branch protection patterns