Wednesday, January 5, 2022

[SOLVED] How to cache packages which have been installed via `apt-get` in Travis CI?

Issue

So, with my .travis.yml, I'm installing some packages via apt-get which doesn't take too long to download, but a very long time to install.

Is there a way to make Travis CI remember the installed packages, so I won't have to install them from scratch for every build?


Solution

There seems to be no easy or convenient way to cache all of the packages you need to install via apt-get. According to the Caching Dependencies and Directories documentation, Travis CI currently only provides "convenience" caching for Bundler, CocoaPods, Yarn (and a few others).

However! If you can determine where apt-get installs each of the packages you need (as install locations vary from one package to the next), you can cache each of those install directories individually by following the steps in the Arbitrary directories documentation.

I hope this helps. Please let me know if you have any other questions and I'd be happy to help in any way I can. Cheers!



Answered By - Luna G.