DEV Community

Cover image for Fast CI/CD for Monorepos
Sibelius Seraphini for Woovi

Posted on

9

Fast CI/CD for Monorepos

Monorepo brings a lot of benefits such as code sharing, simple dependency managing and easy to apply changes to many services at once.
However, it can also make your CI/CD slow if you always test and build every package and service.

Conditional build

Conditional build is the technique where you check what files changed to determine what jobs and workflows you should or should not run on your CI/CD.

CircleCI provides an orb, like a package, that tells if a given path changed from the last workflow. You can define it in a config.yml file

version: 2.1
setup: true
orbs:
  path-filtering: circleci/path-filtering@0.0.2

workflows:
  setup:
    jobs:
      - path-filtering/filter:
          base-revision: main
          mapping: |
            packages/account/.* account-modified true
            packages/ledger/.*  ledger-modified true
            packages/card/.*    card-modified true
Enter fullscreen mode Exit fullscreen mode

Then, you can use this variables in the main workflow, like this:

deploy_staging_ledger:
    steps:
      - when: << pipeline.parameters.ledger-modified >>          
Enter fullscreen mode Exit fullscreen mode

deploy_staging_ledger will only run when ledger package was modified.

In Conclusion

As you scale, you need to find a more optimized way to make your process more efficient.
Testing and building only packages and services affected by code changes reduces the cost and time to production.


What optimizations are you doing in your Startup?


References

Reducing testing and building time in Monorepos
Woovi CI/CD Talk


Woovi
Woovi is a Startup that enables shoppers to pay as they like. To make this possible, Woovi provides instant payment solutions for merchants to accept orders.

If you want to work with us, we are hiring!

Heroku

Simplify your DevOps and maximize your time.

Since 2007, Heroku has been the go-to platform for developers as it monitors uptime, performance, and infrastructure concerns, allowing you to focus on writing code.

Learn More

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Discover a treasure trove of wisdom within this insightful piece, highly respected in the nurturing DEV Community enviroment. Developers, whether novice or expert, are encouraged to participate and add to our shared knowledge basin.

A simple "thank you" can illuminate someone's day. Express your appreciation in the comments section!

On DEV, sharing ideas smoothens our journey and strengthens our community ties. Learn something useful? Offering a quick thanks to the author is deeply appreciated.

Okay