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] Add debian-clang-devel CI job for the R package #4164

Merged
merged 15 commits into from
Apr 12, 2021
Merged
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
13 changes: 0 additions & 13 deletions .ci/test_r_package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,6 @@ mkdir -p $R_LIB_PATH
export R_LIBS=$R_LIB_PATH
export PATH="$R_LIB_PATH/R/bin:$PATH"

# hack to get around this:
# https://stat.ethz.ch/pipermail/r-package-devel/2020q3/005930.html
export _R_CHECK_SYSTEM_CLOCK_=0

# ignore R CMD CHECK NOTE checking how long it has
# been since the last submission
export _R_CHECK_CRAN_INCOMING_REMOTE_=0

# CRAN ignores the "installed size is too large" NOTE,
# so our CI can too. Setting to a large value here just
# to catch extreme problems
export _R_CHECK_PKG_SIZES_THRESHOLD_=100

# don't fail builds for long-running examples unless they're very long.
# See https://github.com/microsoft/LightGBM/issues/4049#issuecomment-793412254.
if [[ $R_BUILD_TYPE != "cran" ]]; then
Expand Down
13 changes: 0 additions & 13 deletions .ci/test_r_package_windows.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -79,19 +79,6 @@ $env:CRAN_MIRROR = "https://cloud.r-project.org/"
$env:CTAN_MIRROR = "https://ctan.math.illinois.edu/systems/win32/miktex"
$env:CTAN_PACKAGE_ARCHIVE = "$env:CTAN_MIRROR/tm/packages/"

# hack to get around this:
# https://stat.ethz.ch/pipermail/r-package-devel/2020q3/005930.html
$env:_R_CHECK_SYSTEM_CLOCK_ = 0

# ignore R CMD CHECK NOTE checking how long it has
# been since the last submission
$env:_R_CHECK_CRAN_INCOMING_REMOTE_ = 0

# CRAN ignores the "installed size is too large" NOTE,
# so our CI can too. Setting to a large value here just
# to catch extreme problems
$env:_R_CHECK_PKG_SIZES_THRESHOLD_ = 100

# don't fail builds for long-running examples unless they're very long.
# See https://github.com/microsoft/LightGBM/issues/4049#issuecomment-793412254.
if ($env:R_BUILD_TYPE -ne "cran") {
Expand Down
41 changes: 40 additions & 1 deletion .github/workflows/r_package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,18 @@ on:
branches:
- master

env:
# hack to get around this:
# https://stat.ethz.ch/pipermail/r-package-devel/2020q3/005930.html
_R_CHECK_SYSTEM_CLOCK_: 0
# ignore R CMD CHECK NOTE checking how long it has
# been since the last submission
_R_CHECK_CRAN_INCOMING_REMOTE_: 0
# CRAN ignores the "installed size is too large" NOTE,
# so our CI can too. Setting to a large value here just
# to catch extreme problems
_R_CHECK_PKG_SIZES_THRESHOLD_: 100
StrikerRUS marked this conversation as resolved.
Show resolved Hide resolved

jobs:
test:
name: ${{ matrix.task }} (${{ matrix.os }}, ${{ matrix.compiler }}, R ${{ matrix.r_version }}, ${{ matrix.build_type }})
Expand Down Expand Up @@ -181,10 +193,37 @@ jobs:
Rscriptdevel testthat.R 2>&1 > ubsan-tests.log
cat ubsan-tests.log
exit $(cat ubsan-tests.log | grep --count "runtime error")
test-r-debian-clang:
name: r-package (debian, R-devel, clang)
timeout-minutes: 60
runs-on: ubuntu-latest
container: rhub/debian-clang-devel
steps:
- name: Install Git before checkout
shell: bash
run: |
apt-get update
apt-get install --no-install-recommends -y git
- name: Checkout repository
uses: actions/checkout@v2.3.4
with:
fetch-depth: 5
submodules: true
- name: Install packages and run tests
shell: bash
run: |
export PATH=/opt/R-devel/bin/:${PATH}
Rscript -e "install.packages(c('R6', 'data.table', 'jsonlite', 'testthat'), repos = 'https://cran.r-project.org')"
sh build-cran-package.sh
R CMD check --as-cran --run-donttest lightgbm_*.tar.gz || exit -1
StrikerRUS marked this conversation as resolved.
Show resolved Hide resolved
if grep -q -E "NOTE|WARNING|ERROR" lightgbm.Rcheck/00check.log; then
echo "NOTEs, WARNINGs, or ERRORs have been found by R CMD check"
exit -1
fi
all-successful:
# https://git.luolix.topmunity/t/is-it-possible-to-require-all-github-actions-tasks-to-pass-without-enumerating-them/117957/4?u=graingert
runs-on: ubuntu-latest
needs: [test, test-r-sanitizers]
needs: [test, test-r-sanitizers, test-r-debian-clang]
steps:
- name: Note that all tests succeeded
run: echo "🎉"
18 changes: 17 additions & 1 deletion R-package/cran-comments.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,27 @@
# CRAN Submission History

## v3.2.0 - Submission 1 - (TBD)
## v3.2.1 - Submission 1 - (TBD)

### CRAN response

### Maintainer Notes

## v3.2.0 - Submission 1 - (March 22, 2021)

### CRAN response

Package is failing checks in the `r-devel-linux-x86_64-debian-clang` environment (described [here](https://cran.r-project.org/web/checks/check_flavors.html#r-devel-linux-x86_64-debian-clang)). Specifically, one unit test on the use of non-ASCII feature names in `Booster$dump_model()` fails.

> Apparently your package fails its checks in a strict Latin-1* locale,
e.g. under Linux using LANG=en_US.iso88591 (see the debian-clang
results).

> Please correct before 2021-04-21 to safely retain your package on CRAN.

### Maintainer Notes

Submitted a version 3.2.1 to correct the errors noted.

## v3.1.1 - Submission 1 - (December 7, 2020)

### CRAN response
Expand Down
7 changes: 6 additions & 1 deletion R-package/tests/testthat/test_basic.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ context("lightgbm()")

ON_WINDOWS <- .Platform$OS.type == "windows"

UTF8_LOCALE <- all(grepl(
pattern = "UTF-8$"
, x = Sys.getlocale(category = "LC_CTYPE")
))

data(agaricus.train, package = "lightgbm")
data(agaricus.test, package = "lightgbm")
train <- agaricus.train
Expand Down Expand Up @@ -1229,7 +1234,7 @@ test_that("lgb.train() supports non-ASCII feature names", {
# UTF-8 strings are not well-supported on Windows
# * https://developer.r-project.org/Blog/public/2020/05/02/utf-8-support-on-windows/
# * https://developer.r-project.org/Blog/public/2020/07/30/windows/utf-8-build-of-r-and-cran-packages/index.html
if (!ON_WINDOWS) {
if (UTF8_LOCALE && !ON_WINDOWS) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

👍

expect_identical(
dumped_model[["feature_names"]]
, feature_names
Expand Down