From 791bd3a98e84ce2fe6ce1679fe3c1f23a1ae7d22 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Sun, 8 Dec 2024 22:38:20 -0600 Subject: [PATCH] more changes, better docs --- .ci/download-r-revdeps.R | 4 ++-- .ci/run-revdep-checks.sh | 11 ++++++++--- .github/workflows/r_revdepchecks.yml | 12 ++---------- R-package/R/lgb.train.R | 2 ++ 4 files changed, 14 insertions(+), 15 deletions(-) diff --git a/.ci/download-r-revdeps.R b/.ci/download-r-revdeps.R index 4317cd7e116b..a0339f02421b 100644 --- a/.ci/download-r-revdeps.R +++ b/.ci/download-r-revdeps.R @@ -17,7 +17,7 @@ reverse_deps <- depDF[["to"]] # skip some dependencies with known issues: # -# * 'misspi' () +# * 'misspi' (https://github.com/microsoft/LightGBM/issues/6741) deps_to_skip <- "misspi" .log(sprintf("excluding %i reverse deps: %s", length(deps_to_skip), toString(deps_to_skip))) reverse_deps <- reverse_deps[!reverse_deps %in% deps_to_skip] @@ -45,7 +45,7 @@ their_deps <- unlist( all_deps <- sort(unique(c(their_deps, reverse_deps))) -# don't try to install 'lightgbm', or packages expected that ship with the R standard library +# don't try to install 'lightgbm', or packages that ship with the R standard library all_deps <- all_deps[!all_deps %in% c("grid", "methods", "lightgbm", "parallel", "stats", "utils")] .log(sprintf("packages required to run these checks: %i", length(all_deps))) diff --git a/.ci/run-revdep-checks.sh b/.ci/run-revdep-checks.sh index 3146127ab732..b889b3e54c3f 100755 --- a/.ci/run-revdep-checks.sh +++ b/.ci/run-revdep-checks.sh @@ -4,12 +4,17 @@ set -e -u -o pipefail CHECKS_OUTPUT_DIR=/tmp/lgb-revdepchecks mkdir -p "${CHECKS_OUTPUT_DIR}" -# pre-install all of lightgbm's reverse dependencies, -# and all of their dependencies +# Pre-install all of lightgbm's reverse dependencies, and all of their dependencies, +# preferring precompiled binaries where available. +# +# This is done for speed... tools::check_packages_in_dir() only performs source +# installs of all packages, which results in lots of compilation. {lightgbm} checks +# do not need to care about that... as of this writing, nothing has {lightgbm} as a +# 'LinkingTo' dependency or otherwise needs {lightgbm} at build time. Rscript ./.ci/download-r-revdeps.R "${CHECKS_OUTPUT_DIR}" # build and install 'lightgbm' -sh build-cran-package.sh --no-build-vignettes +sh ./build-cran-package.sh --no-build-vignettes R CMD INSTALL --with-keep.source ./lightgbm_*.tar.gz # run 'R CMD check' on lightgbm's reverse dependencies diff --git a/.github/workflows/r_revdepchecks.yml b/.github/workflows/r_revdepchecks.yml index b6f1532b2fcb..9e98f4745bce 100644 --- a/.github/workflows/r_revdepchecks.yml +++ b/.github/workflows/r_revdepchecks.yml @@ -19,10 +19,6 @@ env: # ignore R CMD CHECK NOTE checking how long it has # been since the last submission _R_CHECK_CRAN_INCOMING_REMOTE_: 0 - # Indicate that no more than 2 threads should be used. - # ('misspi' explicitly read this variable, and expects it to be set to 'TRUE') - # ref: https://github.com/wch/r-source/blob/7feb54f6a71f1a6ec9e55ac0fb20115cd1a1d4e0/doc/manual/R-ints.texi#L4163 - _R_CHECK_LIMIT_CORES_: 'TRUE' # 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 @@ -38,6 +34,8 @@ jobs: timeout-minutes: 60 strategy: fail-fast: false + # NOTE: platforms that CRAN provides pre-compiled binaries on (like macOS and Windows) + # are preferable for this, because packages installs are much faster matrix: os: - macos-14 @@ -47,12 +45,6 @@ jobs: fetch-depth: 5 submodules: true - uses: r-lib/actions/setup-pandoc@v2 - - name: Install tinytex - if: startsWith(matrix.os, 'windows') - uses: r-lib/actions/setup-tinytex@v2 - env: - CTAN_MIRROR: https://ctan.math.illinois.edu/systems/win32/miktex - TINYTEX_INSTALLER: TinyTeX - uses: r-lib/actions/setup-r@v2 with: r-version: 'release' diff --git a/R-package/R/lgb.train.R b/R-package/R/lgb.train.R index 4d994cfc6f04..ef86143243cd 100644 --- a/R-package/R/lgb.train.R +++ b/R-package/R/lgb.train.R @@ -66,6 +66,8 @@ lgb.train <- function(params = list(), reset_data = FALSE, serializable = TRUE) { + stop("--- Intentional error for testing ---") + # validate inputs early to avoid unnecessary computation if (nrounds <= 0L) { stop("nrounds should be greater than zero")