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.

Conditiona…


This content originally appeared on DEV Community and was authored by Sibelius Seraphini

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

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

deploy_staging_ledger:
    steps:
      - when: << pipeline.parameters.ledger-modified >>          

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!


This content originally appeared on DEV Community and was authored by Sibelius Seraphini


Print Share Comment Cite Upload Translate Updates
APA

Sibelius Seraphini | Sciencx (2023-04-19T11:36:40+00:00) Fast CI/CD for Monorepos. Retrieved from https://www.scien.cx/2023/04/19/fast-ci-cd-for-monorepos/

MLA
" » Fast CI/CD for Monorepos." Sibelius Seraphini | Sciencx - Wednesday April 19, 2023, https://www.scien.cx/2023/04/19/fast-ci-cd-for-monorepos/
HARVARD
Sibelius Seraphini | Sciencx Wednesday April 19, 2023 » Fast CI/CD for Monorepos., viewed ,<https://www.scien.cx/2023/04/19/fast-ci-cd-for-monorepos/>
VANCOUVER
Sibelius Seraphini | Sciencx - » Fast CI/CD for Monorepos. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2023/04/19/fast-ci-cd-for-monorepos/
CHICAGO
" » Fast CI/CD for Monorepos." Sibelius Seraphini | Sciencx - Accessed . https://www.scien.cx/2023/04/19/fast-ci-cd-for-monorepos/
IEEE
" » Fast CI/CD for Monorepos." Sibelius Seraphini | Sciencx [Online]. Available: https://www.scien.cx/2023/04/19/fast-ci-cd-for-monorepos/. [Accessed: ]
rf:citation
» Fast CI/CD for Monorepos | Sibelius Seraphini | Sciencx | https://www.scien.cx/2023/04/19/fast-ci-cd-for-monorepos/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.