Unverified Commit d8bc0fc7 authored by James Lamb's avatar James Lamb Committed by GitHub
Browse files

[ci][docs][R-package] catch builds that have not updated docs (#3205)



* [ci] [R-package] catch builds that have not updated docs

* drop reliance on .Renviron

* remove docs changes

* Update .ci/test_r_package.sh
Co-authored-by: default avatarNikita Titov <nekit94-08@mail.ru>

* make all R tasks start with r-package
Co-authored-by: default avatarNikita Titov <nekit94-08@mail.ru>
parent bf01f53a
......@@ -69,7 +69,7 @@ if [[ $TASK == "if-else" ]]; then
exit 0
fi
if [[ $TASK == "r-package" ]]; then
if [[ "${TASK:0:9}" == "r-package" ]]; then
bash ${BUILD_DIRECTORY}/.ci/test_r_package.sh || exit -1
exit 0
fi
......
......@@ -4,7 +4,7 @@
CRAN_MIRROR="https://cloud.r-project.org/"
R_LIB_PATH=~/Rlib
mkdir -p $R_LIB_PATH
echo "R_LIBS=$R_LIB_PATH" > ${HOME}/.Renviron
export R_LIBS=$R_LIB_PATH
export PATH="$R_LIB_PATH/R/bin:$PATH"
# Get details needed for installing R components
......@@ -90,6 +90,24 @@ if [[ $OS_NAME == "macos" ]]; then
fi
Rscript --vanilla -e "install.packages(${packages}, repos = '${CRAN_MIRROR}', lib = '${R_LIB_PATH}', dependencies = c('Depends', 'Imports', 'LinkingTo'))" || exit -1
if [[ $TASK == "r-package-check-docs" ]]; then
Rscript build_r.R || exit -1
Rscript --vanilla -e "install.packages('roxygen2', repos = '${CRAN_MIRROR}', lib = '${R_LIB_PATH}', dependencies = c('Depends', 'Imports', 'LinkingTo'))" || exit -1
Rscript --vanilla -e "roxygen2::roxygenize('R-package/', load = 'installed')" || exit -1
num_doc_files_changed=$(
git diff --name-only | grep -E "\.Rd|NAMESPACE" | wc -l
)
if [[ ${num_doc_files_changed} -gt 0 ]]; then
echo "Some R documentation files have changed. Please re-generate them and commit those changes."
echo ""
echo " Rscript build_r.R"
echo " Rscript -e \"roxygen2::roxygenize('R-package/', load = 'installed')\""
echo ""
exit -1
fi
exit 0
fi
cd ${BUILD_DIRECTORY}
Rscript build_r.R --skip-install || exit -1
......
......@@ -32,6 +32,10 @@ jobs:
task: r-package
compiler: clang
r_version: 4.0
- os: ubuntu-latest
task: r-package-check-docs
compiler: gcc
r_version: 4.0
- os: macOS-latest
task: r-package
compiler: gcc
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment