Skip to content

Commit

Permalink
[ci] [R-package] remove code for 'rchk' checks (#6545)
Browse files Browse the repository at this point in the history
* [ci] [R-package] re-enable 'rchk' checks

* comment out most CI

* it would be helpful to actually enable rchk

* remove all Rf_unprotect() calls to try to trigger failure

* try removing some Rf_protect() calls

* revert CI changes

* just remove rchk

* revert whitespace changes
  • Loading branch information
jameslamb authored Oct 29, 2024
1 parent 9b351e6 commit 4a60a53
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 30 deletions.
2 changes: 1 addition & 1 deletion .ci/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ else # Linux
fi
fi

if [[ "${TASK}" != "r-package" ]] && [[ "${TASK}" != "r-rchk" ]]; then
if [[ "${TASK}" != "r-package" ]]; then
if [[ $SETUP_CONDA != "false" ]]; then
curl \
-sL \
Expand Down
29 changes: 1 addition & 28 deletions .ci/test-r-package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,7 @@ Rscript --vanilla -e "install.packages('https://cran.r-project.org/src/contrib/A

# Manually install Depends and Imports libraries + 'knitr', 'markdown', 'RhpcBLASctl', 'testthat'
# to avoid a CI-time dependency on devtools (for devtools::install_deps())
# NOTE: testthat is not required when running rchk
if [[ "${TASK}" == "r-rchk" ]]; then
packages="c('data.table', 'jsonlite', 'knitr', 'markdown', 'R6', 'RhpcBLASctl')"
else
packages="c('data.table', 'jsonlite', 'knitr', 'markdown', 'R6', 'RhpcBLASctl', 'testthat')"
fi
packages="c('data.table', 'jsonlite', 'knitr', 'markdown', 'R6', 'RhpcBLASctl', 'testthat')"
compile_from_source="both"
if [[ $OS_NAME == "macos" ]]; then
packages+=", type = 'binary'"
Expand Down Expand Up @@ -166,28 +161,6 @@ elif [[ $R_BUILD_TYPE == "cran" ]]; then

./build-cran-package.sh || exit 1

if [[ "${TASK}" == "r-rchk" ]]; then
echo "Checking R-package with rchk"
mkdir -p packages
cp "${PKG_TARBALL}" packages
RCHK_LOG_FILE="rchk-logs.txt"
docker run \
-v "$(pwd)/packages:/rchk/packages" \
kalibera/rchk:latest \
"/rchk/packages/${PKG_TARBALL}" \
> "${RCHK_LOG_FILE}" 2>&1 \
|| (cat ${RCHK_LOG_FILE} && exit 1)
cat ${RCHK_LOG_FILE}

# the exceptions below are from R itself and not LightGBM:
# https://github.com/kalibera/rchk/issues/22#issuecomment-656036156
exit "$(
grep "${RCHK_LOG_FILE}" -v "in function strptime_internal" \
| grep -v "in function RunGenCollect" \
| grep --count -E '\[PB\]|ERROR'
)"
fi

# Test CRAN source .tar.gz in a directory that is not this repo or below it.
# When people install.packages('lightgbm'), they won't have the LightGBM
# git repo around. This is to protect against the use of relative paths
Expand Down
2 changes: 1 addition & 1 deletion .ci/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ else
export MACOSX_DEPLOYMENT_TARGET=12.0
fi

if [[ "${TASK}" == "r-package" ]] || [[ "${TASK}" == "r-rchk" ]]; then
if [[ "${TASK}" == "r-package" ]]; then
bash "${BUILD_DIRECTORY}/.ci/test-r-package.sh" || exit 1
exit 0
fi
Expand Down

0 comments on commit 4a60a53

Please sign in to comment.