Skip to content
This repository has been archived by the owner on Mar 5, 2023. It is now read-only.

Travis CI: cache dependencies #342

Closed
pyokagan opened this issue Mar 17, 2017 · 1 comment
Closed

Travis CI: cache dependencies #342

pyokagan opened this issue Mar 17, 2017 · 1 comment

Comments

@pyokagan
Copy link
Contributor

We don't seem to be caching dependencies in our Travis builds. It would probably help shorten build time if we could cache them and avoid having to download them every build.

@chao1995
Copy link
Contributor

I'd like to take this issue.

damithc pushed a commit that referenced this issue Mar 29, 2017
Gradle dependencies are not cached in Travis builds.

Consequently, the dependencies are re-downloaded in every build.

Let's teach Travis to cache Gradle dependencies using the recommended
configurations from Travis CI documentation [1].

In our experiments, when cache is not enabled, it takes 26.68 seconds
to run Gradle assemble task, which includes downloading Gradle and the
dependencies. When cache is enabled, Travis will tar up all the cached
directories and upload them to S3. So the cache is not network-local,
and the download time will be bound to network bandwidth and DNS
resolutions for S3. In the experiment, it takes 5.83 seconds to pull
down the cache from S3 and another 10.75 seconds to finish the assemble
task. At the end of the build, Travis will also check whether the cache
is updated. If it is, Travis will create a new archive and upload it to
S3. This check adds another 1.48 seconds overhead even when the cache
is not updated. So a rough estimate is that the build time will be
reduced by around 10 seconds when cache is enabled. Reasons for the
shorter build time now may be because Travis downloads the dependencies
from S3 in bulk instead of making multiple requests (one for each
dependency).

For more details on how caching works in Travis, please refer to [2].

[1] https://docs.travis-ci.com/user/languages/java/#Caching
[2] https://docs.travis-ci.com/user/caching/#How-does-caching-work
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants