Mutiple builds in one repository


Using CircleCI, Is it possible to trigger different builds (or different build behaviors) based on the path of a checkin in a single repository?

Say for example you had separate microservices in one repository, with there own tests particular tests, in different directories.

Can CircleCI trigger different builds for each microservice based on a checkin to a particular subdirectory that represented a microservice?

If that is possible, is it also possible, once a particular microservice is built and tested in isolation, to have same full system test suite run based on the successful build of any microservice?


Yes and no. CircleCI simply builds new commits. You can create the logic to do what you asked and either stick it in a Git hook or in your CircleCI YAML.


Can you give an example of how that would look in the CircleCI YAML?


Here’s a blog post I wrote awhile back. In that post, I wrote an example of how you can use Git to react only when certain changes are made in specific directories.

You can take that same concept, and apply it to specific project directories in your monorepo. In the CircleCI YAML, the lines where you run commands are shell scripts so you can run a script to run this logic.

Does that make sense?