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 1 commit
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
18 changes: 18 additions & 0 deletions .ci/test_r_package.sh
Original file line number Diff line number Diff line change
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
2 changes: 1 addition & 1 deletion R-package/R/lgb.importance.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#' @name lgb.importance
#' @title Compute feature importance in a model
#' @title Compute feature importance in a model (testing)
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 added this as an example of the type of change that should trigger a failure. I'll remove it once we see if the new task works as expected.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

#' @description Creates a \code{data.table} of feature importances in a model.
#' @param model object of class \code{lgb.Booster}.
#' @param percentage whether to show importance in relative percentage.
Expand Down