rust-ml / book

The Rust Machine Learning Book
https://rust-ml.github.io/book/
Apache License 2.0
193 stars 20 forks source link

Add CI to build the book and host via github pages #9

Closed liufuyang closed 3 years ago

liufuyang commented 3 years ago

Closes https://github.com/rust-ml/book/issues/5

As the build is working for this branch and pages can be seen here https://rust-ml.github.io/book/2_intro.html

I think we can deploy this to master now so to have the following merges to master automatically build by CI.

2 things todo later:

  1. is about a single $ still get parsed even if it is in the code session of a page. (See the change I made in src/2_intro.md in order to make the build work)
  2. I currently used my own docker domain but as we have docker files included in the PR one can easily build and push an image to some of our official domain (if we have). Then it is very simple to switch to use a different image later when we want.

So after merging this PR, any following up changes to the book will be automatically published at https://rust-ml.github.io/book/2_intro.html

bytesnake commented 3 years ago

Closes #5

As the build is working for this branch and pages can be seen here https://rust-ml.github.io/book/2_intro.html

Awesome work :+1:

I think we can deploy this to master now so to have the following merges to master automatically build by CI.

2 things todo later:

1. is about a single `$` still get parsed even if it is in the code session of a page. (See the change I made in `src/2_intro.md` in order to make the build work)

I created the issue https://github.com/rust-ml/book/issues/10 for remembrance

2. I currently used my own docker domain but as we have docker files included in the PR one can easily build and push an image to some of our official domain (if we have). Then it is very simple to switch to use a different image later when we want.

is a docker domain something like a namespace in the docker image infrastructure? Or an actual domain which we need to offer our own docker images?

So after merging this PR, any following up changes to the book will be automatically published at https://rust-ml.github.io/book/2_intro.html

what happens when there are some changes in the mdbook-scientific plugin and the changes are published. Do we need to re-create the image or is the plugin rebuild as well

liufuyang commented 3 years ago

About "docker domain", sorry I probably used a wrong word here, it should be more like a "docker hub username", like github user name I have liufuyang and this repo has rust-ml. Perhaps you can great a rust-ml username that your organisation owns then you can build and push the image to it (somehow like the github concept) then it is more secure perhaps. Otherwise if you trust me enough you can use the image under my "repo" for a while, as I won't be touching it anyway as it works now.

liufuyang commented 3 years ago

when there are some changes in the mdbook-scientific plugin and the changes are published. Do we need to re-create the image or is the plugin rebuild as well

Yes, when that changes we need to rebuild the image. If that often gets in the way, maybe there is someway to make a github action that can build and push an image for you. I haven't looked into that before but I suppose it is can be done. It's a very common thing to push an image when some build success.

But after a second thought here, if later we add a build/test check for mdbook-scientific then we can perhaps give up using the docker solution here as each time when you build mdbook-scientific you will probably soon have a working environment to be able to build the site, then we just need to add a few more steps to build the site after build the rust code.

This however will make each page update much slower than using a docker image.

I don't know but in the future you may want to move mdbook-scientific to a standalone repo? Then it makes sense to use a docker image to just build the book. (And you do cargo test, docker build and push in that mdbook-scientific repo.)

bytesnake commented 3 years ago

I'm not 100% satisfied with the docker solution, but let's move forward and merge because I do not have so much time atm. We will use your account for the time being to pull the image and I'll investigate how github actions could be used without being slowed down by re-compiling everything. The cargo install action for github has a caching option where a cached version is downloaded and verified by a signature https://github.com/marketplace/actions/rust-cargo-install

liufuyang commented 3 years ago

I see. Not sure would it be an easy thing or not if you do not build via a docker image as the book build requires extra tooling such as latex, gnuplot, bib2xhtml and so on. Anyway, let me know if you have any questions later on the dockerfile :)