hammerlab / t-cell-data

https://tcelldata.hammerlab.org
6 stars 1 forks source link

Set up Travis to build book and deploy to Netlify #13

Closed hammer closed 5 years ago

hammer commented 5 years ago

Yihue provides some details at https://bookdown.org/yihui/bookdown/github.html

hammer commented 5 years ago

The https://github.com/ropenscilabs/drake-manual has a build.R that copies over images that I want to steal

hammer commented 5 years ago

Can possibly benefit from https://ropenscilabs.github.io/tic/

hammer commented 5 years ago

Another example that manipulates the favicon: https://github.com/jeroenjanssens/data-science-at-the-command-line/blob/master/.travis.yml

hammer commented 5 years ago

Some twitter discussions on this topic: https://mobile.twitter.com/apreshill/status/1058096798500179968

Alison summarized her lessons at https://github.com/apreshill/stat545-reboot/issues/1#issue-376572016

hammer commented 5 years ago

Well, the Netlify part was easy: https://tcelldata.hammerlab.org.

Spent an hour or so thinking/reading about the best way to handle the Travis part today and still pretty stumped. Going to start a test-book repo to see if I can get it working.

The general idea is going to be:

  1. Install and validate availability of Docker containers, R packages, and other dependencies we need
  2. Build the book into _book
  3. Move images into _book
  4. Copy _book contents to a separate branch book_contents (or something) (can use the GitHub Pages deployment to do it)
  5. Delete _book

Serving the book should be pretty trivial: just point Netlify to the book_contents branch.

To speed up the build check out caching and using build stages to build chapters in parallel.

armish commented 5 years ago

FWIW: Travis can either throttle network access or choke on the build if the analyses become heavier and heavier. GCloud's Cloud Build would allow more flexibility here and given the frequency of updates, we should mostly be in its free tier:

https://cloud.google.com/cloud-build/docs/create-custom-build-steps

Looks like the only bottleneck is to get a Docker image/file ready.

hammer commented 5 years ago

@armish thanks for the pointer! I like that they offer parallelized builds on their free tier. I'm a little concerned that they don't seem to have much support for R builds out of the box, and their security and caching seems a bit half-baked. I'll probably try Travis w/ a small project and see if we hit any limits before trying out Google's offering.

hammer commented 5 years ago

Preparing for something horrible when I try to install Bioconductor packages with Travis: https://github.com/r-lib/devtools/issues/1254

Looking at a few DESCRIPTION files, it looks like I can just add Bioconductor packages under biocViews: instead of Imports:.

hammer commented 5 years ago

Working nicely! Package and data caches mean builds are only 6 minutes, 30 seconds, which is pretty reasonable.