• Stars
    star
    283
  • Rank 146,066 (Top 3 %)
  • Language
    Java
  • License
    MIT License
  • Created over 5 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

πŸŒΏπŸ’š Example Bazel-ified monorepo, supporting Golang, Java, Python, Scala, and Typescript

Example Bazel Monorepo


Note: Currently supporting the latest Bazel version as at mid June 2021, 4.1.0

Example Bazel-ified monorepo, supporting Golang, Java, Python, Scala, and Typescript.

Cloud Infrastructure-as-Code is done using Terraform.

I use this project to explore how Bazel works with different languages and developer tools, and keep a record of best-practices I've learnt. So it is a work in progress. Others can use it to check out the Bazel way of doing things and use parts as a reference implementation.

Rather than the typical To-Do list, this project's code uses the contrived scenario of a book shop and reading catalogue website called Antilibrary. πŸ“—πŸ“•πŸ“’πŸ“š

Getting Started

Prerequisites:

Bazel aims to be 'build anything, anywhere' system, so building and testing should be as simple as bazel test //.... If it's not, please create an issue.

Why use a Monorepo?

The following few articles together provide a good overview of the motivations behind maintaining a Monorepo. For heaps more information, korfuri/awesome-monorepo is a good place to go.

Related Projects

  • github.com/lucperkins/colossus - A demo using Bazel in monorepo fashion. Compared with this project, it goes far deeper on microservice architecture components and Kubernetes, and is not focused on Bazel.
  • github.com/enginoid/monorepo-base - Employs Bazel, gRPC, and Kubernetes like the above, and is similarly not as broad and deep on Bazel as this project.

Project Structure

Golang Support

There's Golang code in /cli. It implements a simple CLI for the common 'Blind Date With a πŸ“–' product.

Dependency Management

Third-party dependencies are managed in 3rdparty/go_workspace.bzl.

Java Support

There's a Spring Boot (with PostGres) application in /store-api and some other Java code in /store/layoutsolver.

Dependency Management

Its third-party dependencies are managed by rules_jvm_external in the WORKSPACE (See the # JAVA SUPPORT section).

Scala Support

There's Scala code contained in scala-book-sorting.

Dependency Management

Its third-party dependencies are managed by johnynek/bazel-deps. The usage of that tool is wrapped up in a script as tools/update_jvm_dependencies.sh.

To use it, you update tools/dependencies/jvm_dependencies.yaml and then run the script.

Python Support

There's Python code in the /book_sorting and /scraping.

bazelbuild/rules_python is used for the core py_* rules.

Dependency Management

In order to add new third-party packages for Python, add them to 3rdparty/requirements.in and run bazel run //3rdparty:requirements.update.

Gradual Type-Checking (MyPy)

thundergolfer/bazel-mypy-integration is used to check any type annotations at bazel build time.

Infrastructure-as-Code (Hashicorp Terraform)

The infrastructure/ top-level folder contains Terraform defining various AWS resources and their configuration.


Development

Build

bazel build //...

Testing

bazel test //...

Continuous Integration (CI)

This repository's CI is managed by Buildkite, the CI platform used by Pinterest and Canva to manage Bazel monorepos, as well as being used by the Bazel open-source project itself.

Deployment & Distribution

Deployable artifacts are pushed to S3 under commit-hash-versioned keys. Currently only the store-api deploy/fat JAR is deployable.

graknlabs/bazel-distribution is used to publish Python packages to PyPi.

Build Observability + Analysis

This project is using Buildbuddy.IO. Every build run locally or in CI get its own https://app.buildbuddy.io/invocation/xyz123... URL which analyses and records the build's information.

Linting

thundergolfer/bazel-linting-system is used. ./tools/linting/lint.sh will lint all source-code in the repo and ./tools/linting/lint_bzl_files.sh will lint all Bazel files.

More Repositories

1

interview-with-python

The ultimate in python interview preparation and coding practice.
Python
193
star
2

google-rules-of-machine-learning

Github mirror of M. Zinkevich's "Rules of Machine Learning" style guide, with extra goodness.
167
star
3

bazel-linting-system

πŸŒΏπŸ’š Experimental system for registering, configuring, and invoking source-code linters in Bazel.
Starlark
100
star
4

automated-github-organization-invites

Quickly host a webpage allowing people to click and receive an invite to your Github Organization.
Ruby
93
star
5

junior-theme

⚫ A striking black and white theme for Jekyll. Built as a developer blog + portfolio.
JavaScript
70
star
6

awesome-AI-academia

A curated list of academic AI resources and people. Partly an aspirational list, partly a memory aide.
44
star
7

the-general-problem-solver

The General Problem Solver, AI's 'first' algorithm, written in multiple programming languages.
C++
30
star
8

arXie-Bot

arXie is a Slack bot that browses and filters the arXiv repository for you
Python
29
star
9

goodreads-sh

πŸ“™Command line interface for Goodreads.com. Written in Rust.
Rust
28
star
10

thundergolfer.github.io

just my website. πŸŒ©πŸŒπŸΌβ€β™‚οΈ
JavaScript
27
star
11

Insults

Detect whether a social media comment is insulting or derogatory
Python
23
star
12

simplegraphdb

Basic Golang implementation of a Triple Store. Built to learn the Golang language before an internship.
Go
18
star
13

slack-to-pdf

create a PDF report of your team interactions. For university teams
Python
14
star
14

text-classify-with-cnn

🏫 Easy to follow text classifying implementation using a Conv. Neural Network (Tensorflow)
Jupyter Notebook
13
star
15

politifact-py

Python wrapper for the Politifact REST API
Python
13
star
16

reasoning-about-entailment-tensorflow

🏫 Tensorflow implementation of "Reasoning About Entailment with Neural Attention"
Python
10
star
17

uni

A mono-repo containing code I've written to educate myself. est. 2021. (public)
C
9
star
18

sudkamp-langs-machines-java

[WIP] Algorithms from Sudkamps' Languages and Machines - implemented in Java
Java
7
star
19

sudkamp-langs-machines-python

Algorithms from Sudkamps' Languages and Machines - implemented in Python 3
Python
6
star
20

dropbox-style-python-repo

πŸŒΏπŸ’š Learning how the github.com/dropbox/dbx_build_tools work for Python monorepos.
Python
6
star
21

library-management-slack-bot

πŸ“š Slack bot that helps facilitate tracking of books and borrowers in your office/home library
TypeScript
5
star
22

slack-up

Makes daily Slack stand-up message easier to do by automating info-gathering from GCalendar + Github
Rust
3
star
23

fast-links

Painlessly embed references into your online comments and posts. #FB-Hack2017 πŸ₯ˆ
JavaScript
3
star
24

slackify-markdown

#️⃣Convert Markdown into Slack's bastardized Markdown-like formatting
Rust
2
star
25

modal-fun

Modal.com apps doing various interesting things
Python
2
star
26

ghportfolio

A minimal CLI in Golang for catching up on the activity and health of your public Github projects
Go
2
star
27

source-rank

#️⃣FBHack Melbourne 2018 - An open approach to news and media content quality evaluation
JavaScript
2
star
28

dotfiles

Created to personalize Github Codespaces, automagically
1
star
29

homebrew-formulae

β˜•οΈ Personal Homebrew tap for relevant projects under my Github profile
Ruby
1
star