Answers: <p>This discussion gives a pretty good suggestion on how to accomplish what I want.</p>
  
  <p><a href="https://discuss.circleci.com/t/does-circleci-2-0-work-with-monorepos/10378/11" rel="nofollow noreferrer">https://discuss.circleci.com/t/does-circleci-2-0-work-with-monorepos/10378/11</a></p>
  
Answers: CC BY-SA 3.0
Answers: 2017-11-16T01:14:20.727Z
Answers: 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.
Answers: Dan Cornilescu
Answers: CC BY-SA 4.0
Answers: 2021-06-24T11:41:04.957Z
Answers: looks like the link broke! 
Answers: David Chiew
Answers: CC BY-SA 3.0
Answers: 2017-11-15T21:19:05.730Z
Answers: 2017-11-15T21:19:05.730Z
Answers: langkilde
Answers: <p>We're using CircleCI with <strong>Go</strong> monorepo.</p>
  
  <p>Here’s how it’s done: </p>
  
  <ol>
  <li>Define a job for each service in circle config yaml. </li>
  <li>A git push triggers CircleCI job that finds which services are part of the change.</li>
  <li>For each service run a CircleCI job with:</li>
  </ol>
  
  <pre><code>{
    "build_parameters": {
        "CIRCLE_JOB": "my-service"
    }
  }
  </code></pre>
  
  <p>Also, published as an open source: <a href="https://github.com/Tufin/circleci-monorepo" rel="nofollow noreferrer">https://github.com/Tufin/circleci-monorepo</a></p>
  
Answers: CC BY-SA 4.0
Answers: 2019-03-10T15:45:58.847Z
Answers: 2019-03-10T15:45:58.847Z
Answers: Effi Bar-She'an
Answers: <p>I came here in addition of previous answer of @effi-bar-shean and @langkilde which give a good overview of the problem. My answer will be focus for JavaScript </p>
  
  <blockquote>
    <p>How to build on part of monorepo that have changed ?</p>
  </blockquote>
  
  <p>You can use the <a href="https://github.com/CircleCI-Public/api-preview-docs/" rel="nofollow noreferrer">2.0 API</a> of <a href="https://github.com/CircleCI-Public/" rel="nofollow noreferrer">CircleCI</a> which allow you to trigger multiples workflow separately. If you have a JavaScript monorepo you can use a tool like <a href="https://github.com/lerna/lerna" rel="nofollow noreferrer">lerna</a> to trigger the workflow of your choice</p>
  
  <p>Example:
  The output of <code>lerna changed -a</code> gives you all repository that have changed then you have to trigger the workflow of theses packages. You can see a <a href="https://tech.julienkarst.com/how-to-setup-circleci-inside-a-monorepo" rel="nofollow noreferrer">full example here</a></p>
  
  <p><a href="https://github.com/JulienKode/circleci-monorepo-example" rel="nofollow noreferrer">Here is an example</a> of repository for Javascript monorepo </p>
  
  <p>I hope my answer help you </p>
  
Answers: CC BY-SA 4.0
Answers: 2019-11-22T16:50:17.497Z
Answers: 2019-11-22T16:50:17.497Z
Answers: Julien Kode
Body: <p>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. </p>
  
  <p>Is there some way to condition a CircleCI job on which directory you committed code to?</p>
  
Comments: CC BY-SA 3.0
Comments: 2017-11-19T10:30:30.057Z
Comments: 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.
Comments: Oliver Charlesworth
Tags: <continuous-integration><continuous-delivery><build-pipeline><circleci-2.0><monorepo>
Title: Condition CircleCI build on what part of monorepo changed?
UserDisplayName: langkilde
ThreadText: # Condition CircleCI build on what part of monorepo changed?
  
  (Asked by: username_0 on 2017-11-15)
  
  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?
  
  **Tags:** continuous-integration, continuous-delivery, build-pipeline, circleci-2.0, monorepo
  
  > **Comments:**
  > **username_1**: 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.  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_0 on 2017-11-15. Score: 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>
  
  > **Comments:**
  > **username_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.  
  > **username_3**: looks like the link broke!   
  
  ---
  
  ### Answer by username_4 on 2019-03-10. Score: 2
  
  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>
  
  
  ---
  
  ### Answer by username_5 on 2019-11-22. Score: 0
  
  I came here in addition of previous answer of @username_4-bar-shean and @username_0 which give a good overview of the problem. My answer will be focus for JavaScript
  
  > How to build on part of monorepo that have changed ?
  
  You can use the [2.0 API](https://github.com/CircleCI-Public/api-preview-docs/) of [CircleCI](https://github.com/CircleCI-Public/) which allow you to trigger multiples workflow separately. If you have a JavaScript monorepo you can use a tool like [lerna](https://github.com/lerna/lerna) to trigger the workflow of your choice
  
  Example:
  The output of `lerna changed -a` gives you all repository that have changed then you have to trigger the workflow of theses packages. You can see a [full example here](https://tech.julienkarst.com/how-to-setup-circleci-inside-a-monorepo)
  
  [Here is an example](https://github.com/username_5/circleci-monorepo-example) of repository for Javascript monorepo
  
  I hope my answer help you
  
  
  ---
  
  