Skip to content

Commit

Permalink
[ci][R-package][python] suppress warning about empty 'compute' direct…
Browse files Browse the repository at this point in the history
…or, fix Rtools installation and temporary pin Sphinx version (#3277)

* [R-package] suppress warning about empty 'compute' directory

* get more logs from Rtools install

* empty commit

* add a timeout

* trying Invoke-WebRequest instead

* switch to CRAN link

* do not use Start-Process

* relative paths

* trying suppressmessageboxes

* switch strategy for running Rtools

* Update requirements_rtd.txt

* Update requirements_base.txt

Co-authored-by: Nikita Titov <nekit94-08@mail.ru>
  • Loading branch information
jameslamb and StrikerRUS committed Aug 9, 2020
1 parent ee8ec18 commit 7be57d7
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 13 deletions.
8 changes: 4 additions & 4 deletions .ci/test_r_package_windows.ps1
Expand Up @@ -8,7 +8,7 @@ function Download-File-With-Retries {
do {
Write-Output "Downloading ${url}"
sleep 5;
(New-Object System.Net.WebClient).DownloadFile($url, $destfile)
Invoke-WebRequest -Uri $url -OutFile $destfile
} while(!$?);
}

Expand Down Expand Up @@ -102,16 +102,16 @@ if ($env:R_BUILD_TYPE -eq "cmake") {

# download R and RTools
Write-Output "Downloading R and Rtools"
Download-File-With-Retries -url "https://cloud.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 "https://cloud.r-project.org/bin/windows/Rtools/$env:RTOOLS_EXE_FILE" -destfile "Rtools.exe"
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 "https://cran.r-project.org/bin/windows/Rtools/$env:RTOOLS_EXE_FILE" -destfile "Rtools.exe"

# Install R
Write-Output "Installing R"
Start-Process -FilePath R-win.exe -NoNewWindow -Wait -ArgumentList "/VERYSILENT /DIR=$env:R_LIB_PATH/R /COMPONENTS=main,x64" ; Check-Output $?
Write-Output "Done installing R"

Write-Output "Installing Rtools"
Start-Process -FilePath Rtools.exe -NoNewWindow -Wait -ArgumentList "/VERYSILENT /DIR=$RTOOLS_INSTALL_PATH" ; Check-Output $?
./Rtools.exe /VERYSILENT /SUPPRESSMSGBOXES /DIR=$RTOOLS_INSTALL_PATH ; Check-Output $?
Write-Output "Done installing Rtools"

Write-Output "Installing dependencies"
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/main.yml
Expand Up @@ -12,6 +12,7 @@ jobs:
test:
name: ${{ matrix.task }} (${{ matrix.os }}, ${{ matrix.compiler }}, R ${{ matrix.r_version }}, ${{ matrix.build_type }})
runs-on: ${{ matrix.os }}
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
Expand Down
23 changes: 16 additions & 7 deletions build_r.R
Expand Up @@ -10,6 +10,11 @@ INSTALL_AFTER_BUILD <- !("--skip-install" %in% args)
TEMP_R_DIR <- file.path(getwd(), "lightgbm_r")
TEMP_SOURCE_DIR <- file.path(TEMP_R_DIR, "src")

install_libs_content <- readLines(
file.path("R-package", "src", "install.libs.R")
)
USING_GPU <- any(grepl("use_gpu.*TRUE", install_libs_content))

# R returns FALSE (not a non-zero exit code) if a file copy operation
# breaks. Let's fix that
.handle_result <- function(res) {
Expand Down Expand Up @@ -100,13 +105,17 @@ result <- file.copy(
)
.handle_result(result)

result <- file.copy(
from = "compute/"
, to = sprintf("%s/", TEMP_SOURCE_DIR)
, recursive = TRUE
, overwrite = TRUE
)
.handle_result(result)
# compute/ is a submodule with boost, only needed if
# building the R package with GPU support
if (USING_GPU) {
result <- file.copy(
from = "compute/"
, to = sprintf("%s/", TEMP_SOURCE_DIR)
, recursive = TRUE
, overwrite = TRUE
)
.handle_result(result)
}

result <- file.copy(
from = "CMakeLists.txt"
Expand Down
2 changes: 1 addition & 1 deletion docs/requirements_base.txt
@@ -1,3 +1,3 @@
sphinx
sphinx < 3.2
sphinx_rtd_theme >= 0.3
mock; python_version < '3'
2 changes: 1 addition & 1 deletion docs/requirements_rtd.txt
@@ -1,4 +1,4 @@
sphinx >= 3.0.2
sphinx >= 3.0.2,<3.2
sphinx_rtd_theme >= 0.3
mock; python_version < '3'
breathe

0 comments on commit 7be57d7

Please sign in to comment.