Unverified Commit 967a7814 authored by James Lamb's avatar James Lamb Committed by GitHub
Browse files

[R-package][ci] Make Windows CI fail if R CMD check fails (#3435)

* [R-package] [ci] Make Windows CI fail if R CMD check fails

* restore fix

* catch more errors

* remove testing

* fix processx calls

* try to get status code

* more logs

* trying something

* stuff

* previous changes

* uncomment
parent 2903ca0c
...@@ -118,7 +118,7 @@ if (($env:COMPILER -eq "MINGW") -or ($env:R_BUILD_TYPE -eq "cran")) { ...@@ -118,7 +118,7 @@ if (($env:COMPILER -eq "MINGW") -or ($env:R_BUILD_TYPE -eq "cran")) {
.\miktex\download\miktexsetup.exe --remote-package-repository="$env:CTAN_PACKAGE_ARCHIVE" --portable="$env:R_LIB_PATH/miktex" --quiet install ; Check-Output $? .\miktex\download\miktexsetup.exe --remote-package-repository="$env:CTAN_PACKAGE_ARCHIVE" --portable="$env:R_LIB_PATH/miktex" --quiet install ; Check-Output $?
Write-Output "Done installing MiKTeX" 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)" ; Check-Output $? 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 $?
conda install -q -y --no-deps pandoc conda install -q -y --no-deps pandoc
} }
...@@ -133,7 +133,7 @@ if ($env:COMPILER -ne "MSVC") { ...@@ -133,7 +133,7 @@ if ($env:COMPILER -ne "MSVC") {
if ($env:R_BUILD_TYPE -eq "cmake") { if ($env:R_BUILD_TYPE -eq "cmake") {
Run-R-Code-Redirect-Stderr "commandArgs <- function(...){'--skip-install'}; source('build_r.R')"; Check-Output $? Run-R-Code-Redirect-Stderr "commandArgs <- function(...){'--skip-install'}; source('build_r.R')"; Check-Output $?
} elseif ($env:R_BUILD_TYPE -eq "cran") { } elseif ($env:R_BUILD_TYPE -eq "cran") {
Run-R-Code-Redirect-Stderr "result <- processx::run(command = 'sh', args = 'build-cran-package.sh', echo = TRUE, windows_verbatim_args = FALSE)" ; Check-Output $? Run-R-Code-Redirect-Stderr "result <- processx::run(command = 'sh', args = 'build-cran-package.sh', echo = TRUE, windows_verbatim_args = FALSE, error_on_status = TRUE)" ; Check-Output $?
# Test CRAN source .tar.gz in a directory that is not this repo or below it. # Test CRAN source .tar.gz in a directory that is not this repo or below it.
# When people install.packages('lightgbm'), they won't have the LightGBM # When people install.packages('lightgbm'), they won't have the LightGBM
# git repo around. This is to protect against the use of relative paths # git repo around. This is to protect against the use of relative paths
...@@ -151,7 +151,7 @@ if ($env:COMPILER -ne "MSVC") { ...@@ -151,7 +151,7 @@ if ($env:COMPILER -ne "MSVC") {
} else { } else {
$check_args = "c('CMD', 'check', '--no-multiarch', '--as-cran', '--run-dontrun', '$PKG_FILE_NAME')" $check_args = "c('CMD', 'check', '--no-multiarch', '--as-cran', '--run-dontrun', '$PKG_FILE_NAME')"
} }
Run-R-Code-Redirect-Stderr "result <- processx::run(command = 'R.exe', args = $check_args, echo = TRUE, windows_verbatim_args = FALSE)" ; $check_succeeded = $? Run-R-Code-Redirect-Stderr "result <- processx::run(command = 'R.exe', args = $check_args, echo = TRUE, windows_verbatim_args = FALSE, error_on_status = TRUE)" ; $check_succeeded = $?
Write-Output "R CMD check build logs:" Write-Output "R CMD check build logs:"
$INSTALL_LOG_FILE_NAME = "lightgbm.Rcheck\00install.out" $INSTALL_LOG_FILE_NAME = "lightgbm.Rcheck\00install.out"
...@@ -160,7 +160,11 @@ if ($env:COMPILER -ne "MSVC") { ...@@ -160,7 +160,11 @@ if ($env:COMPILER -ne "MSVC") {
Check-Output $check_succeeded Check-Output $check_succeeded
Write-Output "Looking for issues with R CMD check results" Write-Output "Looking for issues with R CMD check results"
if (Get-Content "$LOG_FILE_NAME" | Select-String -Pattern "WARNING" -Quiet) { if (Get-Content "$LOG_FILE_NAME" | Select-String -Pattern "ERROR" -CaseSensitive -Quiet) {
echo "ERRORs have been found by R CMD check!"
Check-Output $False
}
if (Get-Content "$LOG_FILE_NAME" | Select-String -Pattern "WARNING" -CaseSensitive -Quiet) {
echo "WARNINGS have been found by R CMD check!" echo "WARNINGS have been found by R CMD check!"
Check-Output $False Check-Output $False
} }
...@@ -181,6 +185,11 @@ if ($env:COMPILER -ne "MSVC") { ...@@ -181,6 +185,11 @@ if ($env:COMPILER -ne "MSVC") {
Get-Content -Path "$INSTALL_LOG_FILE_NAME" Get-Content -Path "$INSTALL_LOG_FILE_NAME"
Write-Output "----- end of build and install logs -----" Write-Output "----- end of build and install logs -----"
Check-Output $install_succeeded Check-Output $install_succeeded
# some errors are not raised above, but can be found in the logs
if (Get-Content "$INSTALL_LOG_FILE_NAME" | Select-String -Pattern "ERROR" -CaseSensitive -Quiet) {
echo "ERRORs have been found installing lightgbm"
Check-Output $False
}
} }
# Checking that we actually got the expected compiler. The R package has some logic # Checking that we actually got the expected compiler. The R package has some logic
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment