bazel repo: Starting a monorepo
I love monorepos and it was not the case prevously but I do think that monorepos shine in scenarios where:
- The code is tightly coupled together.
- One needs to ensure that resources on dev-tooling are efficiently spent.
- Migrations can be completed atomically.
Bazel is a really good build system, which allows reproducible and reasonably fast builds and the build system is configured with starlark, which can be used to write custom build rules, which allow to do linting or ensure consistency in packaging, etc.
bazel at work and I do not want to have to remember how to use two
build systems or build my
make targets and maintain them across multiple
repositories. For this reason I decide to attempt to create a monorepo for
myself, which would leverage
- Write in multiple languages:
- Have common packaging for all.
- Have reproducible builds and leverage caching in between the builds.
In a few hours I could complete a repository setup, which:
direnvto setup dev environment.
bazeliskto download the predefined
- Setup a custom
shellcheckrule which lints all files with
.shextension in my
gazellefor upcoming go code.
buldifierto ensure that my
BUILD.bazelfiles are formatted.
- Setup a CI script to ensure that my repository is clean.
See it at aignas/c.
- Setup Travis CI or GitHub actions.
- A toy
goCLI to iron out wrinkles in the
gazelleand CI setup.
- A toy
rustCLI to try out
- Add tests for my
shellscripts to test out
- Generalize the
bazelrule and put it into a separate repository.
- Write a
bazelpackaging rule for ArchLinux.
- Make the setup work on all OSes:
bazeliskbootstrap script should check the OS before downloading
shellcheckrule should detect the OS and download the appropriate
shellcheckbinary for the host architecture.
Disclaimer: whilst I do intend to continue experimenting with this and post future updates here, I have other hobbies and it may take some time before I advance this experiment further.
Posted in Programming Monorepo with : bazel git go