From 0ebbf1e497615eac5f175d8e2d13393ce45ca2c2 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Sun, 22 May 2022 21:31:31 -0500 Subject: [PATCH] [ci] switch CRAN mirror to RStudio (#5230) --- .ci/test_r_package.sh | 8 ++++---- .ci/test_r_package_valgrind.sh | 2 +- .ci/test_r_package_windows.ps1 | 4 ++-- .github/workflows/r_package.yml | 4 ++-- .github/workflows/static_analysis.yml | 2 +- .vsts-ci.yml | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.ci/test_r_package.sh b/.ci/test_r_package.sh index 3e8c20358..ad0de4f5a 100755 --- a/.ci/test_r_package.sh +++ b/.ci/test_r_package.sh @@ -1,7 +1,7 @@ #!/bin/bash # set up R environment -CRAN_MIRROR="https://cloud.r-project.org/" +CRAN_MIRROR="https://cran.rstudio.com" R_LIB_PATH=~/Rlib mkdir -p $R_LIB_PATH export R_LIBS=$R_LIB_PATH @@ -17,12 +17,12 @@ fi R_MAJOR_VERSION=( ${R_VERSION//./ } ) if [[ "${R_MAJOR_VERSION}" == "3" ]]; then export R_MAC_VERSION=3.6.3 - export R_MAC_PKG_URL=https://cran.r-project.org/bin/macosx/R-${R_MAC_VERSION}.pkg + export R_MAC_PKG_URL=${CRAN_MIRROR}/bin/macosx/R-${R_MAC_VERSION}.pkg export R_LINUX_VERSION="3.6.3-1bionic" export R_APT_REPO="bionic-cran35/" elif [[ "${R_MAJOR_VERSION}" == "4" ]]; then export R_MAC_VERSION=4.1.3 - export R_MAC_PKG_URL=https://cran.r-project.org/bin/macosx/base/R-${R_MAC_VERSION}.pkg + export R_MAC_PKG_URL=${CRAN_MIRROR}/bin/macosx/base/R-${R_MAC_VERSION}.pkg export R_LINUX_VERSION="4.1.3-1.2004.0" export R_APT_REPO="focal-cran40/" else @@ -40,7 +40,7 @@ if [[ $OS_NAME == "linux" ]]; then --keyserver keyserver.ubuntu.com \ --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9 sudo add-apt-repository \ - "deb https://cloud.r-project.org/bin/linux/ubuntu ${R_APT_REPO}" + "deb ${CRAN_MIRROR}/bin/linux/ubuntu ${R_APT_REPO}" sudo apt-get update sudo apt-get install \ --no-install-recommends \ diff --git a/.ci/test_r_package_valgrind.sh b/.ci/test_r_package_valgrind.sh index 4185b9450..528a9af48 100755 --- a/.ci/test_r_package_valgrind.sh +++ b/.ci/test_r_package_valgrind.sh @@ -1,6 +1,6 @@ #!/bin/bash -RDscriptvalgrind -e "install.packages(c('R6', 'data.table', 'jsonlite', 'knitr', 'Matrix', 'RhpcBLASctl', 'rmarkdown', 'testthat'), repos = 'https://cran.r-project.org', Ncpus = parallel::detectCores())" || exit -1 +RDscriptvalgrind -e "install.packages(c('R6', 'data.table', 'jsonlite', 'knitr', 'Matrix', 'RhpcBLASctl', 'rmarkdown', 'testthat'), repos = 'https://cran.rstudio.com', Ncpus = parallel::detectCores())" || exit -1 sh build-cran-package.sh \ --r-executable=RDvalgrind \ || exit -1 diff --git a/.ci/test_r_package_windows.ps1 b/.ci/test_r_package_windows.ps1 index d830e4216..81573957f 100644 --- a/.ci/test_r_package_windows.ps1 +++ b/.ci/test_r_package_windows.ps1 @@ -87,7 +87,7 @@ 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:CRAN_MIRROR = "https://cloud.r-project.org/" +$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" @@ -109,7 +109,7 @@ tzutil /s "GMT Standard Time" # download R and RTools Write-Output "Downloading R and Rtools" -Download-File-With-Retries -url "https://cran.r-project.org/bin/windows/base/old/$env:R_WINDOWS_VERSION/R-$env:R_WINDOWS_VERSION-win.exe" -destfile "R-win.exe" +Download-File-With-Retries -url "$env:CRAN_MIRROR/bin/windows/base/old/$env:R_WINDOWS_VERSION/R-$env:R_WINDOWS_VERSION-win.exe" -destfile "R-win.exe" Download-File-With-Retries -url "https://github.com/microsoft/LightGBM/releases/download/v2.0.12/$env:RTOOLS_EXE_FILE" -destfile "Rtools.exe" # Install R diff --git a/.github/workflows/r_package.yml b/.github/workflows/r_package.yml index 3090291c6..84b82996a 100644 --- a/.github/workflows/r_package.yml +++ b/.github/workflows/r_package.yml @@ -191,7 +191,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.r-project.org', Ncpus = parallel::detectCores())" + 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())" 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 @@ -225,7 +225,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.r-project.org', Ncpus = parallel::detectCores())" + Rscript -e "install.packages(c('R6', 'data.table', 'jsonlite', 'knitr', 'Matrix', 'RhpcBLASctl', 'rmarkdown', '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 ce3d82f9d..16a078438 100644 --- a/.github/workflows/static_analysis.yml +++ b/.github/workflows/static_analysis.yml @@ -60,7 +60,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.r-project.org', Ncpus = parallel::detectCores())" + Rscript -e "install.packages(c('R6', 'data.table', 'jsonlite', 'knitr', 'Matrix', 'RhpcBLASctl', 'rmarkdown', '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 b3c90ee2d..e026c3658 100644 --- a/.vsts-ci.yml +++ b/.vsts-ci.yml @@ -317,7 +317,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.r-project.org', Ncpus = parallel::detectCores())" || exit -1 + 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 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'