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] add a CI job to run R reverse dependency checks #6734

Draft
wants to merge 34 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
855632f
add a CI job to run reverse dependency checks
jameslamb Nov 28, 2024
df15521
Merge branch 'master' into r/revdepcheck
jameslamb Dec 2, 2024
cb443cf
update .gitignore
jameslamb Dec 2, 2024
07592ab
remove CI
jameslamb Dec 2, 2024
677f7ea
remove even more CI
jameslamb Dec 2, 2024
79d9472
actions name
jameslamb Dec 2, 2024
58fe697
run on pushes
jameslamb Dec 2, 2024
f37157a
even more event triggers
jameslamb Dec 2, 2024
db4d44f
remove unnecessary workflows
jameslamb Dec 2, 2024
974a206
install build dependencies
jameslamb Dec 2, 2024
d031220
install more dependencies
jameslamb Dec 2, 2024
02b83e5
avoid errors in vignettes, install packages from source
jameslamb Dec 2, 2024
61090eb
use r-release so we get binary packages
jameslamb Dec 2, 2024
321ce3c
trying pre-installing deps
jameslamb Dec 2, 2024
a43cb3a
try pre-installing to speed this up
jameslamb Dec 2, 2024
fc5d295
try doing more binary installs upfront
jameslamb Dec 2, 2024
550cd39
more parallelism, install more stuff
jameslamb Dec 3, 2024
319cc9b
update PATH
jameslamb Dec 3, 2024
5d2d651
more parallelization in crandep install, try to make it pass
jameslamb Dec 3, 2024
2529a3d
set _R_CHECK_LIMIT_CORES_
jameslamb Dec 3, 2024
c1e1515
trying stuff
jameslamb Dec 8, 2024
65896f6
more cleanup
jameslamb Dec 9, 2024
791bd3a
more changes, better docs
jameslamb Dec 9, 2024
679f1fa
Merge branch 'master' into r/revdepcheck
jameslamb Dec 9, 2024
a898f02
fix argument-passing
jameslamb Dec 9, 2024
7e46453
pre-install crandep
jameslamb Dec 9, 2024
98a5f10
try 2 checks at a time
jameslamb Dec 10, 2024
83a145f
try one at a time to see timings
jameslamb Dec 10, 2024
ddd1a02
do not fail on failures
jameslamb Dec 10, 2024
4fd89e2
skip qeML vignettes
jameslamb Dec 10, 2024
56eecc2
one more try skipping vignettes
jameslamb Dec 10, 2024
912de94
try fully skipping qeML
jameslamb Dec 11, 2024
8e68d97
keep packages installed, some of them depend on each other
jameslamb Dec 11, 2024
a70ce5e
skip qeML too
jameslamb Dec 12, 2024
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
42 changes: 0 additions & 42 deletions .appveyor.yml

This file was deleted.

75 changes: 75 additions & 0 deletions .ci/download-r-revdeps.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
loadNamespace("crandep")

PKG_DIR <- commandArgs(trailing = TRUE)[[1L]]

.log <- function(msg) {
cat(sprintf("[download-revdeps] %s\n", msg))
}

# get all of lightgbm's reverse dependencies
depDF <- crandep::get_dep(
name = "lightgbm"
, type = "all"
, reverse = TRUE
)
reverse_deps <- depDF[["to"]]
.log(sprintf("found %i reverse deps", length(reverse_deps)))

# skip some dependencies with known issues:
#
# * 'misspi' (https://github.com/microsoft/LightGBM/issues/6741)
# * 'qeML' (checks take 45+ minutes to run)
deps_to_skip <- c(
"misspi"
, "qeML"
)
.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]

.log(sprintf("checking the following packages: %s", toString(reverse_deps)))

# get the superset of all their dependencies
# (all of the packages needed to run 'R CMD check' on lightgbm's reverse deps)
their_deps <- unlist(
unname(
sapply(
X = reverse_deps
, FUN = function(pkg) {
return(
crandep::get_dep(
name = pkg
, type = "all"
, reverse = FALSE
)[["to"]]
)
}
)
)
)

all_deps <- sort(unique(c(their_deps, reverse_deps)))

# 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)))

.log("installing all packages required to check reverse dependencies")

# install only the strong dependencies of all those packages
install.packages( # nolint: undesirable_function
pkgs = all_deps
, repos = "https://cran.r-project.org"
, dependencies = c("Depends", "Imports", "LinkingTo")
, type = "both"
, Ncpus = parallel::detectCores()
)

# get source tarballs, to be checked with 'R CMD check'
print(sprintf("--- downloading reverse dependencies to check (%i)", length(reverse_deps)))
download.packages(
pkgs = reverse_deps
, destdir = PKG_DIR
, repos = "https://cran.r-project.org"
, type = "source"
)
30 changes: 30 additions & 0 deletions .ci/run-r-revdepchecks.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
options(repos = "https://cran.r-project.org")

check_dir <- commandArgs(trailing = TRUE)[[1L]]

tools::check_packages_in_dir(
dir = check_dir
, check_args = c("--no-manual", "--run-dontrun", "--run-donttest")
, clean = TRUE
, all = TRUE
# only check one package at a time, to avoid oversubscribing CPUs
, Ncpus = 2L
# only test the libraries found in `check_dir`
, reverse = FALSE
)

all_checks_passed <- tools::summarize_check_packages_in_dir_results(
dir = check_dir
, all = TRUE
)

if (!isTRUE(all_checks_passed)) {
invisible(
tools::summarize_check_packages_in_dir_results(
dir = check_dir
, all = TRUE
, full = TRUE
)
)
stop("Some checks failed! See results above.")
}
40 changes: 40 additions & 0 deletions .ci/run-revdep-checks.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/bin/bash
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,
# 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.
#
# ref: https://github.com/wch/r-source/blob/594b842678e932088b16ec0cd3c39714a141eed9/src/library/tools/R/checktools.R#L295
#
# {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
R CMD INSTALL --with-keep.source ./lightgbm_*.tar.gz

# run 'R CMD check' on lightgbm's reverse dependencies
Rscript ./.ci/run-r-revdepchecks.R "${CHECKS_OUTPUT_DIR}"

# R CMD check --no-manual --run-dontrun --run-donttest ${CHECKS_OUTPUT_DIR}/EIX_*.tar.gz || true
# R CMD check --no-manual --run-dontrun --run-donttest ${CHECKS_OUTPUT_DIR}/SHAPforxgboost_*.tar.gz || true
# R CMD check --no-manual --run-dontrun --run-donttest ${CHECKS_OUTPUT_DIR}/cbl_*.tar.gz || true
# R CMD check --no-manual --run-dontrun --run-donttest ${CHECKS_OUTPUT_DIR}/bonsai_*.tar.gz || true
# R CMD check --no-manual --run-dontrun --run-donttest ${CHECKS_OUTPUT_DIR}/fastshap_*.tar.gz || true
# R CMD check --no-manual --run-dontrun --run-donttest ${CHECKS_OUTPUT_DIR}/fastml_*.tar.gz || true
# R CMD check --no-manual --run-dontrun --run-donttest ${CHECKS_OUTPUT_DIR}/fastshap_*.tar.gz || true
# R CMD check --no-manual --run-dontrun --run-donttest ${CHECKS_OUTPUT_DIR}/predhy.GUI_*.tar.gz || true
# qeML vignettes take a very very long time to run
#R CMD check --no-manual --run-dontrun --run-donttest --ignore-vignettes ${CHECKS_OUTPUT_DIR}/qeML_*.tar.gz || true
# R CMD check --no-manual --run-dontrun --run-donttest ${CHECKS_OUTPUT_DIR}/mllrns_*.tar.gz || true
# R CMD check --no-manual --run-dontrun --run-donttest ${CHECKS_OUTPUT_DIR}/predhy_*.tar.gz || true
# R CMD check --no-manual --run-dontrun --run-donttest ${CHECKS_OUTPUT_DIR}/r2pmml_*.tar.gz || true
# R CMD check --no-manual --run-dontrun --run-donttest ${CHECKS_OUTPUT_DIR}/stackgbm_*.tar.gz || true
# R CMD check --no-manual --run-dontrun --run-donttest ${CHECKS_OUTPUT_DIR}/vip_*.tar.gz || true
136 changes: 0 additions & 136 deletions .github/workflows/cuda.yml

This file was deleted.

Loading
Loading