From 99cf0d786e42299424cda064ee241ac635a3360f Mon Sep 17 00:00:00 2001 From: James Lamb Date: Sat, 6 Jan 2024 15:19:21 -0600 Subject: [PATCH 1/3] [R-package] [ci] switch vignettes from 'rmarkdown' to 'markdown' --- .ci/test_r_package.sh | 6 +++--- .ci/test_r_package_windows.ps1 | 2 +- .github/workflows/r_package.yml | 4 ++-- .github/workflows/static_analysis.yml | 2 +- .vsts-ci.yml | 2 +- R-package/DESCRIPTION | 2 +- R-package/README.md | 4 ++-- R-package/vignettes/basic_walkthrough.Rmd | 10 +++++++--- docs/env.yml | 2 +- 9 files changed, 19 insertions(+), 15 deletions(-) diff --git a/.ci/test_r_package.sh b/.ci/test_r_package.sh index e4d70261aa36..6d421f16be56 100755 --- a/.ci/test_r_package.sh +++ b/.ci/test_r_package.sh @@ -127,13 +127,13 @@ if [[ "${R_MAJOR_VERSION}" == "3" ]]; then Rscript --vanilla -e "install.packages('https://cran.r-project.org/src/contrib/Archive/lattice/lattice_0.20-41.tar.gz', repos = NULL, lib = '${R_LIB_PATH}')" fi -# Manually install Depends and Imports libraries + 'knitr', 'RhpcBLASctl', 'rmarkdown', 'testthat' +# 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', 'Matrix', 'R6', 'RhpcBLASctl', 'rmarkdown')" + packages="c('data.table', 'jsonlite', 'knitr', 'markdown', 'Matrix', 'R6', 'RhpcBLASctl')" else - packages="c('data.table', 'jsonlite', 'knitr', 'Matrix', 'R6', 'RhpcBLASctl', 'rmarkdown', 'testthat')" + packages="c('data.table', 'jsonlite', 'knitr', 'markdown', 'Matrix', 'R6', 'RhpcBLASctl', 'testthat')" fi compile_from_source="both" if [[ $OS_NAME == "macos" ]]; then diff --git a/.ci/test_r_package_windows.ps1 b/.ci/test_r_package_windows.ps1 index 093f7fb2e7a7..c4ae84f49dae 100644 --- a/.ci/test_r_package_windows.ps1 +++ b/.ci/test_r_package_windows.ps1 @@ -124,7 +124,7 @@ Start-Process -FilePath Rtools.exe -NoNewWindow -Wait -ArgumentList "/VERYSILENT Write-Output "Done installing Rtools" Write-Output "Installing dependencies" -$packages = "c('data.table', 'jsonlite', 'knitr', 'Matrix', 'processx', 'R6', 'RhpcBLASctl', 'rmarkdown', 'testthat'), dependencies = c('Imports', 'Depends', 'LinkingTo')" +$packages = "c('data.table', 'jsonlite', 'knitr', 'markdown', 'Matrix', 'processx', 'R6', 'RhpcBLASctl', 'testthat'), dependencies = c('Imports', 'Depends', 'LinkingTo')" Run-R-Code-Redirect-Stderr "options(install.packages.check.source = 'no'); install.packages($packages, repos = '$env:CRAN_MIRROR', type = 'binary', lib = '$env:R_LIB_PATH', Ncpus = parallel::detectCores())" ; Check-Output $? Write-Output "Building R package" diff --git a/.github/workflows/r_package.yml b/.github/workflows/r_package.yml index 6923c0c29114..4fa7f2ff8683 100644 --- a/.github/workflows/r_package.yml +++ b/.github/workflows/r_package.yml @@ -246,7 +246,7 @@ jobs: - name: Install packages shell: bash run: | - RDscript${{ matrix.r_customization }} -e "install.packages(c('R6', 'data.table', 'jsonlite', 'knitr', 'Matrix', 'RhpcBLASctl', 'rmarkdown', 'testthat'), repos = 'https://cran.rstudio.com', Ncpus = parallel::detectCores())" + RDscript${{ matrix.r_customization }} -e "install.packages(c('R6', 'data.table', 'jsonlite', 'knitr', 'markdown', 'Matrix', 'RhpcBLASctl', 'testthat'), repos = 'https://cran.rstudio.com', Ncpus = parallel::detectCores())" sh build-cran-package.sh --r-executable=RD${{ matrix.r_customization }} RD${{ matrix.r_customization }} CMD INSTALL lightgbm_*.tar.gz || exit -1 - name: Run tests with sanitizers @@ -320,7 +320,7 @@ jobs: shell: bash run: | export PATH=/opt/R-devel/bin/:${PATH} - Rscript -e "install.packages(c('R6', 'data.table', 'jsonlite', 'knitr', 'Matrix', 'RhpcBLASctl', 'rmarkdown', 'testthat'), repos = 'https://cran.rstudio.com', Ncpus = parallel::detectCores())" + Rscript -e "install.packages(c('R6', 'data.table', 'jsonlite', 'knitr', 'markdown', 'Matrix', 'RhpcBLASctl', 'testthat'), repos = 'https://cran.rstudio.com', Ncpus = parallel::detectCores())" sh build-cran-package.sh R CMD check --as-cran --run-donttest lightgbm_*.tar.gz || exit -1 if grep -q -E "NOTE|WARNING|ERROR" lightgbm.Rcheck/00check.log; then diff --git a/.github/workflows/static_analysis.yml b/.github/workflows/static_analysis.yml index bf369e79c0c5..33d50b751197 100644 --- a/.github/workflows/static_analysis.yml +++ b/.github/workflows/static_analysis.yml @@ -66,7 +66,7 @@ jobs: - name: Install packages shell: bash run: | - Rscript -e "install.packages(c('R6', 'data.table', 'jsonlite', 'knitr', 'Matrix', 'RhpcBLASctl', 'rmarkdown', 'roxygen2', 'testthat'), repos = 'https://cran.rstudio.com', Ncpus = parallel::detectCores())" + Rscript -e "install.packages(c('R6', 'data.table', 'jsonlite', 'knitr', 'markdown', 'Matrix', 'RhpcBLASctl', 'roxygen2', 'testthat'), repos = 'https://cran.rstudio.com', Ncpus = parallel::detectCores())" sh build-cran-package.sh || exit -1 R CMD INSTALL --with-keep.source lightgbm_*.tar.gz || exit -1 - name: Test documentation diff --git a/.vsts-ci.yml b/.vsts-ci.yml index c750dfa502ac..f3f3fd8dd1fe 100644 --- a/.vsts-ci.yml +++ b/.vsts-ci.yml @@ -309,7 +309,7 @@ jobs: R_LIB_PATH=~/Rlib export R_LIBS=${R_LIB_PATH} mkdir -p ${R_LIB_PATH} - RDscript -e "install.packages(c('R6', 'data.table', 'jsonlite', 'knitr', 'Matrix', 'RhpcBLASctl', 'rmarkdown'), lib = '${R_LIB_PATH}', dependencies = c('Depends', 'Imports', 'LinkingTo'), repos = 'https://cran.rstudio.com', Ncpus = parallel::detectCores())" || exit -1 + RDscript -e "install.packages(c('R6', 'data.table', 'jsonlite', 'knitr', 'markdown', 'Matrix', 'RhpcBLASctl'), lib = '${R_LIB_PATH}', dependencies = c('Depends', 'Imports', 'LinkingTo'), repos = 'https://cran.rstudio.com', Ncpus = parallel::detectCores())" || exit -1 sh build-cran-package.sh --r-executable=RD || exit -1 mv lightgbm_${LGB_VER}.tar.gz $(Build.ArtifactStagingDirectory)/lightgbm-${LGB_VER}-r-cran.tar.gz displayName: 'Build CRAN R-package' diff --git a/R-package/DESCRIPTION b/R-package/DESCRIPTION index 62b479530b4a..6fbeeee859be 100755 --- a/R-package/DESCRIPTION +++ b/R-package/DESCRIPTION @@ -46,9 +46,9 @@ Biarch: true VignetteBuilder: knitr Suggests: knitr, + markdown, processx, RhpcBLASctl, - rmarkdown, testthat Depends: R (>= 3.5) diff --git a/R-package/README.md b/R-package/README.md index 5a4db46dcf9c..a9dc65b5d7b3 100644 --- a/R-package/README.md +++ b/R-package/README.md @@ -428,7 +428,7 @@ docker run \ # install dependencies RDscript${R_CUSTOMIZATION} \ - -e "install.packages(c('R6', 'data.table', 'jsonlite', 'knitr', 'Matrix', 'RhpcBLASctl', 'rmarkdown', 'testthat'), repos = 'https://cran.r-project.org', Ncpus = parallel::detectCores())" + -e "install.packages(c('R6', 'data.table', 'jsonlite', 'knitr', 'markdown', 'Matrix', 'RhpcBLASctl', 'testthat'), repos = 'https://cran.r-project.org', Ncpus = parallel::detectCores())" # install lightgbm sh build-cran-package.sh --r-executable=RD${R_CUSTOMIZATION} @@ -459,7 +459,7 @@ docker run \ -it \ wch1/r-debug -RDscriptvalgrind -e "install.packages(c('R6', 'data.table', 'jsonlite', 'knitr', 'Matrix', 'RhpcBLASctl', 'rmarkdown', 'testthat'), repos = 'https://cran.rstudio.com', Ncpus = parallel::detectCores())" +RDscriptvalgrind -e "install.packages(c('R6', 'data.table', 'jsonlite', 'knitr', 'markdown', 'Matrix', 'RhpcBLASctl', 'testthat'), repos = 'https://cran.rstudio.com', Ncpus = parallel::detectCores())" sh build-cran-package.sh \ --r-executable=RDvalgrind diff --git a/R-package/vignettes/basic_walkthrough.Rmd b/R-package/vignettes/basic_walkthrough.Rmd index 82bd6957640c..01e2410d501e 100644 --- a/R-package/vignettes/basic_walkthrough.Rmd +++ b/R-package/vignettes/basic_walkthrough.Rmd @@ -3,10 +3,14 @@ title: "Basic Walkthrough" description: > This vignette describes how to train a LightGBM model for binary classification. -output: rmarkdown::html_vignette +output: + markdown::html_format: + options: + toc: true + number_sections: true vignette: > %\VignetteIndexEntry{Basic Walkthrough} - %\VignetteEngine{knitr::rmarkdown} + %\VignetteEngine{knitr::knitr} %\VignetteEncoding{UTF-8} --- @@ -23,7 +27,7 @@ knitr::opts_chunk$set( Welcome to the world of [LightGBM](https://lightgbm.readthedocs.io/en/latest/), a highly efficient gradient boosting implementation (Ke et al. 2017). -```{r setup} +```{r} library(lightgbm) ``` diff --git a/docs/env.yml b/docs/env.yml index 69bcd92fbdc3..351ce1f0fae0 100644 --- a/docs/env.yml +++ b/docs/env.yml @@ -9,9 +9,9 @@ dependencies: - r-data.table=1.14.2 - r-jsonlite=1.7.2 - r-knitr=1.37 + - r-markdown - r-matrix=1.4_0 - r-pkgdown=1.6.1 - - r-rmarkdown=2.11 - r-roxygen2=7.2.1 - scikit-learn - sphinx From f3ac92adbb37c27609a3e53de31f6ab04b91a860 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Sun, 7 Jan 2024 10:16:46 -0600 Subject: [PATCH 2/3] remove pandoc too --- .github/workflows/r_package.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/r_package.yml b/.github/workflows/r_package.yml index 4fa7f2ff8683..b7fd546c3155 100644 --- a/.github/workflows/r_package.yml +++ b/.github/workflows/r_package.yml @@ -177,8 +177,6 @@ jobs: with: fetch-depth: 5 submodules: true - - name: Install pandoc - uses: r-lib/actions/setup-pandoc@v2 - name: install tinytex if: startsWith(matrix.os, 'windows') uses: r-lib/actions/setup-tinytex@v2 From 813f8bccca92c9228621488b5947e45c4ee26651 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Sun, 7 Jan 2024 15:03:45 -0600 Subject: [PATCH 3/3] Revert "remove pandoc too" This reverts commit f3ac92adbb37c27609a3e53de31f6ab04b91a860. --- .github/workflows/r_package.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/r_package.yml b/.github/workflows/r_package.yml index b7fd546c3155..4fa7f2ff8683 100644 --- a/.github/workflows/r_package.yml +++ b/.github/workflows/r_package.yml @@ -177,6 +177,8 @@ jobs: with: fetch-depth: 5 submodules: true + - name: Install pandoc + uses: r-lib/actions/setup-pandoc@v2 - name: install tinytex if: startsWith(matrix.os, 'windows') uses: r-lib/actions/setup-tinytex@v2