Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Dockerize R package build Signed-off-by: harupy <hkawamura0130@gmail.com> * fix path Signed-off-by: harupy <hkawamura0130@gmail.com> * specify path Signed-off-by: harupy <17039389+harupy@users.noreply.github.com> * fix argument name Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>
- Loading branch information
Showing
8 changed files
with
61 additions
and
17 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
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,16 @@ | ||
source(".utils.R") | ||
|
||
# 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 dependencies required for the submission check. | ||
devtools::install_deps(".", dependencies = TRUE) | ||
# Bundle up the package into a .tar.gz file. This file will be submitted to CRAN. | ||
package_path <- devtools::build(".", path = ".") | ||
# Run the submission check against the built package. | ||
devtools::check_built( | ||
path = normalizePath(package_path), | ||
remote = should_enable_cran_incoming_checks(), | ||
error_on = "note", | ||
args = c("--no-tests", "--as-cran"), | ||
) |
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 |
---|---|---|
|
@@ -19,3 +19,4 @@ Reference_Manual_mlflow.md | |
*.Rcheck/ | ||
depends.Rds | ||
R-version | ||
*.tar.gz |
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,24 +1,15 @@ | ||
source("../.utils.R") | ||
|
||
parent_dir <- dir("../", full.names = TRUE) | ||
package <- parent_dir[grepl("mlflow_", parent_dir)] | ||
|
||
library(reticulate) | ||
use_condaenv(mlflow:::mlflow_conda_env_name()) | ||
|
||
# Disable CRAN incoming feasibility check within a week after the latest release because it fails. | ||
# | ||
# Relevant code: | ||
# https://github.com/wch/r-source/blob/4561aea946a75425ddcc8869cdb129ed5e27af97/src/library/tools/R/QC.R#L8005-L8008 | ||
install.packages(c("xml2", "rvest")) | ||
library(xml2) | ||
library(rvest) | ||
|
||
url <- "https://cran.r-project.org/web/packages/mlflow/index.html" | ||
html <- read_html(url) | ||
xpath <- '//td[text()="Published:"]/following-sibling::td[1]/text()' | ||
published_date <- as.Date(html_text(html_nodes(html, xpath=xpath))) | ||
today <- Sys.Date() | ||
days_since_last_release <- difftime(today, published_date, units="days") | ||
remote <- as.numeric(days_since_last_release) > 7 | ||
|
||
devtools::check_built(path = package, remote = remote, error_on = "note", args = "--no-tests") | ||
devtools::check_built( | ||
path = package, | ||
remote = should_enable_cran_incoming_checks(), | ||
error_on = "note", | ||
args = "--no-tests" | ||
) | ||
source("testthat.R") |
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,18 @@ | ||
|
||
# This script defines utility functions only used during development. | ||
|
||
should_enable_cran_incoming_checks <- function() { | ||
# The CRAN incoming feasibility check performs a package recency check (this is undocumented) | ||
# that examines the number of days since the last release and raises a NOTE if it's < 7. | ||
# Relevant code: | ||
# https://github.com/wch/r-source/blob/4561aea946a75425ddcc8869cdb129ed5e27af97/src/library/tools/R/QC.R#L8005-L8008 | ||
# This check needs to be disabled for a week after releasing a new version. | ||
desc_url <- url("https://cran.r-project.org/web/packages/mlflow/DESCRIPTION") | ||
field <- "Date/Publication" | ||
desc <- read.dcf(desc_url, fields = c(field)) | ||
close(desc_url) | ||
publication_date <- as.Date(unname(desc[1, field])) | ||
today <- Sys.Date() | ||
days_since_last_release <- as.numeric(difftime(today, publication_date, units="days")) | ||
days_since_last_release > 7 | ||
} |
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 @@ | ||
FROM rocker/r-ver:4.1.2 | ||
|
||
RUN apt-get update -y | ||
RUN apt-get install pandoc -y | ||
RUN Rscript -e 'install.packages("devtools", dependencies = 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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/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)' |