Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Build R documentation using Docker (#5188)
* rename dockerfile Signed-off-by: harupy <17039389+harupy@users.noreply.github.com> * build R doc using docker Signed-off-by: harupy <17039389+harupy@users.noreply.github.com> * update .Rbuildignore Signed-off-by: harupy <17039389+harupy@users.noreply.github.com> * fix volume target Signed-off-by: harupy <17039389+harupy@users.noreply.github.com> * use working_directory Signed-off-by: harupy <17039389+harupy@users.noreply.github.com> * add comment
- Loading branch information
Showing
10 changed files
with
113 additions
and
141 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,16 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -ex | ||
|
||
pushd ../mlflow/R/mlflow | ||
|
||
# `gert` requires `libgit2`: | ||
# https://github.com/r-lib/gert#installation | ||
sudo add-apt-repository ppa:cran/libgit2 | ||
sudo apt-get update | ||
sudo apt-get install --yes libssh2-1-dev libgit2-dev | ||
image_name="mlflow-r-dev" | ||
docker build -f Dockerfile.dev -t $image_name . | ||
docker run \ | ||
--rm \ | ||
-v $(pwd):/mlflow/mlflow/R/mlflow \ | ||
-v $(pwd)/../../../docs/source:/mlflow/docs/source \ | ||
$image_name \ | ||
Rscript -e 'source(".build-doc.R", echo = TRUE)' | ||
|
||
Rscript -e 'install.packages("devtools", repos = "https://cloud.r-project.org")' | ||
Rscript -e 'devtools::install_dev_deps(dependencies = TRUE)' | ||
# Install Rd2md from source as a temporary fix for the rendering of code examples, until | ||
# a release is published including the fixes in https://github.com/quantsch/Rd2md/issues/1 | ||
# Note that this commit is equivalent to commit 6b48255 of Rd2md master | ||
# (https://github.com/quantsch/Rd2md/tree/6b4825579a2df8a22898316d93729384f92a756b) | ||
# with a single extra commit to fix rendering of \link tags between methods in R documentation. | ||
Rscript -e 'devtools::install_git("https://github.com/smurching/Rd2md", branch = "mlflow-patches")' | ||
Rscript -e 'install.packages("rmarkdown", repos = "https://cloud.r-project.org")' | ||
rm -rf man | ||
Rscript -e "roxygen2::roxygenise()" | ||
# remove mlflow-package doc temporarily because no rst doc should be generated for it. | ||
rm man/mlflow-package.Rd | ||
Rscript document.R | ||
# roxygenize again to make sure the previously removed mlflow-packge doc is available as R helpfile | ||
Rscript -e "roxygen2::roxygenise()" | ||
popd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Install Rd2md from source as a temporary fix for the rendering of code examples, until | ||
# a release is published including the fixes in https://github.com/quantsch/Rd2md/issues/1 | ||
# Note that this commit is equivalent to commit 6b48255 of Rd2md master | ||
# (https://github.com/quantsch/Rd2md/tree/6b4825579a2df8a22898316d93729384f92a756b) | ||
# with a single extra commit to fix rendering of \link tags between methods in R documentation. | ||
devtools::install_git("https://github.com/smurching/Rd2md", ref = "mlflow-patches") | ||
install.packages("rmarkdown", repos = "https://cloud.r-project.org") | ||
unlink("man", recursive = TRUE) | ||
roxygen2::roxygenise() | ||
# remove mlflow-package doc temporarily because no rst doc should be generated for it. | ||
file.remove("man/mlflow-package.Rd") | ||
source("document.R", echo = TRUE) | ||
# roxygenize again to make sure the previously removed mlflow-packge doc is available as R helpfile | ||
roxygen2::roxygenise() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Increase the timeout length for `utils::download.file` because the default value (60 seconds) | ||
# could be too short to download large packages such as h2o. | ||
options(timeout=300) | ||
install.packages("devtools", dependencies = TRUE) | ||
devtools::install_dev_deps(dependencies = TRUE) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
FROM rocker/r-ver:4.1.2 | ||
|
||
WORKDIR /mlflow/mlflow/R/mlflow | ||
RUN apt-get update -y | ||
RUN apt-get install git wget libxml2-dev libgit2-dev -y | ||
# pandoc installed by `apt-get` is too old and contains a bug. | ||
RUN TEMP_DEB=$(mktemp) && \ | ||
wget --directory-prefix $TEMP_DEB https://github.com/jgm/pandoc/releases/download/2.16.2/pandoc-2.16.2-1-amd64.deb && \ | ||
dpkg --install $(find $TEMP_DEB -name '*.deb') && \ | ||
rm -rf $TEMP_DEB | ||
COPY DESCRIPTION . | ||
COPY .install-deps.R . | ||
RUN Rscript -e 'source(".install-deps.R", echo = TRUE)' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
#!/usr/bin/env bash | ||
set -ex | ||
|
||
docker build -f Dockerfile.build -t r-build-package . | ||
docker run --rm --workdir /app -v $(pwd):/app r-build-package Rscript -e 'source(".build-package.R", echo = TRUE)' | ||
image_name="mlflow-r-dev" | ||
docker build -f Dockerfile.dev -t $image_name . | ||
docker run --rm -v $(pwd):/mlflow/mlflow/R/mlflow $image_name Rscript -e 'source(".build-package.R", echo = TRUE)' |