From 06f28b3318e3088f75ca90ed3755ecd74cc596aa Mon Sep 17 00:00:00 2001 From: James Lamb Date: Wed, 23 Nov 2022 23:12:33 -0600 Subject: [PATCH] [ci] switch from MiKTeX to tinytex on Windows R jobs (fixes #5600) --- .ci/test_r_package_windows.ps1 | 21 +-------------------- .github/workflows/r_package.yml | 6 ++++++ 2 files changed, 7 insertions(+), 20 deletions(-) diff --git a/.ci/test_r_package_windows.ps1 b/.ci/test_r_package_windows.ps1 index fc6fbc9ee4f3..2005ad5adeeb 100644 --- a/.ci/test_r_package_windows.ps1 +++ b/.ci/test_r_package_windows.ps1 @@ -88,10 +88,8 @@ if ($env:R_MAJOR_VERSION -eq "3") { $env:R_LIB_PATH = "$env:BUILD_SOURCESDIRECTORY/RLibrary" -replace '[\\]', '/' $env:R_LIBS = "$env:R_LIB_PATH" -$env:PATH = "$env:RTOOLS_BIN;" + "$env:RTOOLS_MINGW_BIN;" + "$env:R_LIB_PATH/R/bin/x64;" + "$env:R_LIB_PATH/miktex/texmfs/install/miktex/bin/x64;" + $env:PATH +$env:PATH = "$env:RTOOLS_BIN;" + "$env:RTOOLS_MINGW_BIN;" + "$env:R_LIB_PATH/R/bin/x64;"+ $env:PATH $env:CRAN_MIRROR = "https://cran.rstudio.com" -$env:CTAN_MIRROR = "https://ctan.math.illinois.edu/systems/win32/miktex" -$env:CTAN_PACKAGE_ARCHIVE = "$env:CTAN_MIRROR/tm/packages/" $env:MIKTEX_EXCEPTION_PATH = "$env:TEMP\miktex" # don't fail builds for long-running examples unless they're very long. @@ -127,23 +125,6 @@ Write-Output "Installing dependencies" $packages = "c('data.table', 'jsonlite', 'knitr', 'Matrix', 'processx', 'R6', 'RhpcBLASctl', 'rmarkdown', '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 $? -# MiKTeX and pandoc can be skipped on non-MinGW builds, since we don't -# build the package documentation for those. -# -# MiKTeX always needs to be built to test a CRAN package. -if (($env:COMPILER -eq "MINGW") -or ($env:R_BUILD_TYPE -eq "cran")) { - Download-File-With-Retries "https://github.com/microsoft/LightGBM/releases/download/v2.0.12/miktexsetup-5.2.0-x64.zip" -destfile "miktexsetup-x64.zip" - Add-Type -AssemblyName System.IO.Compression.FileSystem - [System.IO.Compression.ZipFile]::ExtractToDirectory("miktexsetup-x64.zip", "miktex") - Write-Output "Setting up MiKTeX" - .\miktex\miktexsetup_standalone.exe --remote-package-repository="$env:CTAN_PACKAGE_ARCHIVE" --local-package-repository=./miktex/download --package-set=essential --quiet download ; Check-Output $? - Write-Output "Installing MiKTeX" - .\miktex\download\miktexsetup_standalone.exe --remote-package-repository="$env:CTAN_PACKAGE_ARCHIVE" --portable="$env:R_LIB_PATH/miktex" --quiet install ; Check-Output $? - Write-Output "Done installing MiKTeX" - - Run-R-Code-Redirect-Stderr "result <- processx::run(command = 'initexmf', args = c('--set-config-value', '[MPM]AutoInstall=1'), echo = TRUE, windows_verbatim_args = TRUE, error_on_status = TRUE)" ; Check-Output $? -} - Write-Output "Building R package" # R CMD check is not used for MSVC builds diff --git a/.github/workflows/r_package.yml b/.github/workflows/r_package.yml index c6afad807ae2..29c203d160f0 100644 --- a/.github/workflows/r_package.yml +++ b/.github/workflows/r_package.yml @@ -144,6 +144,12 @@ jobs: submodules: true - name: Install pandoc uses: r-lib/actions/setup-pandoc@v1 + - 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 - name: Setup and run tests on Linux and macOS if: matrix.os == 'macOS-latest' || matrix.os == 'ubuntu-latest' shell: bash