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

WIP: [ci] [R-package] re-enable 'rchk' checks #6332

Draft
wants to merge 11 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all 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
43 changes: 0 additions & 43 deletions .appveyor.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .ci/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ else # Linux
fi
fi

if [[ "${TASK}" != "r-package" ]] && [[ "${TASK}" != "r-rchk" ]]; then
if [[ "${TASK}" != "r-package" ]]; then
if [[ $SETUP_CONDA != "false" ]]; then
sh miniforge.sh -b -p $CONDA
fi
Expand Down
2 changes: 1 addition & 1 deletion .ci/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ if [[ $IN_UBUNTU_BASE_CONTAINER == "true" ]]; then
export LC_ALL="en_US.UTF-8"
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
30 changes: 1 addition & 29 deletions .ci/test_r_package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,7 @@ fi

# 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', 'Matrix', 'R6', 'RhpcBLASctl')"
else
packages="c('data.table', 'jsonlite', 'knitr', 'markdown', 'Matrix', 'R6', 'RhpcBLASctl', 'testthat')"
fi
packages="c('data.table', 'jsonlite', 'knitr', 'markdown', 'Matrix', 'R6', 'RhpcBLASctl', 'testthat')"
compile_from_source="both"
if [[ $OS_NAME == "macos" ]]; then
packages+=", type = 'binary'"
Expand Down Expand Up @@ -151,29 +146,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}" \
2>&1 > ${RCHK_LOG_FILE} \
|| (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 $(
cat ${RCHK_LOG_FILE} \
| grep -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
31 changes: 31 additions & 0 deletions .ci/test_r_package_rchk.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash

set -E -e -u -o pipefail

echo "Checking R package with rchk"
sh build-cran-package.sh --no-build-vignettes

mkdir -p ./packages
LGB_VER=$(head -1 VERSION.txt | sed "s/rc/-/g")
PKG_TARBALL="lightgbm_${LGB_VER}.tar.gz"
cp ./${PKG_TARBALL} ./packages/${PKG_TARBALL}

RCHK_LOG_FILE="rchk-logs.txt"
run_rchk() {
docker run \
--rm \
--env MAKEFLAGS="-j2" \
-v $(pwd)/packages:/rchk/packages \
kalibera/rchk:latest \
"/rchk/packages/${PKG_TARBALL}"
}
run_rchk 2>&1 | tee ${RCHK_LOG_FILE} | cat || (cat ${RCHK_LOG_FILE} && exit 1)

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

This file was deleted.

113 changes: 0 additions & 113 deletions .github/workflows/python_package.yml

This file was deleted.

Loading
Loading