Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 5 commits into from
Jul 5, 2020
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .ci/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ if [[ $TASK == "if-else" ]]; then
exit 0
fi

if [[ $TASK == "r-package" ]]; then
if [[ $TASK == "r-package" ]] || [[ $TASK == "check-r-docs" ]]; then
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a suggestion to not overcomplicate this if statement in the future. Name task with something like r-package-check-docs and then just check that it starts with r-package.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh good idea! Just pushed 0b17315 to implement this

bash ${BUILD_DIRECTORY}/.ci/test_r_package.sh || exit -1
exit 0
fi
Expand Down
20 changes: 19 additions & 1 deletion .ci/test_r_package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made a mistake while developing...code with Rscript --vanilla -e failed to load a library because --vanilla ignores the .Renviron

I think we should remove this and use normal environment variables instead, to make the code a little more explicit and easier to reason about.

export PATH="$R_LIB_PATH/R/bin:$PATH"

# Get details needed for installing R components
Expand Down Expand Up @@ -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 == "check-r-docs" ]]; then
Rscript build_r.R
jameslamb marked this conversation as resolved.
Show resolved Hide resolved
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

Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ jobs:
task: r-package
compiler: clang
r_version: 4.0
- os: ubuntu-latest
task: check-r-docs
compiler: gcc
r_version: 4.0
- os: macOS-latest
task: r-package
compiler: gcc
Expand Down