Безперервна інтеграція (CI)
Практика розробки ПЗ, при якій розробники багаторазово щодня об'єднують зміни коду в загальний репозиторій, а кожне злиття автоматично перевіряється збіркою та тестами.
CI був описаний Ґрейді Бучем у 1991 році та популяризований Кентом Беком як частина Extreme Programming. Типовий пайплайн: тригер (пуш) → збірка → тести → лінтинг/сканування → звіт. Популярні платформи: GitHub Actions, GitLab CI/CD, Jenkins, CircleCI.
graph LR
Center["Безперервна інтеграція (CI)"]:::main
Rel_parallelism["parallelism"]:::related -.-> Center
click Rel_parallelism "/terms/parallelism"
Rel_agile_methodology["agile-methodology"]:::related -.-> Center
click Rel_agile_methodology "/terms/agile-methodology"
Rel_raid["raid"]:::related -.-> Center
click Rel_raid "/terms/raid"
classDef main fill:#7c3aed,stroke:#8b5cf6,stroke-width:2px,color:white,font-weight:bold,rx:5,ry:5;
classDef pre fill:#0f172a,stroke:#3b82f6,color:#94a3b8,rx:5,ry:5;
classDef child fill:#0f172a,stroke:#10b981,color:#94a3b8,rx:5,ry:5;
classDef related fill:#0f172a,stroke:#8b5cf6,stroke-dasharray: 5 5,color:#94a3b8,rx:5,ry:5;
linkStyle default stroke:#4b5563,stroke-width:2px;
🧒 Простими словами
CI — це як розумний вчитель, що перевіряє вашу домашню роботу щоразу після кожного вирішеного прикладу. Замість того, щоб дізнатися в кінці місяця про помилку на першій сторінці, ви дізнаєтеся про неї за секунди і відразу виправляєте.
🤓 Expert Deep Dive
Ефективний CI базується на піраміді тестів: безліч юніт-тестів (мілісекунди), менше інтеграційних тестів (секунди) і мінімум E2E-тестів (хвилини). CI найкраще працює в парі з Trunk-Based Development (TBD), де всі розробники комітять напряму в основну гілку. CI — це передумова для CD (Continuous Delivery/Deployment).
❓ Часті питання
What is the difference between CI and CD?
CI (Continuous Integration) automatically builds and tests code on every commit, ensuring the codebase is always in a working state. CD (Continuous Delivery or Deployment) goes further, automatically delivering or deploying that verified code to staging or production environments.
What is 'integration hell'?
Integration hell occurs when developers work on separate branches for a long time and then try to merge everything at once. The resulting merge conflicts and hidden incompatibilities can take days or weeks to resolve. CI prevents this by integrating small changes frequently.
Do I need CI for a solo project?
It's highly recommended even for solo projects. CI automatically runs your tests on every commit, catching regressions you might miss, and platforms like GitHub Actions offer generous free tiers.