Distributed Builds and Distributed CI

Nx uses computation caching and code change analysis (affected:* commands) to limit the number of things that have to be rebuilt and retested. This can drastically reduce the average CI time.

But regardless of how smart Nx is, there will be some large changes affecting the whole codebase. The only way to keep those fast as your repository keeps growing is to build and test them using multiple machines/agents.

There are several ways to distribute your CI across multiple machines.

The easiest way is to use Nx Cloud. Learn more about configuring your CI environment using Nx Cloud with Distributed Caching and Distributed Task Execution in the Nx Cloud docs.

But you can also set up distribution manually using the print-affected and run-many commands.

Please look at the following two examples:

The Azure example is very easy to port to other CI providers (e.g., CircleCI, GitLab).

Read Distributing CI: Binning and Distributed Task Execution to learn about the two approaches.