ic-labs / django-icekit

GLAMkit is a next-generation Python CMS by the Interaction Consortium, designed especially for the cultural sector.
http://glamkit.com
MIT License
47 stars 11 forks source link

Speed up Docker build for Travis test with caching? #241

Open jmurty opened 7 years ago

jmurty commented 7 years ago

Test runs for django-icekit take around 15 minutes each. I would dearly love to speed these up, and finding a way to cache docker builds (layers/images/whatever) might be a way to do it, since a full Docker pull and build takes around 4 minutes per recent Travis runs.

I haven't been able to find a definitive description of how to do this exactly, but here are some promising links (from most to least likely to be helpful):

jmurty commented 7 years ago

Hi @mrmachine can you sanity-check this change? It does seem to use cached Docker build layers as intended, compare uncached run https://travis-ci.org/ic-labs/django-icekit/builds/234711127 with cached https://travis-ci.org/ic-labs/django-icekit/builds/234718888

We would probably not want to cache Docker builds for important branches, like "master" and probably "staging", to avoid ending up with stale dependencies. But for all other branches I think this could be an improvement.

jmurty commented 7 years ago

Anecdotally caching most of the Docker image build seems to save about 3 minutes for each Travis test run. Less than I'd hoped, but it's a start.

mrmachine commented 7 years ago

We could switch to codefresh instead of Travis CI. I've used it for SFMOMA and some other public IC repos. It seems to start builds faster, and often (but not always, currently) caches docker build. It also allows us to skip tests or launch preview environments (that persist for up to 8 hours) with commit message keywords.

Here's SFMOMA's codefresh.yml file https://github.com/sfmoma/sfmoma/blob/develop/codefresh.yml which includes the conditional tests/preview-environment, and here's another codefresh.yml that pushes the branch, full commit, and latest tag (for `master branch only) https://github.com/ixc/letsencrypt-docker/blob/master/codefresh.yml