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] consolidate R package installs into a CI script #6808

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

jameslamb
Copy link
Collaborator

@jameslamb jameslamb commented Jan 31, 2025

Follow-up to #6804 (comment)

Consolidates the various install.packages() calls across the project's CI into a single .ci/ script.

Notes for Reviewers

I'm intentionally not proposing updating user-facing docs like this:

# install dependencies
RDscript${R_CUSTOMIZATION} \
-e "install.packages(c('R6', 'data.table', 'jsonlite', 'knitr', 'markdown', 'Matrix', 'RhpcBLASctl', 'testthat'), repos = 'https://cran.r-project.org', Ncpus = parallel::detectCores())"

I'd like to keep this script limited to LightGBM's CI, and changeable at any time. I don't want to make it a part of the public interface of the project or encourage anyone else to use it.

@@ -65,7 +65,7 @@ jobs:
shell: bash
# yamllint disable rule:line-length
run: |
Rscript -e "install.packages(c('R6', 'data.table', 'jsonlite', 'knitr', 'markdown', 'Matrix', 'RhpcBLASctl', 'roxygen2', 'testthat'), repos = 'https://cran.rstudio.com', Ncpus = parallel::detectCores())"
Rscript ./.ci/install-r-deps.R --build --roxygen
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Notice... {testthat} and all its dependencies were being installed unnecessarily here! So this change should also make the static analysis job a little faster 🎉

Comment on lines 180 to 181
# $command_args_patch = "commandArgs <- function(...){c('--build', '--test')};"
# Invoke-R-Code-Redirect-Stderr "$command_args_patch source('install-r-deps.R')" ; Assert-Output $?
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Suggested change
# $command_args_patch = "commandArgs <- function(...){c('--build', '--test')};"
# Invoke-R-Code-Redirect-Stderr "$command_args_patch source('install-r-deps.R')" ; Assert-Output $?

This seems to work ok without the more complicated Invoke-R-Code-Redirect-Stderr pattern 😁

@jameslamb jameslamb changed the title WIP: [ci] consolidate R package installs into a CI script [ci] consolidate R package installs into a CI script Feb 3, 2025
@jameslamb jameslamb marked this pull request as ready for review February 3, 2025 02:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant