How does CI work for a monorepo versus many repos?
IntermediateConceptFundamentals and Pipeline Design
Answer
In a monorepo, running everything on every commit is wasteful. You need change detection: path filters (on.push.paths, GitLab rules:changes), or a build graph tool (Bazel, Nx, Turborepo) that computes affected projects and caches results remotely.
With polyrepo, each repo has its own simple pipeline, but cross-service changes need coordinated PRs and shared pipeline logic must be distributed via shared libraries, reusable workflows or templates.
on:
pull_request:
paths:
- 'services/payments/**'
- '.github/workflows/payments.yml'
A gotcha: with required checks, a path-filtered workflow that does not run leaves the check pending. Use a final "gate" job that always runs.
More on Fundamentals and Pipeline Design
What is Continuous Integration (CI)?BeginnerWhat is the difference between Continuous Delivery and Continuous Deployment?IntermediateWhat is a CI/CD pipeline and what are its stages?BeginnerWhy should a pipeline "fail fast", and how do you order stages to achieve it?IntermediateWhat makes a build reproducible, and why does it matter?AdvancedHow does your branching strategy affect CI? Compare trunk-based development with GitFlow.Intermediate