Continuous Integration for Monorepos

Monorepo workflows should be easy to set up

How to set up monorepo workflows

  • A GitHub account.
  • A Semaphore account. Click on Sign up with GitHub to create a free trial account.
  • /service/billing: written in Go, calculates user payments.
  • /service/user: a Ruby-based user registration service. Exposes a HTTP REST endpoint.
  • /service/ui: which is a web UI component. Written in Elixir.
  • The billing app uses Go version 1.12. So, change the first line to sem-version go 1.12.
  • The code is located in the services/billing folder, add cd services/billing after checkout.
sem-version go 1.12 export GO111MODULE=on export GOPATH=~/go export PATH=/home/semaphore/go/bin:$PATH checkout cd services/billing go get ./... go test ./... go build -v .
sem-version ruby 2.5 checkout cd services/users cache restore bundle install cache store bundle exec ruby test.rb
checkout cd services/ui sem-version elixir 1.9 cache restore mix local.hex --force mix local.rebar --force mix deps.get mix deps.compile cache store mix test

Change-based execution with change_in

change_in(['/web/', '/manifests/kubernetes.yml'])
change_in('/web/', { default_branch: 'main' })
change_in('/web/', { pipeline_file: 'ignore' })
change_in('/web/', { exclude: '/web/**/*.md' })

Speeding up pipelines with change_in


Calculating commit ranges

change_in('/services/billing/') and branch = 'master' AND result = 'passed'

Tips for using change_in effectively

  • Define a unified folder organization, so you can use clean change conditions.
  • Design your blocks around project folders.
  • When needed, add multiple files and folders to change_in. Use this to rebuild all the connected project components within a monorepo.
  • Keep branches small, and merge them frequently to cut build times.
  • Use exclude and wildcards to ignore files that are not relevant, such as documentation or READMEs.
  • Use change_in in auto-promotions to selectively trigger continuous delivery or deployment pipelines.

Monorepo workflows got a lot faster




Supporting developers with insights and tutorials on delivering good software. ·

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

How to win your first Hackathon

New Single Farming Pool

ASP.NET Core 3 - Authorization and Authentication with Bearer and JWT

Building a robot sparring partner

10 Amazing Apps Built Using React Native

A Hacky Hacker’s Guide To Jenkins Scripted Pipelines, Part 4

How To Create Golang REST API: Project Layout Configuration [Part 1]

Binary Search!

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store


Supporting developers with insights and tutorials on delivering good software. ·

More from Medium

Domain Driven Design— Solving the problems for solutions

Microservices did you know this ?

When you should use modular monolith instead microservices

Building a Smarter Account Dashboard with Domain-Driven Design