Customizing Build Environments

The CircleCI environment provides the libraries, languages, and databases needed for most development work.
However, if you need to install a particular version of software—to match your production systems or to test backward compatibility, for example—or add custom code, CircleCI makes it easy to set up your environment to meet your testing needs.

Installing via circle.yml

You can use your circle.yml file to run
arbitrary commands against your build environment. You have root
access to your environment via sudo, so you should be able to
customize it to your heart’s content!

Caching

Naturally, downloading and compiling this custom software can take time, making your build longer.
To reduce the time spent installing dependencies, CircleCI will cache them between builds.
You can add arbitrary directories to this cache, allowing you to avoid the overhead of building your custom software during the build.

Avoid recompiles

To take advantage of this, you’ll need to test for the presence of an existing cached install of your software.
If the software is already present, no need to build it.
You should test that your cache is there by including a
test command in the dependencies section in your circle.yml file.