6

I'm working on a monorepo project that contains a few different subprojects in different languages. Right now I run three different CircleCI "jobs" on each commit. However, each of these packages compile and test themselves independently. Hence I don't actually have to spend time on running all three jobs every time.

Is there some way to condition a CircleCI job on which directory you committed code to?

  • We ultimately solved this by building all of our subprojects (across 3+ languages) via a single build tool - in our case it was Gradle. At that point, we were able to leverage the Gradle build cache (ultimately caching that in CircleCI's build cache!) to skip unnecessary subproject builds. Happy to write this up as an answer if it would be useful. – Oliver Charlesworth Nov 19 '17 at 10:30
3

This discussion gives a pretty good suggestion on how to accomplish what I want.

https://discuss.circleci.com/t/does-circleci-2-0-work-with-monorepos/10378/11

  • 2
    It would be nice to include at a short summary of the approaches discussed - link only answers are always at risk of losing all their value if the link breaks for whatever reason. – Dan Cornilescu Nov 16 '17 at 1:14
1

We're using CircleCI with Go monorepo.

Here’s how it’s done:

  1. Define a job for each service in circle config yaml.
  2. A git push triggers CircleCI job that finds which services are part of the change.
  3. For each service run a CircleCI job with:
{
  "build_parameters": {
      "CIRCLE_JOB": "my-service"
  }
}

Also, published as an open source: https://github.com/Tufin/circleci-monorepo

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.