From 19ed854700b35fafaa4d665ae28287be06ccc2af Mon Sep 17 00:00:00 2001 From: James Lamb Date: Sat, 21 Mar 2020 16:52:09 -0500 Subject: [PATCH 01/87] first test of appveyor --- .appveyor.yml | 33 +++++++++++++----------- .ci/test_windows.ps1 | 60 ++++++++++++++++++++++++++++++++++++++++++-- .vsts-ci.yml | 3 +++ 3 files changed, 80 insertions(+), 16 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index 990d36953dd1..4c79131fe9be 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -8,7 +8,11 @@ configuration: # a trick to construct a build matrix with multiple Python versi environment: matrix: - COMPILER: MSVC + TASK: r-package + R_WINDOWS_VERSION: 3.6.1 - COMPILER: MINGW + TASK: r-package + R_WINDOWS_VERSION: 3.6.1 clone_depth: 5 @@ -41,17 +45,18 @@ build_script: python setup.py install) test_script: - - pytest %APPVEYOR_BUILD_FOLDER%\tests\python_package_test - - cd %APPVEYOR_BUILD_FOLDER%\examples\python-guide - - ps: >- - @("import matplotlib", "matplotlib.use('Agg')") + (Get-Content "plot_example.py") | Set-Content "plot_example.py" # prevent interactive window mode - (Get-Content "plot_example.py").replace('graph.render(view=True)', 'graph.render(view=False)') | Set-Content "plot_example.py" - - ps: >- - foreach ($file in @(Get-ChildItem *.py)) { - @("import sys, warnings", "warnings.showwarning = lambda message, category, filename, lineno, file=None, line=None: sys.stdout.write(warnings.formatwarning(message, category, filename, lineno, line))") + (Get-Content $file) | Set-Content $file - python $file - if (!$?) { $host.SetShouldExit(-1) } - } # run all examples - - cd %APPVEYOR_BUILD_FOLDER%\examples\python-guide\notebooks - - conda install -q -y -n test-env ipywidgets notebook - - jupyter nbconvert --ExecutePreprocessor.timeout=180 --to notebook --execute --inplace *.ipynb # run all notebooks + # - pytest %APPVEYOR_BUILD_FOLDER%\tests\python_package_test + # - cd %APPVEYOR_BUILD_FOLDER%\examples\python-guide + # - ps: >- + # @("import matplotlib", "matplotlib.use('Agg')") + (Get-Content "plot_example.py") | Set-Content "plot_example.py" # prevent interactive window mode + # (Get-Content "plot_example.py").replace('graph.render(view=True)', 'graph.render(view=False)') | Set-Content "plot_example.py" + # - ps: >- + # foreach ($file in @(Get-ChildItem *.py)) { + # @("import sys, warnings", "warnings.showwarning = lambda message, category, filename, lineno, file=None, line=None: sys.stdout.write(warnings.formatwarning(message, category, filename, lineno, line))") + (Get-Content $file) | Set-Content $file + # python $file + # if (!$?) { $host.SetShouldExit(-1) } + # } # run all examples + # - cd %APPVEYOR_BUILD_FOLDER%\examples\python-guide\notebooks + # - conda install -q -y -n test-env ipywidgets notebook + # - jupyter nbconvert --ExecutePreprocessor.timeout=180 --to notebook --execute --inplace *.ipynb # run all notebooks + - cmd /c "powershell -ExecutionPolicy Bypass -File %APPVEYOR_BUILD_FOLDER%\.ci\test_windows.ps1" diff --git a/.ci/test_windows.ps1 b/.ci/test_windows.ps1 index cf34af079268..6d1c94f3b9fa 100644 --- a/.ci/test_windows.ps1 +++ b/.ci/test_windows.ps1 @@ -35,8 +35,10 @@ elseif ($env:TASK -eq "bdist") { cp @(Get-ChildItem *.whl) $env:BUILD_ARTIFACTSTAGINGDIRECTORY } -$tests = $env:BUILD_SOURCESDIRECTORY + $(If ($env:TASK -eq "sdist") {"/tests/python_package_test"} Else {"/tests"}) # cannot test C API with "sdist" task -pytest $tests ; Check-Output $? +if ($env:TASK -ne "r-package") { + $tests = $env:BUILD_SOURCESDIRECTORY + $(If ($env:TASK -eq "sdist") {"/tests/python_package_test"} Else {"/tests"}) # cannot test C API with "sdist" task + pytest $tests ; Check-Output $? +} if ($env:TASK -eq "regular") { cd $env:BUILD_SOURCESDIRECTORY/examples/python-guide @@ -50,3 +52,57 @@ if ($env:TASK -eq "regular") { conda install -q -y -n $env:CONDA_ENV ipywidgets notebook jupyter nbconvert --ExecutePreprocessor.timeout=180 --to notebook --execute --inplace *.ipynb ; Check-Output $? # run all notebooks } + +# test R package +# based on https://github.com/RGF-team/rgf/blob/master/R-package/.R.appveyor.ps1 +if ($env:TASK -eq "r-package"){ + + Import-CliXml .\env-vars.clixml | % { Set-Item "env:$($_.Name)" $_.Value } + tzutil /s "GMT Standard Time" + [Void][System.IO.Directory]::CreateDirectory($env:R_LIB_PATH) + + $env:PATH = "$env:R_LIB_PATH\Rtools\bin;" + "$env:R_LIB_PATH\R\bin\x64;" + "$env:R_LIB_PATH\miktex\texmfs\install\miktex\bin\x64;" + $env:PATH + $env:BINPREF = "C:/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/bin/" + + # set up R if it doesn't exist yet + if (!(Get-Command R.exe -errorAction SilentlyContinue)) { + + # download R and RTools + (New-Object System.Net.WebClient).DownloadFile(https://cloud.r-project.org/bin/windows/base/R-${env:R_WINDOWS_VERSION}-win.exe, ./R-win.exe) + (New-Object System.Net.WebClient).DownloadFile(https://cloud.r-project.org/bin/windows/Rtools/Rtools35.exe, ./Rtools.exe) + + # Install R + Start-Process -FilePath .\R-win.exe -NoNewWindow -Wait -ArgumentList "/VERYSILENT /DIR=$env:R_LIB_PATH\R /COMPONENTS=main,x64" + Start-Process -FilePath .\Rtools.exe -NoNewWindow -Wait -ArgumentList "/VERYSILENT /DIR=$env:R_LIB_PATH\Rtools" + + # download Miktex + (New-Object System.Net.WebClient).DownloadFile(https://miktex.org/download/win/miktexsetup-x64.zip, ./miktexsetup-x64.zip) + Add-Type -AssemblyName System.IO.Compression.FileSystem + [System.IO.Compression.ZipFile]::ExtractToDirectory("miktexsetup-x64.zip", "miktex") + .\miktex\miktexsetup.exe --local-package-repository=.\miktex\download --package-set=essential --quiet download + .\miktex\download\miktexsetup.exe --portable="$env:R_LIB_PATH\miktex" --quiet install + } + + initexmf --set-config-value [MPM]AutoInstall=1 + conda install -y --no-deps pandoc + + Add-Content .Renviron "R_LIBS=$env:R_LIB_PATH" + Add-Content .Rprofile "options(repos = 'https://cran.rstudio.com')" + Add-Content .Rprofile "options(pkgType = 'binary')" + Add-Content .Rprofile "options(install.packages.check.source = 'no')" + + Rscript -e "install.packes(c('data.table', 'jsonlite', 'Matrix', 'R6', 'testthat'), dependencies = c('Imports', 'Depends', 'LinkingTo'))" ; Check-Output $? + + Rscript build_r.R ; Check-Output $? + + $PKG_FILE_NAME = Get-Item *.tar.gz + $PKG_NAME = $PKG_FILE_NAME.BaseName.split("_")[0] + $LOG_FILE_NAME = "$PKG_NAME.Rcheck/00check.log" + + R.exe CMD check "${PKG_FILE_NAME}" --as-cran --no-multiarch; Check-Output $? + + if (Get-Content "$LOG_FILE_NAME" | Select-String -Pattern "WARNING" -Quiet) { + echo "WARNINGS have been found by R CMD check!" + Check-Output $False + } +} diff --git a/.vsts-ci.yml b/.vsts-ci.yml index e004b56d5500..b32d58b7f372 100644 --- a/.vsts-ci.yml +++ b/.vsts-ci.yml @@ -128,6 +128,9 @@ jobs: bdist: TASK: bdist PYTHON_VERSION: 3.5 + rpkg: + TASK: r-package + R_WINDOWS_VERSION: 3.6.1 steps: - powershell: Write-Host "##vso[task.prependpath]$env:CONDA\Scripts" displayName: Enable conda From 16476da66a9943824382c31d7ac54335cd52d15c Mon Sep 17 00:00:00 2001 From: James Lamb Date: Sat, 21 Mar 2020 16:57:27 -0500 Subject: [PATCH 02/87] strings are strings --- .appveyor.yml | 12 ++++++------ .ci/test_windows.ps1 | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index 4c79131fe9be..6bdf51589cd8 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -37,12 +37,12 @@ install: - conda create -q -y -n test-env python=%PYTHON_VERSION% joblib matplotlib numpy pandas psutil pytest python-graphviz "scikit-learn<=0.21.3" scipy - activate test-env -build_script: - - cd %APPVEYOR_BUILD_FOLDER%\python-package - - IF "%COMPILER%"=="MINGW" ( - python setup.py install --mingw) - ELSE ( - python setup.py install) +# build_script: +# - cd %APPVEYOR_BUILD_FOLDER%\python-package +# - IF "%COMPILER%"=="MINGW" ( +# python setup.py install --mingw) +# ELSE ( +# python setup.py install) test_script: # - pytest %APPVEYOR_BUILD_FOLDER%\tests\python_package_test diff --git a/.ci/test_windows.ps1 b/.ci/test_windows.ps1 index 6d1c94f3b9fa..9cf998d1be35 100644 --- a/.ci/test_windows.ps1 +++ b/.ci/test_windows.ps1 @@ -68,8 +68,8 @@ if ($env:TASK -eq "r-package"){ if (!(Get-Command R.exe -errorAction SilentlyContinue)) { # download R and RTools - (New-Object System.Net.WebClient).DownloadFile(https://cloud.r-project.org/bin/windows/base/R-${env:R_WINDOWS_VERSION}-win.exe, ./R-win.exe) - (New-Object System.Net.WebClient).DownloadFile(https://cloud.r-project.org/bin/windows/Rtools/Rtools35.exe, ./Rtools.exe) + (New-Object System.Net.WebClient).DownloadFile("https://cloud.r-project.org/bin/windows/base/R-$env:R_WINDOWS_VERSION-win.exe", ./R-win.exe) + (New-Object System.Net.WebClient).DownloadFile("https://cloud.r-project.org/bin/windows/Rtools/Rtools35.exe", ./Rtools.exe) # Install R Start-Process -FilePath .\R-win.exe -NoNewWindow -Wait -ArgumentList "/VERYSILENT /DIR=$env:R_LIB_PATH\R /COMPONENTS=main,x64" From f7573f08da7d3c49fd770c1205d71073d70c21fb Mon Sep 17 00:00:00 2001 From: James Lamb Date: Sat, 21 Mar 2020 17:05:05 -0500 Subject: [PATCH 03/87] lil bit of build script --- .appveyor.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index 6bdf51589cd8..97e83abf323e 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -37,8 +37,8 @@ install: - conda create -q -y -n test-env python=%PYTHON_VERSION% joblib matplotlib numpy pandas psutil pytest python-graphviz "scikit-learn<=0.21.3" scipy - activate test-env -# build_script: -# - cd %APPVEYOR_BUILD_FOLDER%\python-package +build_script: + - cd %APPVEYOR_BUILD_FOLDER%\python-package # - IF "%COMPILER%"=="MINGW" ( # python setup.py install --mingw) # ELSE ( From 311d3d87e41dedb6bf0ef1d4c970a8a0397eadf5 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Sat, 21 Mar 2020 17:07:36 -0500 Subject: [PATCH 04/87] fixing paths --- .appveyor.yml | 6 +++--- .ci/test_windows.ps1 | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index 97e83abf323e..f92bc77161c0 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -10,9 +10,9 @@ environment: - COMPILER: MSVC TASK: r-package R_WINDOWS_VERSION: 3.6.1 - - COMPILER: MINGW - TASK: r-package - R_WINDOWS_VERSION: 3.6.1 + # - COMPILER: MINGW + # TASK: r-package + # R_WINDOWS_VERSION: 3.6.1 clone_depth: 5 diff --git a/.ci/test_windows.ps1 b/.ci/test_windows.ps1 index 9cf998d1be35..e1d29197b39d 100644 --- a/.ci/test_windows.ps1 +++ b/.ci/test_windows.ps1 @@ -68,15 +68,15 @@ if ($env:TASK -eq "r-package"){ if (!(Get-Command R.exe -errorAction SilentlyContinue)) { # download R and RTools - (New-Object System.Net.WebClient).DownloadFile("https://cloud.r-project.org/bin/windows/base/R-$env:R_WINDOWS_VERSION-win.exe", ./R-win.exe) - (New-Object System.Net.WebClient).DownloadFile("https://cloud.r-project.org/bin/windows/Rtools/Rtools35.exe", ./Rtools.exe) + (New-Object System.Net.WebClient).DownloadFile("https://cloud.r-project.org/bin/windows/base/R-$env:R_WINDOWS_VERSION-win.exe", "R-win.exe") + (New-Object System.Net.WebClient).DownloadFile("https://cloud.r-project.org/bin/windows/Rtools/Rtools35.exe", "Rtools.exe") # Install R Start-Process -FilePath .\R-win.exe -NoNewWindow -Wait -ArgumentList "/VERYSILENT /DIR=$env:R_LIB_PATH\R /COMPONENTS=main,x64" Start-Process -FilePath .\Rtools.exe -NoNewWindow -Wait -ArgumentList "/VERYSILENT /DIR=$env:R_LIB_PATH\Rtools" # download Miktex - (New-Object System.Net.WebClient).DownloadFile(https://miktex.org/download/win/miktexsetup-x64.zip, ./miktexsetup-x64.zip) + (New-Object System.Net.WebClient).DownloadFile("https://miktex.org/download/win/miktexsetup-x64.zip", "miktexsetup-x64.zip") Add-Type -AssemblyName System.IO.Compression.FileSystem [System.IO.Compression.ZipFile]::ExtractToDirectory("miktexsetup-x64.zip", "miktex") .\miktex\miktexsetup.exe --local-package-repository=.\miktex\download --package-set=essential --quiet download From c422b15c376aec4d62ecbc8819202d0463040790 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Sat, 21 Mar 2020 17:11:17 -0500 Subject: [PATCH 05/87] removed unnecessary file --- .ci/test_windows.ps1 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.ci/test_windows.ps1 b/.ci/test_windows.ps1 index e1d29197b39d..8aac988c4fd7 100644 --- a/.ci/test_windows.ps1 +++ b/.ci/test_windows.ps1 @@ -57,7 +57,9 @@ if ($env:TASK -eq "regular") { # based on https://github.com/RGF-team/rgf/blob/master/R-package/.R.appveyor.ps1 if ($env:TASK -eq "r-package"){ - Import-CliXml .\env-vars.clixml | % { Set-Item "env:$($_.Name)" $_.Value } + # Import-CliXml .\env-vars.clixml | % { Set-Item "env:$($_.Name)" $_.Value } + $env:R_LIB_PATH = "C:/Program Files" + tzutil /s "GMT Standard Time" [Void][System.IO.Directory]::CreateDirectory($env:R_LIB_PATH) From b2fce602651d64fd8b59ef84ee187dea4b62d179 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Sat, 21 Mar 2020 17:18:48 -0500 Subject: [PATCH 06/87] updated CRAN URL --- .ci/test_windows.ps1 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.ci/test_windows.ps1 b/.ci/test_windows.ps1 index 8aac988c4fd7..336248759008 100644 --- a/.ci/test_windows.ps1 +++ b/.ci/test_windows.ps1 @@ -53,6 +53,9 @@ if ($env:TASK -eq "regular") { jupyter nbconvert --ExecutePreprocessor.timeout=180 --to notebook --execute --inplace *.ipynb ; Check-Output $? # run all notebooks } +# TODO: +# * https://cran.r-project.org/bin/windows/base/old/3.6.1/R-3.6.1-win.exe + # test R package # based on https://github.com/RGF-team/rgf/blob/master/R-package/.R.appveyor.ps1 if ($env:TASK -eq "r-package"){ @@ -70,7 +73,7 @@ if ($env:TASK -eq "r-package"){ if (!(Get-Command R.exe -errorAction SilentlyContinue)) { # download R and RTools - (New-Object System.Net.WebClient).DownloadFile("https://cloud.r-project.org/bin/windows/base/R-$env:R_WINDOWS_VERSION-win.exe", "R-win.exe") + (New-Object System.Net.WebClient).DownloadFile("https://cloud.r-project.org/bin/windows/base/old/$env:R_WINDOWS_VERSION/R-$env:R_WINDOWS_VERSION-win.exe", "R-win.exe") (New-Object System.Net.WebClient).DownloadFile("https://cloud.r-project.org/bin/windows/Rtools/Rtools35.exe", "Rtools.exe") # Install R From b973b7d14f20c444f4c5e10896884c5ea93c1d1a Mon Sep 17 00:00:00 2001 From: James Lamb Date: Sat, 21 Mar 2020 17:28:32 -0500 Subject: [PATCH 07/87] added a lot more printing --- .ci/test_windows.ps1 | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/.ci/test_windows.ps1 b/.ci/test_windows.ps1 index 336248759008..f6003905ef08 100644 --- a/.ci/test_windows.ps1 +++ b/.ci/test_windows.ps1 @@ -72,20 +72,28 @@ if ($env:TASK -eq "r-package"){ # set up R if it doesn't exist yet if (!(Get-Command R.exe -errorAction SilentlyContinue)) { + Write-Output "Downloading R and Rtools" + # download R and RTools (New-Object System.Net.WebClient).DownloadFile("https://cloud.r-project.org/bin/windows/base/old/$env:R_WINDOWS_VERSION/R-$env:R_WINDOWS_VERSION-win.exe", "R-win.exe") (New-Object System.Net.WebClient).DownloadFile("https://cloud.r-project.org/bin/windows/Rtools/Rtools35.exe", "Rtools.exe") # Install R - Start-Process -FilePath .\R-win.exe -NoNewWindow -Wait -ArgumentList "/VERYSILENT /DIR=$env:R_LIB_PATH\R /COMPONENTS=main,x64" - Start-Process -FilePath .\Rtools.exe -NoNewWindow -Wait -ArgumentList "/VERYSILENT /DIR=$env:R_LIB_PATH\Rtools" + 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 "Installing Rtools" + Start-Process -FilePath Rtools.exe -NoNewWindow -Wait -ArgumentList "/VERYSILENT /DIR=$env:R_LIB_PATH\Rtools" ; Check-Output $? # download Miktex + Write-Output "Downloading miktex" (New-Object System.Net.WebClient).DownloadFile("https://miktex.org/download/win/miktexsetup-x64.zip", "miktexsetup-x64.zip") Add-Type -AssemblyName System.IO.Compression.FileSystem [System.IO.Compression.ZipFile]::ExtractToDirectory("miktexsetup-x64.zip", "miktex") - .\miktex\miktexsetup.exe --local-package-repository=.\miktex\download --package-set=essential --quiet download - .\miktex\download\miktexsetup.exe --portable="$env:R_LIB_PATH\miktex" --quiet install + Write-Output "Installing Miktex" + .\miktex\miktexsetup.exe --local-package-repository=.\miktex\download --package-set=essential --quiet download ; Check-Output $? + .\miktex\download\miktexsetup.exe --portable="$env:R_LIB_PATH\miktex" --quiet install ; Check-Output $? + Write-Output "Done installing all the stuff" } initexmf --set-config-value [MPM]AutoInstall=1 @@ -96,14 +104,17 @@ if ($env:TASK -eq "r-package"){ Add-Content .Rprofile "options(pkgType = 'binary')" Add-Content .Rprofile "options(install.packages.check.source = 'no')" - Rscript -e "install.packes(c('data.table', 'jsonlite', 'Matrix', 'R6', 'testthat'), dependencies = c('Imports', 'Depends', 'LinkingTo'))" ; Check-Output $? + Write-Output "Installing dependencies" + Rscript.exe -e "install.packes(c('data.table', 'jsonlite', 'Matrix', 'R6', 'testthat'), dependencies = c('Imports', 'Depends', 'LinkingTo'))" ; Check-Output $? - Rscript build_r.R ; Check-Output $? + Write-Output "Building R package" + Rscript.exe build_r.R ; Check-Output $? $PKG_FILE_NAME = Get-Item *.tar.gz $PKG_NAME = $PKG_FILE_NAME.BaseName.split("_")[0] $LOG_FILE_NAME = "$PKG_NAME.Rcheck/00check.log" + Write-Output "Running R CMD check" R.exe CMD check "${PKG_FILE_NAME}" --as-cran --no-multiarch; Check-Output $? if (Get-Content "$LOG_FILE_NAME" | Select-String -Pattern "WARNING" -Quiet) { From a8873f636fa85b55cdb1720bc1354fd049c1f7bd Mon Sep 17 00:00:00 2001 From: James Lamb Date: Sat, 21 Mar 2020 17:41:18 -0500 Subject: [PATCH 08/87] fixing paths --- .ci/test_windows.ps1 | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/.ci/test_windows.ps1 b/.ci/test_windows.ps1 index f6003905ef08..9e3a28d9b150 100644 --- a/.ci/test_windows.ps1 +++ b/.ci/test_windows.ps1 @@ -61,12 +61,15 @@ if ($env:TASK -eq "regular") { if ($env:TASK -eq "r-package"){ # Import-CliXml .\env-vars.clixml | % { Set-Item "env:$($_.Name)" $_.Value } - $env:R_LIB_PATH = "C:/Program Files" + $env:R_LIB_PATH = "C:/Program Files/R" + Write-Output "R_LIB_PATH: $env:R_LIB_PATH" tzutil /s "GMT Standard Time" [Void][System.IO.Directory]::CreateDirectory($env:R_LIB_PATH) $env:PATH = "$env:R_LIB_PATH\Rtools\bin;" + "$env:R_LIB_PATH\R\bin\x64;" + "$env:R_LIB_PATH\miktex\texmfs\install\miktex\bin\x64;" + $env:PATH + Write-Output "PATH: $env:PATH" + Check-Output $False $env:BINPREF = "C:/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/bin/" # set up R if it doesn't exist yet @@ -81,19 +84,22 @@ if ($env:TASK -eq "r-package"){ # 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=$env:R_LIB_PATH\Rtools" ; Check-Output $? + Write-Output "Done installing Rtools" # download Miktex - Write-Output "Downloading miktex" + Write-Output "Downloading MiKTeX" (New-Object System.Net.WebClient).DownloadFile("https://miktex.org/download/win/miktexsetup-x64.zip", "miktexsetup-x64.zip") Add-Type -AssemblyName System.IO.Compression.FileSystem [System.IO.Compression.ZipFile]::ExtractToDirectory("miktexsetup-x64.zip", "miktex") - Write-Output "Installing Miktex" + Write-Output "Setting up MiKTeX" .\miktex\miktexsetup.exe --local-package-repository=.\miktex\download --package-set=essential --quiet download ; Check-Output $? + Write-Output "Installing MiKTeX" .\miktex\download\miktexsetup.exe --portable="$env:R_LIB_PATH\miktex" --quiet install ; Check-Output $? - Write-Output "Done installing all the stuff" + Write-Output "Done installing R, Rtools, and MiKTeX" } initexmf --set-config-value [MPM]AutoInstall=1 @@ -105,7 +111,7 @@ if ($env:TASK -eq "r-package"){ Add-Content .Rprofile "options(install.packages.check.source = 'no')" Write-Output "Installing dependencies" - Rscript.exe -e "install.packes(c('data.table', 'jsonlite', 'Matrix', 'R6', 'testthat'), dependencies = c('Imports', 'Depends', 'LinkingTo'))" ; Check-Output $? + $env:R_LIB_PATH\Rscript.exe -e "install.packes(c('data.table', 'jsonlite', 'Matrix', 'R6', 'testthat'), dependencies = c('Imports', 'Depends', 'LinkingTo'))" ; Check-Output $? Write-Output "Building R package" Rscript.exe build_r.R ; Check-Output $? From 952ca55057b46428a1fec94cf5043cb72575ba7e Mon Sep 17 00:00:00 2001 From: James Lamb Date: Sat, 21 Mar 2020 17:44:58 -0500 Subject: [PATCH 09/87] more stuff --- .ci/test_windows.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/test_windows.ps1 b/.ci/test_windows.ps1 index 9e3a28d9b150..3ce5de045f25 100644 --- a/.ci/test_windows.ps1 +++ b/.ci/test_windows.ps1 @@ -111,7 +111,7 @@ if ($env:TASK -eq "r-package"){ Add-Content .Rprofile "options(install.packages.check.source = 'no')" Write-Output "Installing dependencies" - $env:R_LIB_PATH\Rscript.exe -e "install.packes(c('data.table', 'jsonlite', 'Matrix', 'R6', 'testthat'), dependencies = c('Imports', 'Depends', 'LinkingTo'))" ; Check-Output $? + Rscript.exe -e "install.packes(c('data.table', 'jsonlite', 'Matrix', 'R6', 'testthat'), dependencies = c('Imports', 'Depends', 'LinkingTo'))" ; Check-Output $? Write-Output "Building R package" Rscript.exe build_r.R ; Check-Output $? From b4cf3980ccd2d54ee5bcb3f89f56de4992b2cf7e Mon Sep 17 00:00:00 2001 From: James Lamb Date: Sat, 21 Mar 2020 17:49:52 -0500 Subject: [PATCH 10/87] fixed paths --- .ci/test_windows.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/test_windows.ps1 b/.ci/test_windows.ps1 index 3ce5de045f25..ddde64588835 100644 --- a/.ci/test_windows.ps1 +++ b/.ci/test_windows.ps1 @@ -61,7 +61,7 @@ if ($env:TASK -eq "regular") { if ($env:TASK -eq "r-package"){ # Import-CliXml .\env-vars.clixml | % { Set-Item "env:$($_.Name)" $_.Value } - $env:R_LIB_PATH = "C:/Program Files/R" + $env:R_LIB_PATH = "C:\Program Files" Write-Output "R_LIB_PATH: $env:R_LIB_PATH" tzutil /s "GMT Standard Time" From cc6d02ba0977fab52168596d1c2bbb3875a767ed Mon Sep 17 00:00:00 2001 From: James Lamb Date: Sat, 21 Mar 2020 17:50:42 -0500 Subject: [PATCH 11/87] more stuff --- .ci/test_windows.ps1 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.ci/test_windows.ps1 b/.ci/test_windows.ps1 index ddde64588835..b8eb0b218c0f 100644 --- a/.ci/test_windows.ps1 +++ b/.ci/test_windows.ps1 @@ -69,7 +69,6 @@ if ($env:TASK -eq "r-package"){ $env:PATH = "$env:R_LIB_PATH\Rtools\bin;" + "$env:R_LIB_PATH\R\bin\x64;" + "$env:R_LIB_PATH\miktex\texmfs\install\miktex\bin\x64;" + $env:PATH Write-Output "PATH: $env:PATH" - Check-Output $False $env:BINPREF = "C:/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/bin/" # set up R if it doesn't exist yet @@ -90,6 +89,9 @@ if ($env:TASK -eq "r-package"){ Start-Process -FilePath Rtools.exe -NoNewWindow -Wait -ArgumentList "/VERYSILENT /DIR=$env:R_LIB_PATH\Rtools" ; Check-Output $? Write-Output "Done installing Rtools" + Rscript.exe -e "cat('libberty bibberty')" + Check-Output $False + # download Miktex Write-Output "Downloading MiKTeX" (New-Object System.Net.WebClient).DownloadFile("https://miktex.org/download/win/miktexsetup-x64.zip", "miktexsetup-x64.zip") From adfb832fd215cabc9ed20b4fbe3fc944ae7a5bc5 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Sat, 21 Mar 2020 17:59:14 -0500 Subject: [PATCH 12/87] more path guessing --- .ci/test_windows.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/test_windows.ps1 b/.ci/test_windows.ps1 index b8eb0b218c0f..c2a1c0d44855 100644 --- a/.ci/test_windows.ps1 +++ b/.ci/test_windows.ps1 @@ -67,7 +67,7 @@ if ($env:TASK -eq "r-package"){ tzutil /s "GMT Standard Time" [Void][System.IO.Directory]::CreateDirectory($env:R_LIB_PATH) - $env:PATH = "$env:R_LIB_PATH\Rtools\bin;" + "$env:R_LIB_PATH\R\bin\x64;" + "$env:R_LIB_PATH\miktex\texmfs\install\miktex\bin\x64;" + $env:PATH + $env:PATH = "$env:R_LIB_PATH\Rtools\bin;" + "$env:R_LIB_PATH\R\bin\x64;" + "$env:R_LIB_PATH\R\R-$env:R_WINDOWS_VERSION\bin\x64;" + "$env:R_LIB_PATH\miktex\texmfs\install\miktex\bin\x64;" + $env:PATH Write-Output "PATH: $env:PATH" $env:BINPREF = "C:/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/bin/" From 92b00322babe7c655ca2b8b548a173ba9fe3f87e Mon Sep 17 00:00:00 2001 From: James Lamb Date: Sat, 21 Mar 2020 19:08:32 -0500 Subject: [PATCH 13/87] even more paths --- .ci/test_windows.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/test_windows.ps1 b/.ci/test_windows.ps1 index c2a1c0d44855..9b3af4c4688b 100644 --- a/.ci/test_windows.ps1 +++ b/.ci/test_windows.ps1 @@ -67,7 +67,7 @@ if ($env:TASK -eq "r-package"){ tzutil /s "GMT Standard Time" [Void][System.IO.Directory]::CreateDirectory($env:R_LIB_PATH) - $env:PATH = "$env:R_LIB_PATH\Rtools\bin;" + "$env:R_LIB_PATH\R\bin\x64;" + "$env:R_LIB_PATH\R\R-$env:R_WINDOWS_VERSION\bin\x64;" + "$env:R_LIB_PATH\miktex\texmfs\install\miktex\bin\x64;" + $env:PATH + $env:PATH = "$env:R_LIB_PATH\Rtools\bin;" + "$env:R_LIB_PATH\R\bin\x64;" + "$env:R_LIB_PATH\R\R-$env:R_WINDOWS_VERSION\bin\x64;" + "$env:R_LIB_PATH\R\R-$env:R_WINDOWS_VERSION\bin;" + "$env:R_LIB_PATH\miktex\texmfs\install\miktex\bin\x64;" + $env:PATH Write-Output "PATH: $env:PATH" $env:BINPREF = "C:/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/bin/" From 8d77941efb87c3172ac790a639b596deedf16fd6 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Sat, 21 Mar 2020 19:16:35 -0500 Subject: [PATCH 14/87] more stuff --- .ci/test_windows.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/test_windows.ps1 b/.ci/test_windows.ps1 index 9b3af4c4688b..0cb05bc3c231 100644 --- a/.ci/test_windows.ps1 +++ b/.ci/test_windows.ps1 @@ -67,7 +67,7 @@ if ($env:TASK -eq "r-package"){ tzutil /s "GMT Standard Time" [Void][System.IO.Directory]::CreateDirectory($env:R_LIB_PATH) - $env:PATH = "$env:R_LIB_PATH\Rtools\bin;" + "$env:R_LIB_PATH\R\bin\x64;" + "$env:R_LIB_PATH\R\R-$env:R_WINDOWS_VERSION\bin\x64;" + "$env:R_LIB_PATH\R\R-$env:R_WINDOWS_VERSION\bin;" + "$env:R_LIB_PATH\miktex\texmfs\install\miktex\bin\x64;" + $env:PATH + $env:PATH = "$env:R_LIB_PATH\Rtools\bin;" + "$env:R_LIB_PATH\R\R\bin\x64;" + "$env:R_LIB_PATH\R\R\R-$env:R_WINDOWS_VERSION\bin\x64;" + "$env:R_LIB_PATH\R\R\R-$env:R_WINDOWS_VERSION\bin;" + "$env:R_LIB_PATH\miktex\texmfs\install\miktex\bin\x64;" + $env:PATH Write-Output "PATH: $env:PATH" $env:BINPREF = "C:/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/bin/" From b7e2abe789984d6e39af0c272357acfd57052b87 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Sat, 21 Mar 2020 19:20:14 -0500 Subject: [PATCH 15/87] moar logz --- .ci/test_windows.ps1 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.ci/test_windows.ps1 b/.ci/test_windows.ps1 index 0cb05bc3c231..b47a6df39e07 100644 --- a/.ci/test_windows.ps1 +++ b/.ci/test_windows.ps1 @@ -82,11 +82,13 @@ if ($env:TASK -eq "r-package"){ # 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 $? + Start-Process -FilePath R-win.exe -NoNewWindow -Wait -ArgumentList "/DIR=$env:R_LIB_PATH\R /COMPONENTS=main,x64" ; Check-Output $? + #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=$env:R_LIB_PATH\Rtools" ; Check-Output $? + Start-Process -FilePath Rtools.exe -NoNewWindow -Wait -ArgumentList "/DIR=$env:R_LIB_PATH\Rtools" ; Check-Output $? + #Start-Process -FilePath Rtools.exe -NoNewWindow -Wait -ArgumentList "/VERYSILENT /DIR=$env:R_LIB_PATH\Rtools" ; Check-Output $? Write-Output "Done installing Rtools" Rscript.exe -e "cat('libberty bibberty')" From 12fb638f92ae1ddbba7b2e91ec0aaaded6d1b72d Mon Sep 17 00:00:00 2001 From: James Lamb Date: Sat, 21 Mar 2020 19:37:58 -0500 Subject: [PATCH 16/87] and now for something totally different --- .ci/test_windows.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.ci/test_windows.ps1 b/.ci/test_windows.ps1 index b47a6df39e07..5e78693c996a 100644 --- a/.ci/test_windows.ps1 +++ b/.ci/test_windows.ps1 @@ -67,7 +67,7 @@ if ($env:TASK -eq "r-package"){ tzutil /s "GMT Standard Time" [Void][System.IO.Directory]::CreateDirectory($env:R_LIB_PATH) - $env:PATH = "$env:R_LIB_PATH\Rtools\bin;" + "$env:R_LIB_PATH\R\R\bin\x64;" + "$env:R_LIB_PATH\R\R\R-$env:R_WINDOWS_VERSION\bin\x64;" + "$env:R_LIB_PATH\R\R\R-$env:R_WINDOWS_VERSION\bin;" + "$env:R_LIB_PATH\miktex\texmfs\install\miktex\bin\x64;" + $env:PATH + $env:PATH = "$env:R_LIB_PATH\Rtools\bin;" + "$env:R_LIB_PATH\R\bin\x64;" + "$env:R_LIB_PATH\R\R-$env:R_WINDOWS_VERSION\bin\x64;" + "$env:R_LIB_PATH\R\R-$env:R_WINDOWS_VERSION\bin;" + "$env:R_LIB_PATH\miktex\texmfs\install\miktex\bin\x64;" + $env:PATH Write-Output "PATH: $env:PATH" $env:BINPREF = "C:/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/bin/" @@ -91,7 +91,7 @@ if ($env:TASK -eq "r-package"){ #Start-Process -FilePath Rtools.exe -NoNewWindow -Wait -ArgumentList "/VERYSILENT /DIR=$env:R_LIB_PATH\Rtools" ; Check-Output $? Write-Output "Done installing Rtools" - Rscript.exe -e "cat('libberty bibberty')" + Rscript -e "cat('libberty bibberty')" Check-Output $False # download Miktex From 109150465875a9a0ef1b52a155a2ef4e349dd11e Mon Sep 17 00:00:00 2001 From: James Lamb Date: Sat, 21 Mar 2020 19:40:58 -0500 Subject: [PATCH 17/87] please work --- .ci/test_windows.ps1 | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.ci/test_windows.ps1 b/.ci/test_windows.ps1 index 5e78693c996a..597207aa7263 100644 --- a/.ci/test_windows.ps1 +++ b/.ci/test_windows.ps1 @@ -82,13 +82,11 @@ if ($env:TASK -eq "r-package"){ # Install R Write-Output "Installing R" - Start-Process -FilePath R-win.exe -NoNewWindow -Wait -ArgumentList "/DIR=$env:R_LIB_PATH\R /COMPONENTS=main,x64" ; Check-Output $? - #Start-Process -FilePath R-win.exe -NoNewWindow -Wait -ArgumentList "/VERYSILENT /DIR=$env:R_LIB_PATH\R /COMPONENTS=main,x64" ; Check-Output $? + 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 "/DIR=$env:R_LIB_PATH\Rtools" ; Check-Output $? - #Start-Process -FilePath Rtools.exe -NoNewWindow -Wait -ArgumentList "/VERYSILENT /DIR=$env:R_LIB_PATH\Rtools" ; Check-Output $? + Start-Process -FilePath Rtools.exe -NoNewWindow -Wait -ArgumentList "/VERYSILENT /DIR=$env:R_LIB_PATH\Rtools" ; Check-Output $? Write-Output "Done installing Rtools" Rscript -e "cat('libberty bibberty')" From 96dcc18b094c90d074c7fc262e83e6c764378cff Mon Sep 17 00:00:00 2001 From: James Lamb Date: Sat, 21 Mar 2020 20:41:42 -0500 Subject: [PATCH 18/87] ok could be a thing --- .appveyor.yml | 3 ++- .ci/test_windows.ps1 | 9 ++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index f92bc77161c0..f39f3e604054 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -59,4 +59,5 @@ test_script: # - cd %APPVEYOR_BUILD_FOLDER%\examples\python-guide\notebooks # - conda install -q -y -n test-env ipywidgets notebook # - jupyter nbconvert --ExecutePreprocessor.timeout=180 --to notebook --execute --inplace *.ipynb # run all notebooks - - cmd /c "powershell -ExecutionPolicy Bypass -File %APPVEYOR_BUILD_FOLDER%\.ci\test_windows.ps1" + #- cmd /c "powershell -ExecutionPolicy Bypass -File %APPVEYOR_BUILD_FOLDER%\.ci\test_windows.ps1" + - powershell.exe -ExecutionPolicy Bypass -File .\.ci\test_windows.ps1 diff --git a/.ci/test_windows.ps1 b/.ci/test_windows.ps1 index 597207aa7263..5616fd8563d9 100644 --- a/.ci/test_windows.ps1 +++ b/.ci/test_windows.ps1 @@ -60,14 +60,17 @@ if ($env:TASK -eq "regular") { # based on https://github.com/RGF-team/rgf/blob/master/R-package/.R.appveyor.ps1 if ($env:TASK -eq "r-package"){ - # Import-CliXml .\env-vars.clixml | % { Set-Item "env:$($_.Name)" $_.Value } - $env:R_LIB_PATH = "C:\Program Files" + #Get-ChildItem env: | Export-CliXml ./env-vars.clixml + #Import-CliXml .\env-vars.clixml | % { Set-Item "env:$($_.Name)" $_.Value } + $env:R_LIB_PATH = "C:\RLibrary" Write-Output "R_LIB_PATH: $env:R_LIB_PATH" tzutil /s "GMT Standard Time" + cd $env:APPVEYOR_BUILD_FOLDER [Void][System.IO.Directory]::CreateDirectory($env:R_LIB_PATH) - $env:PATH = "$env:R_LIB_PATH\Rtools\bin;" + "$env:R_LIB_PATH\R\bin\x64;" + "$env:R_LIB_PATH\R\R-$env:R_WINDOWS_VERSION\bin\x64;" + "$env:R_LIB_PATH\R\R-$env:R_WINDOWS_VERSION\bin;" + "$env:R_LIB_PATH\miktex\texmfs\install\miktex\bin\x64;" + $env:PATH + #$env:PATH = "$env:R_LIB_PATH\Rtools\bin;" + "$env:R_LIB_PATH\R\bin\x64;" + "$env:R_LIB_PATH\R\R-$env:R_WINDOWS_VERSION\bin\x64;" + "$env:R_LIB_PATH\R\R-$env:R_WINDOWS_VERSION\bin;" + "$env:R_LIB_PATH\miktex\texmfs\install\miktex\bin\x64;" + $env:PATH + $env:PATH = "$env:R_LIB_PATH\Rtools\bin;" + "$env:R_LIB_PATH\R\bin\x64;" + "$env:R_LIB_PATH\miktex\texmfs\install\miktex\bin\x64;" + $env:PATH Write-Output "PATH: $env:PATH" $env:BINPREF = "C:/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/bin/" From 97d9913704744697af0aaef083322dcfedc8c475 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Sat, 21 Mar 2020 20:43:44 -0500 Subject: [PATCH 19/87] changing directories --- .appveyor.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.appveyor.yml b/.appveyor.yml index f39f3e604054..c12c434fdc99 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -60,4 +60,5 @@ test_script: # - conda install -q -y -n test-env ipywidgets notebook # - jupyter nbconvert --ExecutePreprocessor.timeout=180 --to notebook --execute --inplace *.ipynb # run all notebooks #- cmd /c "powershell -ExecutionPolicy Bypass -File %APPVEYOR_BUILD_FOLDER%\.ci\test_windows.ps1" + - cd %APPVEYOR_BUILD_FOLDER% - powershell.exe -ExecutionPolicy Bypass -File .\.ci\test_windows.ps1 From 6ed498d6f215f60031b9fcd82cb4bba92c10efa7 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Sat, 21 Mar 2020 20:47:28 -0500 Subject: [PATCH 20/87] we might be in business --- .ci/test_windows.ps1 | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.ci/test_windows.ps1 b/.ci/test_windows.ps1 index 5616fd8563d9..7df9486607c3 100644 --- a/.ci/test_windows.ps1 +++ b/.ci/test_windows.ps1 @@ -92,9 +92,6 @@ if ($env:TASK -eq "r-package"){ Start-Process -FilePath Rtools.exe -NoNewWindow -Wait -ArgumentList "/VERYSILENT /DIR=$env:R_LIB_PATH\Rtools" ; Check-Output $? Write-Output "Done installing Rtools" - Rscript -e "cat('libberty bibberty')" - Check-Output $False - # download Miktex Write-Output "Downloading MiKTeX" (New-Object System.Net.WebClient).DownloadFile("https://miktex.org/download/win/miktexsetup-x64.zip", "miktexsetup-x64.zip") @@ -119,7 +116,7 @@ if ($env:TASK -eq "r-package"){ Rscript.exe -e "install.packes(c('data.table', 'jsonlite', 'Matrix', 'R6', 'testthat'), dependencies = c('Imports', 'Depends', 'LinkingTo'))" ; Check-Output $? Write-Output "Building R package" - Rscript.exe build_r.R ; Check-Output $? + Rscript build_r.R ; Check-Output $? $PKG_FILE_NAME = Get-Item *.tar.gz $PKG_NAME = $PKG_FILE_NAME.BaseName.split("_")[0] From b275d227ee9d8f85393bac8f665557dd3a0d184d Mon Sep 17 00:00:00 2001 From: James Lamb Date: Sat, 21 Mar 2020 20:52:47 -0500 Subject: [PATCH 21/87] fixed install syntax --- .ci/test_windows.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/test_windows.ps1 b/.ci/test_windows.ps1 index 7df9486607c3..998fb7a2aa90 100644 --- a/.ci/test_windows.ps1 +++ b/.ci/test_windows.ps1 @@ -113,7 +113,7 @@ if ($env:TASK -eq "r-package"){ Add-Content .Rprofile "options(install.packages.check.source = 'no')" Write-Output "Installing dependencies" - Rscript.exe -e "install.packes(c('data.table', 'jsonlite', 'Matrix', 'R6', 'testthat'), dependencies = c('Imports', 'Depends', 'LinkingTo'))" ; Check-Output $? + Rscript.exe -e "install.packages(c('data.table', 'jsonlite', 'Matrix', 'R6', 'testthat'), dependencies = c('Imports', 'Depends', 'LinkingTo'))" ; Check-Output $? Write-Output "Building R package" Rscript build_r.R ; Check-Output $? From f701325c217e0169abeeac799d1b0a5a18dca2b1 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Sat, 21 Mar 2020 21:08:08 -0500 Subject: [PATCH 22/87] tryinv mingw --- .appveyor.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index c12c434fdc99..69bbc97c1557 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -7,12 +7,12 @@ configuration: # a trick to construct a build matrix with multiple Python versi environment: matrix: - - COMPILER: MSVC - TASK: r-package - R_WINDOWS_VERSION: 3.6.1 - # - COMPILER: MINGW + # - COMPILER: MSVC # TASK: r-package # R_WINDOWS_VERSION: 3.6.1 + - COMPILER: MINGW + TASK: r-package + R_WINDOWS_VERSION: 3.6.1 clone_depth: 5 From 618086adf723c54bb7f0a71e89029de9d7d6645d Mon Sep 17 00:00:00 2001 From: James Lamb Date: Sat, 21 Mar 2020 21:20:38 -0500 Subject: [PATCH 23/87] more mingw --- R-package/src/install.libs.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R-package/src/install.libs.R b/R-package/src/install.libs.R index a79c93d846b7..f974cff97f0c 100644 --- a/R-package/src/install.libs.R +++ b/R-package/src/install.libs.R @@ -1,7 +1,7 @@ # User options use_precompile <- FALSE use_gpu <- FALSE -use_mingw <- FALSE +use_mingw <- TRUE if (.Machine$sizeof.pointer != 8L) { stop("LightGBM only supports 64-bit R, please check the version of R and Rtools.") From 90f91e5d43d6058fb520bc0f98b2ef70b8831b8a Mon Sep 17 00:00:00 2001 From: James Lamb Date: Sat, 21 Mar 2020 21:31:45 -0500 Subject: [PATCH 24/87] ignore Suggests check --- .ci/test_windows.ps1 | 1 + 1 file changed, 1 insertion(+) diff --git a/.ci/test_windows.ps1 b/.ci/test_windows.ps1 index 998fb7a2aa90..bc4903111d2b 100644 --- a/.ci/test_windows.ps1 +++ b/.ci/test_windows.ps1 @@ -123,6 +123,7 @@ if ($env:TASK -eq "r-package"){ $LOG_FILE_NAME = "$PKG_NAME.Rcheck/00check.log" Write-Output "Running R CMD check" + $env:_R_CHECK_FORCE_SUGGESTS_=0 R.exe CMD check "${PKG_FILE_NAME}" --as-cran --no-multiarch; Check-Output $? if (Get-Content "$LOG_FILE_NAME" | Select-String -Pattern "WARNING" -Quiet) { From 2f4979abfa2a2b9f8582e0f8e2ed2557822df028 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Sat, 21 Mar 2020 22:25:51 -0500 Subject: [PATCH 25/87] trying Azure DevOps --- .vsts-ci.yml | 48 ------------------------------------------------ 1 file changed, 48 deletions(-) diff --git a/.vsts-ci.yml b/.vsts-ci.yml index b32d58b7f372..d31ad7c240db 100644 --- a/.vsts-ci.yml +++ b/.vsts-ci.yml @@ -144,51 +144,3 @@ jobs: pathtoPublish: '$(Build.ArtifactStagingDirectory)' artifactName: PackageAssets artifactType: container - -########################################### -- job: Package -########################################### - dependsOn: - - Linux - - MacOS - - Windows - condition: and(succeeded(), not(startsWith(variables['Build.SourceBranch'], 'refs/pull/'))) - pool: - vmImage: 'vs2017-win2016' - steps: - # Download all agent packages from all previous phases - - task: DownloadBuildArtifacts@0 - displayName: Download package assets - inputs: - artifactName: PackageAssets - downloadPath: $(Build.SourcesDirectory)/binaries - - script: | - python %BUILD_SOURCESDIRECTORY%/.nuget/create_nuget.py %BUILD_SOURCESDIRECTORY%/binaries/PackageAssets - displayName: 'Create NuGet configuration files' - - task: NuGetCommand@2 - inputs: - command: pack - packagesToPack: '$(Build.SourcesDirectory)/.nuget/*.nuspec' - packDestination: '$(Build.ArtifactStagingDirectory)' - - task: PublishBuildArtifacts@1 - inputs: - pathtoPublish: '$(Build.ArtifactStagingDirectory)' - artifactName: NuGet - artifactType: container - - task: GitHubRelease@0 - displayName: 'Create GitHub Release' - condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/v')) - inputs: - gitHubConnection: guolinke - repositoryName: '$(Build.Repository.Name)' - action: 'create' - target: '$(Build.SourceVersion)' - tagSource: 'auto' - title: '$(Build.SourceBranchName)' - assets: | - $(Build.SourcesDirectory)/binaries/PackageAssets/* - $(Build.ArtifactStagingDirectory)/*.nupkg - assetUploadMode: 'delete' - isDraft: true - isPreRelease: false - addChangeLog: false From 3b07c7bf4aaefcce7a21e179b48d0fa4d2df8b6d Mon Sep 17 00:00:00 2001 From: James Lamb Date: Sat, 21 Mar 2020 22:31:00 -0500 Subject: [PATCH 26/87] just run bare minimum for Azure DevOps --- .vsts-ci.yml | 70 ++++++++++++++++++++++++++-------------------------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/.vsts-ci.yml b/.vsts-ci.yml index d31ad7c240db..fc55a9919229 100644 --- a/.vsts-ci.yml +++ b/.vsts-ci.yml @@ -24,24 +24,24 @@ jobs: strategy: maxParallel: 6 matrix: - regular: - TASK: regular - sdist: - TASK: sdist - PYTHON_VERSION: 3.5 - bdist: - TASK: bdist - PYTHON_VERSION: 3.6 - inference: - TASK: if-else - mpi_source: - TASK: mpi - METHOD: source - PYTHON_VERSION: 2.7 - gpu_source: - TASK: gpu - METHOD: source - PYTHON_VERSION: 3.6 + # regular: + # TASK: regular + # sdist: + # TASK: sdist + # PYTHON_VERSION: 3.5 + # bdist: + # TASK: bdist + # PYTHON_VERSION: 3.6 + # inference: + # TASK: if-else + # mpi_source: + # TASK: mpi + # METHOD: source + # PYTHON_VERSION: 2.7 + # gpu_source: + # TASK: gpu + # METHOD: source + # PYTHON_VERSION: 3.6 r_package: TASK: r-package steps: @@ -78,14 +78,14 @@ jobs: strategy: maxParallel: 3 matrix: - regular: - TASK: regular - PYTHON_VERSION: 3.6 - sdist: - TASK: sdist - PYTHON_VERSION: 3.5 - bdist: - TASK: bdist + # regular: + # TASK: regular + # PYTHON_VERSION: 3.6 + # sdist: + # TASK: sdist + # PYTHON_VERSION: 3.5 + # bdist: + # TASK: bdist r_package: TASK: r-package steps: @@ -119,15 +119,15 @@ jobs: strategy: maxParallel: 3 matrix: - regular: - TASK: regular - PYTHON_VERSION: 3.7 - sdist: - TASK: sdist - PYTHON_VERSION: 2.7 - bdist: - TASK: bdist - PYTHON_VERSION: 3.5 + # regular: + # TASK: regular + # PYTHON_VERSION: 3.7 + # sdist: + # TASK: sdist + # PYTHON_VERSION: 2.7 + # bdist: + # TASK: bdist + # PYTHON_VERSION: 3.5 rpkg: TASK: r-package R_WINDOWS_VERSION: 3.6.1 From 2d17caed7189230cb6e7d664d4a3a1a3428447d4 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Sat, 21 Mar 2020 22:59:05 -0500 Subject: [PATCH 27/87] fixed build dir thing --- .ci/test_windows.ps1 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.ci/test_windows.ps1 b/.ci/test_windows.ps1 index bc4903111d2b..798036349766 100644 --- a/.ci/test_windows.ps1 +++ b/.ci/test_windows.ps1 @@ -65,8 +65,12 @@ if ($env:TASK -eq "r-package"){ $env:R_LIB_PATH = "C:\RLibrary" Write-Output "R_LIB_PATH: $env:R_LIB_PATH" + if (Test-Path env:APPVEYOR) { + cd $env:APPVEYOR_BUILD_FOLDER + } + tzutil /s "GMT Standard Time" - cd $env:APPVEYOR_BUILD_FOLDER + [Void][System.IO.Directory]::CreateDirectory($env:R_LIB_PATH) #$env:PATH = "$env:R_LIB_PATH\Rtools\bin;" + "$env:R_LIB_PATH\R\bin\x64;" + "$env:R_LIB_PATH\R\R-$env:R_WINDOWS_VERSION\bin\x64;" + "$env:R_LIB_PATH\R\R-$env:R_WINDOWS_VERSION\bin;" + "$env:R_LIB_PATH\miktex\texmfs\install\miktex\bin\x64;" + $env:PATH From 2e9fe09b10465d938e9dee84d0611e5655e88d11 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Sat, 21 Mar 2020 23:17:11 -0500 Subject: [PATCH 28/87] trying to set libPaths --- .ci/test_windows.ps1 | 1 + 1 file changed, 1 insertion(+) diff --git a/.ci/test_windows.ps1 b/.ci/test_windows.ps1 index 798036349766..8d4c2f93e626 100644 --- a/.ci/test_windows.ps1 +++ b/.ci/test_windows.ps1 @@ -63,6 +63,7 @@ if ($env:TASK -eq "r-package"){ #Get-ChildItem env: | Export-CliXml ./env-vars.clixml #Import-CliXml .\env-vars.clixml | % { Set-Item "env:$($_.Name)" $_.Value } $env:R_LIB_PATH = "C:\RLibrary" + $env:R_LIBS = "$env:R_LIB_PATH;" Write-Output "R_LIB_PATH: $env:R_LIB_PATH" if (Test-Path env:APPVEYOR) { From 855cdc96a8c3a6aa83150103747c7efdef1a2a06 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Sat, 21 Mar 2020 23:41:11 -0500 Subject: [PATCH 29/87] more testing --- .ci/test_windows.ps1 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.ci/test_windows.ps1 b/.ci/test_windows.ps1 index 8d4c2f93e626..51660c40da95 100644 --- a/.ci/test_windows.ps1 +++ b/.ci/test_windows.ps1 @@ -65,6 +65,7 @@ if ($env:TASK -eq "r-package"){ $env:R_LIB_PATH = "C:\RLibrary" $env:R_LIBS = "$env:R_LIB_PATH;" Write-Output "R_LIB_PATH: $env:R_LIB_PATH" + Write-Output "R_LIBS: $env:R_LIBS" if (Test-Path env:APPVEYOR) { cd $env:APPVEYOR_BUILD_FOLDER @@ -121,6 +122,9 @@ if ($env:TASK -eq "r-package"){ Rscript.exe -e "install.packages(c('data.table', 'jsonlite', 'Matrix', 'R6', 'testthat'), dependencies = c('Imports', 'Depends', 'LinkingTo'))" ; Check-Output $? Write-Output "Building R package" + Rscript --no-save -e "print(.libPaths())" + Rscript --no-save -e "print('loading R6'); library(R6)" + Rscript --no-save -e "print('R_LIBS'); print(Sys.getenv('R_LIBS'))" Rscript build_r.R ; Check-Output $? $PKG_FILE_NAME = Get-Item *.tar.gz From 6d8878be655c82076c67c87cbbc33cb2c759fb90 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Sat, 21 Mar 2020 23:54:28 -0500 Subject: [PATCH 30/87] trying R 3.6.3 --- .appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.appveyor.yml b/.appveyor.yml index 69bbc97c1557..5e88bbfc5aaf 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -12,7 +12,7 @@ environment: # R_WINDOWS_VERSION: 3.6.1 - COMPILER: MINGW TASK: r-package - R_WINDOWS_VERSION: 3.6.1 + R_WINDOWS_VERSION: 3.6.3 clone_depth: 5 From c854fe374822bf8e75203c2f2773c49f2e10e05f Mon Sep 17 00:00:00 2001 From: James Lamb Date: Sun, 22 Mar 2020 00:05:24 -0500 Subject: [PATCH 31/87] R 3.6.3 --- .ci/test_windows.ps1 | 3 --- .vsts-ci.yml | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/.ci/test_windows.ps1 b/.ci/test_windows.ps1 index 51660c40da95..1840ba4601b6 100644 --- a/.ci/test_windows.ps1 +++ b/.ci/test_windows.ps1 @@ -53,9 +53,6 @@ if ($env:TASK -eq "regular") { jupyter nbconvert --ExecutePreprocessor.timeout=180 --to notebook --execute --inplace *.ipynb ; Check-Output $? # run all notebooks } -# TODO: -# * https://cran.r-project.org/bin/windows/base/old/3.6.1/R-3.6.1-win.exe - # test R package # based on https://github.com/RGF-team/rgf/blob/master/R-package/.R.appveyor.ps1 if ($env:TASK -eq "r-package"){ diff --git a/.vsts-ci.yml b/.vsts-ci.yml index fc55a9919229..5e401e22b75f 100644 --- a/.vsts-ci.yml +++ b/.vsts-ci.yml @@ -130,7 +130,7 @@ jobs: # PYTHON_VERSION: 3.5 rpkg: TASK: r-package - R_WINDOWS_VERSION: 3.6.1 + R_WINDOWS_VERSION: 3.6.3 steps: - powershell: Write-Host "##vso[task.prependpath]$env:CONDA\Scripts" displayName: Enable conda From 86f4eec102fe0c405227acf0163939b1d3260c77 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Sun, 22 Mar 2020 10:28:06 -0500 Subject: [PATCH 32/87] this feels right --- .ci/test_windows.ps1 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.ci/test_windows.ps1 b/.ci/test_windows.ps1 index 1840ba4601b6..f65e1edeb3ec 100644 --- a/.ci/test_windows.ps1 +++ b/.ci/test_windows.ps1 @@ -116,9 +116,10 @@ if ($env:TASK -eq "r-package"){ Add-Content .Rprofile "options(install.packages.check.source = 'no')" Write-Output "Installing dependencies" - Rscript.exe -e "install.packages(c('data.table', 'jsonlite', 'Matrix', 'R6', 'testthat'), dependencies = c('Imports', 'Depends', 'LinkingTo'))" ; Check-Output $? + Rscript.exe -e "install.packages(c('data.table', 'jsonlite', 'Matrix', 'R6', 'testthat'), dependencies = c('Imports', 'Depends', 'LinkingTo'), lib = .libPaths())" ; Check-Output $? Write-Output "Building R package" + #Rscript.exe -e "install.packages('R6', pkgType = 'source')" Rscript --no-save -e "print(.libPaths())" Rscript --no-save -e "print('loading R6'); library(R6)" Rscript --no-save -e "print('R_LIBS'); print(Sys.getenv('R_LIBS'))" From 8b12858fc8a8d7873f23bf5b5fdc6e92174921cf Mon Sep 17 00:00:00 2001 From: James Lamb Date: Sun, 22 Mar 2020 10:53:42 -0500 Subject: [PATCH 33/87] still messing around with libraries --- .ci/test_windows.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.ci/test_windows.ps1 b/.ci/test_windows.ps1 index f65e1edeb3ec..61a364b2323e 100644 --- a/.ci/test_windows.ps1 +++ b/.ci/test_windows.ps1 @@ -60,7 +60,7 @@ if ($env:TASK -eq "r-package"){ #Get-ChildItem env: | Export-CliXml ./env-vars.clixml #Import-CliXml .\env-vars.clixml | % { Set-Item "env:$($_.Name)" $_.Value } $env:R_LIB_PATH = "C:\RLibrary" - $env:R_LIBS = "$env:R_LIB_PATH;" + $env:R_LIBS = "$env:R_LIB_PATH\R\library" Write-Output "R_LIB_PATH: $env:R_LIB_PATH" Write-Output "R_LIBS: $env:R_LIBS" @@ -116,7 +116,7 @@ if ($env:TASK -eq "r-package"){ Add-Content .Rprofile "options(install.packages.check.source = 'no')" Write-Output "Installing dependencies" - Rscript.exe -e "install.packages(c('data.table', 'jsonlite', 'Matrix', 'R6', 'testthat'), dependencies = c('Imports', 'Depends', 'LinkingTo'), lib = .libPaths())" ; Check-Output $? + Rscript.exe -e "install.packages(c('data.table', 'jsonlite', 'Matrix', 'R6', 'testthat'), dependencies = c('Imports', 'Depends', 'LinkingTo'), lib = '$env:R_LIBS')" ; Check-Output $? Write-Output "Building R package" #Rscript.exe -e "install.packages('R6', pkgType = 'source')" From dc50ad5df9224208fca97f90e6b391f3cb16d305 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Sun, 22 Mar 2020 11:02:06 -0500 Subject: [PATCH 34/87] more paths --- .ci/test_windows.ps1 | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.ci/test_windows.ps1 b/.ci/test_windows.ps1 index 61a364b2323e..54b323a33858 100644 --- a/.ci/test_windows.ps1 +++ b/.ci/test_windows.ps1 @@ -59,8 +59,8 @@ if ($env:TASK -eq "r-package"){ #Get-ChildItem env: | Export-CliXml ./env-vars.clixml #Import-CliXml .\env-vars.clixml | % { Set-Item "env:$($_.Name)" $_.Value } - $env:R_LIB_PATH = "C:\RLibrary" - $env:R_LIBS = "$env:R_LIB_PATH\R\library" + $env:R_LIB_PATH = "C:/RLibrary" + $env:R_LIBS = "$env:R_LIB_PATH/R/library" Write-Output "R_LIB_PATH: $env:R_LIB_PATH" Write-Output "R_LIBS: $env:R_LIBS" @@ -73,7 +73,7 @@ if ($env:TASK -eq "r-package"){ [Void][System.IO.Directory]::CreateDirectory($env:R_LIB_PATH) #$env:PATH = "$env:R_LIB_PATH\Rtools\bin;" + "$env:R_LIB_PATH\R\bin\x64;" + "$env:R_LIB_PATH\R\R-$env:R_WINDOWS_VERSION\bin\x64;" + "$env:R_LIB_PATH\R\R-$env:R_WINDOWS_VERSION\bin;" + "$env:R_LIB_PATH\miktex\texmfs\install\miktex\bin\x64;" + $env:PATH - $env:PATH = "$env:R_LIB_PATH\Rtools\bin;" + "$env:R_LIB_PATH\R\bin\x64;" + "$env:R_LIB_PATH\miktex\texmfs\install\miktex\bin\x64;" + $env:PATH + $env:PATH = "$env:R_LIB_PATH/Rtools/bin;" + "$env:R_LIB_PATH/R/bin/x64;" + "$env:R_LIB_PATH/miktex/texmfs/install/miktex/bin/x64;" + $env:PATH Write-Output "PATH: $env:PATH" $env:BINPREF = "C:/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/bin/" @@ -88,11 +88,11 @@ if ($env:TASK -eq "r-package"){ # 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 $? + 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=$env:R_LIB_PATH\Rtools" ; Check-Output $? + Start-Process -FilePath Rtools.exe -NoNewWindow -Wait -ArgumentList "/VERYSILENT /DIR=$env:R_LIB_PATH/Rtools" ; Check-Output $? Write-Output "Done installing Rtools" # download Miktex @@ -101,9 +101,9 @@ if ($env:TASK -eq "r-package"){ Add-Type -AssemblyName System.IO.Compression.FileSystem [System.IO.Compression.ZipFile]::ExtractToDirectory("miktexsetup-x64.zip", "miktex") Write-Output "Setting up MiKTeX" - .\miktex\miktexsetup.exe --local-package-repository=.\miktex\download --package-set=essential --quiet download ; Check-Output $? + .\miktex\miktexsetup.exe --local-package-repository=./miktex/download --package-set=essential --quiet download ; Check-Output $? Write-Output "Installing MiKTeX" - .\miktex\download\miktexsetup.exe --portable="$env:R_LIB_PATH\miktex" --quiet install ; Check-Output $? + .\miktex\download\miktexsetup.exe --portable="$env:R_LIB_PATH/miktex" --quiet install ; Check-Output $? Write-Output "Done installing R, Rtools, and MiKTeX" } From 065df95b3e14cd179fc62d9c1f873c91a0506e52 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Sun, 22 Mar 2020 12:07:11 -0500 Subject: [PATCH 35/87] removed duplication in Windows testing code --- .appveyor.yml | 55 +++++++------------------------------------- .ci/test_windows.ps1 | 48 ++++++++++++++++++++++++++++++++------ .travis.yml | 32 +++++++++++++------------- .vsts-ci.yml | 24 +++++++++---------- 4 files changed, 76 insertions(+), 83 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index 5e88bbfc5aaf..fe30247a5124 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -7,58 +7,19 @@ configuration: # a trick to construct a build matrix with multiple Python versi environment: matrix: - # - COMPILER: MSVC - # TASK: r-package - # R_WINDOWS_VERSION: 3.6.1 + - COMPILER: MSVC + TASK: regular + - COMPILER: MINGW + TASK: regular - COMPILER: MINGW TASK: r-package R_WINDOWS_VERSION: 3.6.3 clone_depth: 5 -install: - - git submodule update --init --recursive # get `compute` folder - - set PATH=%PATH:C:\Program Files\Git\usr\bin;=% # delete sh.exe from PATH (mingw32-make fix) - - set PATH=C:\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin;%PATH% - - set PYTHON_VERSION=%CONFIGURATION% - - ps: >- - switch ($env:PYTHON_VERSION) { - "2.7" {$env:MINICONDA = """C:\Miniconda-x64"""} - "3.5" {$env:MINICONDA = """C:\Miniconda35-x64"""} - "3.6" {$env:MINICONDA = """C:\Miniconda36-x64"""} - "3.7" {$env:MINICONDA = """C:\Miniconda37-x64"""} - default {$env:MINICONDA = """C:\Miniconda37-x64"""} - } - - set PATH=%MINICONDA%;%MINICONDA%\Scripts;%PATH% - - ps: $env:LGB_VER = (Get-Content VERSION.txt).trim() - - activate - - conda config --set always_yes yes --set changeps1 no - - conda update -q -y conda - - conda create -q -y -n test-env python=%PYTHON_VERSION% joblib matplotlib numpy pandas psutil pytest python-graphviz "scikit-learn<=0.21.3" scipy - - activate test-env - -build_script: - - cd %APPVEYOR_BUILD_FOLDER%\python-package -# - IF "%COMPILER%"=="MINGW" ( -# python setup.py install --mingw) -# ELSE ( -# python setup.py install) +install: null +build_script: null test_script: - # - pytest %APPVEYOR_BUILD_FOLDER%\tests\python_package_test - # - cd %APPVEYOR_BUILD_FOLDER%\examples\python-guide - # - ps: >- - # @("import matplotlib", "matplotlib.use('Agg')") + (Get-Content "plot_example.py") | Set-Content "plot_example.py" # prevent interactive window mode - # (Get-Content "plot_example.py").replace('graph.render(view=True)', 'graph.render(view=False)') | Set-Content "plot_example.py" - # - ps: >- - # foreach ($file in @(Get-ChildItem *.py)) { - # @("import sys, warnings", "warnings.showwarning = lambda message, category, filename, lineno, file=None, line=None: sys.stdout.write(warnings.formatwarning(message, category, filename, lineno, line))") + (Get-Content $file) | Set-Content $file - # python $file - # if (!$?) { $host.SetShouldExit(-1) } - # } # run all examples - # - cd %APPVEYOR_BUILD_FOLDER%\examples\python-guide\notebooks - # - conda install -q -y -n test-env ipywidgets notebook - # - jupyter nbconvert --ExecutePreprocessor.timeout=180 --to notebook --execute --inplace *.ipynb # run all notebooks - #- cmd /c "powershell -ExecutionPolicy Bypass -File %APPVEYOR_BUILD_FOLDER%\.ci\test_windows.ps1" - - cd %APPVEYOR_BUILD_FOLDER% - - powershell.exe -ExecutionPolicy Bypass -File .\.ci\test_windows.ps1 + - cd %APPVEYOR_BUILD_FOLDER% + - powershell.exe -ExecutionPolicy Bypass -File .\.ci\test_windows.ps1 diff --git a/.ci/test_windows.ps1 b/.ci/test_windows.ps1 index 54b323a33858..4588be6a540f 100644 --- a/.ci/test_windows.ps1 +++ b/.ci/test_windows.ps1 @@ -6,6 +6,43 @@ function Check-Output { } } +# unify environment variables for Azure devops and AppVeyor +if (Test-Path env:APPVEYOR) { + $env:BUILD_SOURCESDIRECTORY = $env:APPVEYOR_BUILD_FOLDER +} + +# setup for Python +if ($env:TASK -ne "r-package") { + if (Test-Path env:APPVEYOR) { + Write-Output "Running AppVeyor-specific setup" + git submodule update --init --recursive # get `compute` folder + $env:PATH = "$env:PATH;C:\Program Files\Git\usr\bin;=" # delete sh.exe from PATH (mingw32-make fix) + $env:PATH = "C:\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin;$env:PATH" + $env:PYTHON_VERSION=$env:CONFIGURATION + switch ($env:PYTHON_VERSION) { + "2.7" {$env:MINICONDA = """C:\Miniconda-x64"""} + "3.5" {$env:MINICONDA = """C:\Miniconda35-x64"""} + "3.6" {$env:MINICONDA = """C:\Miniconda36-x64"""} + "3.7" {$env:MINICONDA = """C:\Miniconda37-x64"""} + default {$env:MINICONDA = """C:\Miniconda37-x64"""} + } + $env:PATH = "$env:MINICONDA;$env:MINICONDA\Scripts;$env:PATH" + $env:LGB_VER = (Get-Content VERSION.txt).trim() + } + activate + conda config --set always_yes yes --set changeps1 no + conda update -q -y conda + conda create -q -y -n test-env python=$env:PYTHON_VERSION joblib matplotlib numpy pandas psutil pytest python-graphviz "scikit-learn<=0.21.3" scipy + activate test-env + cd %APPVEYOR_BUILD_FOLDER%\python-package + Write-Output "Using compiler: '$env:COMPILER'" + if ($env:COMPILER -eq "MINGW") { + python setup.py install --mingw) + } else { + python setup.py install + } +} + if ($env:TASK -eq "regular") { mkdir $env:BUILD_SOURCESDIRECTORY/build; cd $env:BUILD_SOURCESDIRECTORY/build cmake -A x64 .. ; cmake --build . --target ALL_BUILD --config Release ; Check-Output $? @@ -57,16 +94,15 @@ if ($env:TASK -eq "regular") { # based on https://github.com/RGF-team/rgf/blob/master/R-package/.R.appveyor.ps1 if ($env:TASK -eq "r-package"){ - #Get-ChildItem env: | Export-CliXml ./env-vars.clixml - #Import-CliXml .\env-vars.clixml | % { Set-Item "env:$($_.Name)" $_.Value } $env:R_LIB_PATH = "C:/RLibrary" $env:R_LIBS = "$env:R_LIB_PATH/R/library" Write-Output "R_LIB_PATH: $env:R_LIB_PATH" Write-Output "R_LIBS: $env:R_LIBS" - if (Test-Path env:APPVEYOR) { - cd $env:APPVEYOR_BUILD_FOLDER - } + # if (Test-Path env:APPVEYOR) { + # cd $env:APPVEYOR_BUILD_FOLDER + # } + cd $env:BUILD_SOURCESDIRECTORY tzutil /s "GMT Standard Time" @@ -74,7 +110,6 @@ if ($env:TASK -eq "r-package"){ #$env:PATH = "$env:R_LIB_PATH\Rtools\bin;" + "$env:R_LIB_PATH\R\bin\x64;" + "$env:R_LIB_PATH\R\R-$env:R_WINDOWS_VERSION\bin\x64;" + "$env:R_LIB_PATH\R\R-$env:R_WINDOWS_VERSION\bin;" + "$env:R_LIB_PATH\miktex\texmfs\install\miktex\bin\x64;" + $env:PATH $env:PATH = "$env:R_LIB_PATH/Rtools/bin;" + "$env:R_LIB_PATH/R/bin/x64;" + "$env:R_LIB_PATH/miktex/texmfs/install/miktex/bin/x64;" + $env:PATH - Write-Output "PATH: $env:PATH" $env:BINPREF = "C:/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/bin/" # set up R if it doesn't exist yet @@ -119,7 +154,6 @@ if ($env:TASK -eq "r-package"){ Rscript.exe -e "install.packages(c('data.table', 'jsonlite', 'Matrix', 'R6', 'testthat'), dependencies = c('Imports', 'Depends', 'LinkingTo'), lib = '$env:R_LIBS')" ; Check-Output $? Write-Output "Building R package" - #Rscript.exe -e "install.packages('R6', pkgType = 'source')" Rscript --no-save -e "print(.libPaths())" Rscript --no-save -e "print('loading R6'); library(R6)" Rscript --no-save -e "print('R_LIBS'); print(Sys.getenv('R_LIBS'))" diff --git a/.travis.yml b/.travis.yml index bbd72bb9b207..3679422d362f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,24 +14,24 @@ env: global: # default values - PYTHON_VERSION=3.7 matrix: - - TASK=regular PYTHON_VERSION=3.6 - - TASK=sdist PYTHON_VERSION=2.7 - - TASK=bdist - - TASK=if-else - - TASK=lint - - TASK=check-docs - - TASK=mpi METHOD=source - - TASK=mpi METHOD=pip - - TASK=gpu METHOD=source PYTHON_VERSION=3.5 - - TASK=gpu METHOD=pip PYTHON_VERSION=3.6 + # - TASK=regular PYTHON_VERSION=3.6 + # - TASK=sdist PYTHON_VERSION=2.7 + # - TASK=bdist + # - TASK=if-else + # - TASK=lint + # - TASK=check-docs + # - TASK=mpi METHOD=source + # - TASK=mpi METHOD=pip + # - TASK=gpu METHOD=source PYTHON_VERSION=3.5 + # - TASK=gpu METHOD=pip PYTHON_VERSION=3.6 - TASK=r-package matrix: exclude: - - os: osx - env: TASK=gpu METHOD=source PYTHON_VERSION=3.5 - - os: osx - env: TASK=gpu METHOD=pip PYTHON_VERSION=3.6 + # - os: osx + # env: TASK=gpu METHOD=source PYTHON_VERSION=3.5 + # - os: osx + # env: TASK=gpu METHOD=pip PYTHON_VERSION=3.6 - os: osx env: TASK=lint - os: osx @@ -45,11 +45,11 @@ before_install: - if [[ $TRAVIS_OS_NAME == "osx" ]]; then export OS_NAME="macos"; export COMPILER="gcc"; - export R_MAC_VERSION=3.6.1; + export R_MAC_VERSION=3.6.3; else export OS_NAME="linux"; export COMPILER="clang"; - export R_TRAVIS_LINUX_VERSION=3.6.1-3bionic; + export R_TRAVIS_LINUX_VERSION=3.6.3-3bionic; fi - export CONDA="$HOME/miniconda" - export PATH="$CONDA/bin:$PATH" diff --git a/.vsts-ci.yml b/.vsts-ci.yml index 5e401e22b75f..e519b10e5220 100644 --- a/.vsts-ci.yml +++ b/.vsts-ci.yml @@ -99,7 +99,7 @@ jobs: echo "##vso[task.setvariable variable=CONDA]$CONDA" echo "##vso[task.prependpath]$CONDA/bin" echo "##vso[task.setvariable variable=JAVA_HOME]$JAVA_HOME_8_X64" - echo "##vso[task.setvariable variable=R_MAC_VERSION]3.6.1" + echo "##vso[task.setvariable variable=R_MAC_VERSION]3.6.3" displayName: 'Set variables' - bash: $(Build.SourcesDirectory)/.ci/setup.sh displayName: Setup @@ -119,24 +119,22 @@ jobs: strategy: maxParallel: 3 matrix: - # regular: - # TASK: regular - # PYTHON_VERSION: 3.7 - # sdist: - # TASK: sdist - # PYTHON_VERSION: 2.7 - # bdist: - # TASK: bdist - # PYTHON_VERSION: 3.5 + regular: + TASK: regular + PYTHON_VERSION: 3.7 + sdist: + TASK: sdist + PYTHON_VERSION: 2.7 + bdist: + TASK: bdist + PYTHON_VERSION: 3.5 rpkg: TASK: r-package R_WINDOWS_VERSION: 3.6.3 steps: - powershell: Write-Host "##vso[task.prependpath]$env:CONDA\Scripts" displayName: Enable conda - - script: | - cmd /c 'activate & conda config --set always_yes yes --set changeps1 no & conda update -q -y conda & conda create -q -y -n %CONDA_ENV% python=%PYTHON_VERSION% joblib matplotlib numpy pandas psutil pytest python-graphviz "scikit-learn<=0.21.3" scipy' - cmd /c "activate %CONDA_ENV% & powershell -ExecutionPolicy Bypass -File %BUILD_SOURCESDIRECTORY%/.ci/test_windows.ps1" + - script: cmd /c "activate %CONDA_ENV% & powershell -ExecutionPolicy Bypass -File %BUILD_SOURCESDIRECTORY%/.ci/test_windows.ps1" displayName: Test - task: PublishBuildArtifacts@1 condition: and(succeeded(), in(variables['TASK'], 'regular', 'sdist', 'bdist'), not(startsWith(variables['Build.SourceBranch'], 'refs/pull/'))) From 432df25984317c284fea856aac8fbde1d01bae35 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Sun, 22 Mar 2020 12:12:31 -0500 Subject: [PATCH 36/87] simpler --- .appveyor.yml | 6 ++++-- .ci/test_windows.ps1 | 6 +++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index fe30247a5124..4be718ddc89a 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -17,8 +17,10 @@ environment: clone_depth: 5 -install: null -build_script: null +# install: +# script: +# Write-Output +# build_script: null test_script: - cd %APPVEYOR_BUILD_FOLDER% diff --git a/.ci/test_windows.ps1 b/.ci/test_windows.ps1 index 4588be6a540f..ef1c400c5573 100644 --- a/.ci/test_windows.ps1 +++ b/.ci/test_windows.ps1 @@ -32,12 +32,12 @@ if ($env:TASK -ne "r-package") { activate conda config --set always_yes yes --set changeps1 no conda update -q -y conda - conda create -q -y -n test-env python=$env:PYTHON_VERSION joblib matplotlib numpy pandas psutil pytest python-graphviz "scikit-learn<=0.21.3" scipy - activate test-env + conda create -q -y -n "test-env" python=$env:PYTHON_VERSION joblib matplotlib numpy pandas psutil pytest python-graphviz "scikit-learn<=0.21.3" scipy + activate "test-env" cd %APPVEYOR_BUILD_FOLDER%\python-package Write-Output "Using compiler: '$env:COMPILER'" if ($env:COMPILER -eq "MINGW") { - python setup.py install --mingw) + python setup.py install --mingw } else { python setup.py install } From 6e730475dc92c2ed3afea4e68fc20624f4efafa8 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Sun, 22 Mar 2020 12:32:30 -0500 Subject: [PATCH 37/87] fixed conda stuff --- .ci/test_windows.ps1 | 4 ++++ .travis.yml | 2 +- .vsts-ci.yml | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.ci/test_windows.ps1 b/.ci/test_windows.ps1 index ef1c400c5573..51c03948d7d3 100644 --- a/.ci/test_windows.ps1 +++ b/.ci/test_windows.ps1 @@ -44,6 +44,7 @@ if ($env:TASK -ne "r-package") { } if ($env:TASK -eq "regular") { + activate "test-env" mkdir $env:BUILD_SOURCESDIRECTORY/build; cd $env:BUILD_SOURCESDIRECTORY/build cmake -A x64 .. ; cmake --build . --target ALL_BUILD --config Release ; Check-Output $? cd $env:BUILD_SOURCESDIRECTORY/python-package @@ -52,6 +53,7 @@ if ($env:TASK -eq "regular") { cp $env:BUILD_SOURCESDIRECTORY/Release/lightgbm.exe $env:BUILD_ARTIFACTSTAGINGDIRECTORY } elseif ($env:TASK -eq "sdist") { + activate "test-env" cd $env:BUILD_SOURCESDIRECTORY/python-package python setup.py sdist --formats gztar ; Check-Output $? cd dist; pip install @(Get-ChildItem *.gz) -v ; Check-Output $? @@ -66,6 +68,7 @@ elseif ($env:TASK -eq "sdist") { cp $env:BUILD_SOURCESDIRECTORY/build/lightgbmlib.jar $env:BUILD_ARTIFACTSTAGINGDIRECTORY/lightgbmlib_win.jar } elseif ($env:TASK -eq "bdist") { + activate "test-env" cd $env:BUILD_SOURCESDIRECTORY/python-package python setup.py bdist_wheel --plat-name=win-amd64 --universal ; Check-Output $? cd dist; pip install @(Get-ChildItem *.whl) ; Check-Output $? @@ -78,6 +81,7 @@ if ($env:TASK -ne "r-package") { } if ($env:TASK -eq "regular") { + activate "test-env" cd $env:BUILD_SOURCESDIRECTORY/examples/python-guide @("import matplotlib", "matplotlib.use('Agg')") + (Get-Content "plot_example.py") | Set-Content "plot_example.py" (Get-Content "plot_example.py").replace('graph.render(view=True)', 'graph.render(view=False)') | Set-Content "plot_example.py" diff --git a/.travis.yml b/.travis.yml index 3679422d362f..fa66d281934d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -49,7 +49,7 @@ before_install: else export OS_NAME="linux"; export COMPILER="clang"; - export R_TRAVIS_LINUX_VERSION=3.6.3-3bionic; + export R_TRAVIS_LINUX_VERSION=3.6.3-1bionic; fi - export CONDA="$HOME/miniconda" - export PATH="$CONDA/bin:$PATH" diff --git a/.vsts-ci.yml b/.vsts-ci.yml index e519b10e5220..74ffc2092d5b 100644 --- a/.vsts-ci.yml +++ b/.vsts-ci.yml @@ -134,7 +134,7 @@ jobs: steps: - powershell: Write-Host "##vso[task.prependpath]$env:CONDA\Scripts" displayName: Enable conda - - script: cmd /c "activate %CONDA_ENV% & powershell -ExecutionPolicy Bypass -File %BUILD_SOURCESDIRECTORY%/.ci/test_windows.ps1" + - script: cmd /c "powershell -ExecutionPolicy Bypass -File %BUILD_SOURCESDIRECTORY%/.ci/test_windows.ps1" displayName: Test - task: PublishBuildArtifacts@1 condition: and(succeeded(), in(variables['TASK'], 'regular', 'sdist', 'bdist'), not(startsWith(variables['Build.SourceBranch'], 'refs/pull/'))) From fec3de7f50fa9765afa067456ba367213350152a Mon Sep 17 00:00:00 2001 From: James Lamb Date: Sun, 22 Mar 2020 12:36:27 -0500 Subject: [PATCH 38/87] more conda stuff --- .appveyor.yml | 5 ++++- .ci/test_windows.ps1 | 12 ++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index 4be718ddc89a..b2c964f9b3b8 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -9,8 +9,10 @@ environment: matrix: - COMPILER: MSVC TASK: regular + CONDA_ENV: test-env - COMPILER: MINGW TASK: regular + CONDA_ENV: test-env - COMPILER: MINGW TASK: r-package R_WINDOWS_VERSION: 3.6.3 @@ -20,7 +22,8 @@ clone_depth: 5 # install: # script: # Write-Output -# build_script: null +build_script: + - ps: Write-Output("using test_windows.ps1") to build test_script: - cd %APPVEYOR_BUILD_FOLDER% diff --git a/.ci/test_windows.ps1 b/.ci/test_windows.ps1 index 51c03948d7d3..5f081a60916a 100644 --- a/.ci/test_windows.ps1 +++ b/.ci/test_windows.ps1 @@ -32,8 +32,8 @@ if ($env:TASK -ne "r-package") { activate conda config --set always_yes yes --set changeps1 no conda update -q -y conda - conda create -q -y -n "test-env" python=$env:PYTHON_VERSION joblib matplotlib numpy pandas psutil pytest python-graphviz "scikit-learn<=0.21.3" scipy - activate "test-env" + conda create -q -y -n $env:CONDA_ENV python=$env:PYTHON_VERSION joblib matplotlib numpy pandas psutil pytest python-graphviz "scikit-learn<=0.21.3" scipy + activate $env:CONDA_ENV cd %APPVEYOR_BUILD_FOLDER%\python-package Write-Output "Using compiler: '$env:COMPILER'" if ($env:COMPILER -eq "MINGW") { @@ -44,7 +44,7 @@ if ($env:TASK -ne "r-package") { } if ($env:TASK -eq "regular") { - activate "test-env" + activate $env:CONDA_ENV mkdir $env:BUILD_SOURCESDIRECTORY/build; cd $env:BUILD_SOURCESDIRECTORY/build cmake -A x64 .. ; cmake --build . --target ALL_BUILD --config Release ; Check-Output $? cd $env:BUILD_SOURCESDIRECTORY/python-package @@ -53,7 +53,7 @@ if ($env:TASK -eq "regular") { cp $env:BUILD_SOURCESDIRECTORY/Release/lightgbm.exe $env:BUILD_ARTIFACTSTAGINGDIRECTORY } elseif ($env:TASK -eq "sdist") { - activate "test-env" + activate $env:CONDA_ENV cd $env:BUILD_SOURCESDIRECTORY/python-package python setup.py sdist --formats gztar ; Check-Output $? cd dist; pip install @(Get-ChildItem *.gz) -v ; Check-Output $? @@ -68,7 +68,7 @@ elseif ($env:TASK -eq "sdist") { cp $env:BUILD_SOURCESDIRECTORY/build/lightgbmlib.jar $env:BUILD_ARTIFACTSTAGINGDIRECTORY/lightgbmlib_win.jar } elseif ($env:TASK -eq "bdist") { - activate "test-env" + activate $env:CONDA_ENV cd $env:BUILD_SOURCESDIRECTORY/python-package python setup.py bdist_wheel --plat-name=win-amd64 --universal ; Check-Output $? cd dist; pip install @(Get-ChildItem *.whl) ; Check-Output $? @@ -81,7 +81,7 @@ if ($env:TASK -ne "r-package") { } if ($env:TASK -eq "regular") { - activate "test-env" + activate $env:CONDA_ENV cd $env:BUILD_SOURCESDIRECTORY/examples/python-guide @("import matplotlib", "matplotlib.use('Agg')") + (Get-Content "plot_example.py") | Set-Content "plot_example.py" (Get-Content "plot_example.py").replace('graph.render(view=True)', 'graph.render(view=False)') | Set-Content "plot_example.py" From 9b90d847c83d1a40aa3a2b807f9a70fc06f8cb51 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Sun, 22 Mar 2020 12:47:24 -0500 Subject: [PATCH 39/87] more fixes --- .ci/test_windows.ps1 | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.ci/test_windows.ps1 b/.ci/test_windows.ps1 index 5f081a60916a..c44cb72a1ec8 100644 --- a/.ci/test_windows.ps1 +++ b/.ci/test_windows.ps1 @@ -20,21 +20,22 @@ if ($env:TASK -ne "r-package") { $env:PATH = "C:\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin;$env:PATH" $env:PYTHON_VERSION=$env:CONFIGURATION switch ($env:PYTHON_VERSION) { - "2.7" {$env:MINICONDA = """C:\Miniconda-x64"""} - "3.5" {$env:MINICONDA = """C:\Miniconda35-x64"""} - "3.6" {$env:MINICONDA = """C:\Miniconda36-x64"""} - "3.7" {$env:MINICONDA = """C:\Miniconda37-x64"""} - default {$env:MINICONDA = """C:\Miniconda37-x64"""} + "2.7" {$env:MINICONDA = "C:\Miniconda-x64"} + "3.5" {$env:MINICONDA = "C:\Miniconda35-x64"} + "3.6" {$env:MINICONDA = "C:\Miniconda36-x64"} + "3.7" {$env:MINICONDA = "C:\Miniconda37-x64"} + default {$env:MINICONDA = "C:\Miniconda37-x64"} } $env:PATH = "$env:MINICONDA;$env:MINICONDA\Scripts;$env:PATH" $env:LGB_VER = (Get-Content VERSION.txt).trim() } + Write-Output "PATH: $env:PATH" activate conda config --set always_yes yes --set changeps1 no conda update -q -y conda conda create -q -y -n $env:CONDA_ENV python=$env:PYTHON_VERSION joblib matplotlib numpy pandas psutil pytest python-graphviz "scikit-learn<=0.21.3" scipy activate $env:CONDA_ENV - cd %APPVEYOR_BUILD_FOLDER%\python-package + cd $env:BUILD_SOURCESDIRECTORY\python-package Write-Output "Using compiler: '$env:COMPILER'" if ($env:COMPILER -eq "MINGW") { python setup.py install --mingw From c305e9d3af430652d7921f5eb6ff3d932853c0f8 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Sun, 22 Mar 2020 12:57:44 -0500 Subject: [PATCH 40/87] fixed testing script --- .ci/test_windows.ps1 | 1 + 1 file changed, 1 insertion(+) diff --git a/.ci/test_windows.ps1 b/.ci/test_windows.ps1 index c44cb72a1ec8..9a9b3b8f1332 100644 --- a/.ci/test_windows.ps1 +++ b/.ci/test_windows.ps1 @@ -77,6 +77,7 @@ elseif ($env:TASK -eq "bdist") { } if ($env:TASK -ne "r-package") { + activate $env:CONDA_ENV $tests = $env:BUILD_SOURCESDIRECTORY + $(If ($env:TASK -eq "sdist") {"/tests/python_package_test"} Else {"/tests"}) # cannot test C API with "sdist" task pytest $tests ; Check-Output $? } From c70e35265efdd81e634f1b3d5a1823a0cd00a1fa Mon Sep 17 00:00:00 2001 From: James Lamb Date: Sun, 22 Mar 2020 13:22:55 -0500 Subject: [PATCH 41/87] moved AppVeyor setup to the top --- .appveyor.yml | 6 ++---- .ci/test_windows.ps1 | 39 +++++++++++++++++++-------------------- 2 files changed, 21 insertions(+), 24 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index b2c964f9b3b8..01bda86dc3cd 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -20,11 +20,9 @@ environment: clone_depth: 5 # install: -# script: -# Write-Output + - ps: Write-Output("using test_windows.ps1 to install") build_script: - - ps: Write-Output("using test_windows.ps1") to build + - ps: Write-Output("using test_windows.ps1 to build") test_script: - - cd %APPVEYOR_BUILD_FOLDER% - powershell.exe -ExecutionPolicy Bypass -File .\.ci\test_windows.ps1 diff --git a/.ci/test_windows.ps1 b/.ci/test_windows.ps1 index 9a9b3b8f1332..6f918a298d4e 100644 --- a/.ci/test_windows.ps1 +++ b/.ci/test_windows.ps1 @@ -11,25 +11,27 @@ if (Test-Path env:APPVEYOR) { $env:BUILD_SOURCESDIRECTORY = $env:APPVEYOR_BUILD_FOLDER } +# AppVeyor-specific setup +if (Test-Path env:APPVEYOR) { + Write-Output "Running AppVeyor-specific setup" + git submodule update --init --recursive # get `compute` folder + $env:PATH = "$env:PATH;C:\Program Files\Git\usr\bin;=" # delete sh.exe from PATH (mingw32-make fix) + $env:PATH = "C:\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin;$env:PATH" + $env:PYTHON_VERSION=$env:CONFIGURATION + switch ($env:PYTHON_VERSION) { + "2.7" {$env:MINICONDA = "C:\Miniconda-x64"} + "3.5" {$env:MINICONDA = "C:\Miniconda35-x64"} + "3.6" {$env:MINICONDA = "C:\Miniconda36-x64"} + "3.7" {$env:MINICONDA = "C:\Miniconda37-x64"} + default {$env:MINICONDA = "C:\Miniconda37-x64"} + } + $env:PATH = "$env:MINICONDA;$env:MINICONDA\Scripts;$env:PATH" + $env:LGB_VER = (Get-Content VERSION.txt).trim() +} +Write-Output "PATH: $env:PATH" + # setup for Python if ($env:TASK -ne "r-package") { - if (Test-Path env:APPVEYOR) { - Write-Output "Running AppVeyor-specific setup" - git submodule update --init --recursive # get `compute` folder - $env:PATH = "$env:PATH;C:\Program Files\Git\usr\bin;=" # delete sh.exe from PATH (mingw32-make fix) - $env:PATH = "C:\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin;$env:PATH" - $env:PYTHON_VERSION=$env:CONFIGURATION - switch ($env:PYTHON_VERSION) { - "2.7" {$env:MINICONDA = "C:\Miniconda-x64"} - "3.5" {$env:MINICONDA = "C:\Miniconda35-x64"} - "3.6" {$env:MINICONDA = "C:\Miniconda36-x64"} - "3.7" {$env:MINICONDA = "C:\Miniconda37-x64"} - default {$env:MINICONDA = "C:\Miniconda37-x64"} - } - $env:PATH = "$env:MINICONDA;$env:MINICONDA\Scripts;$env:PATH" - $env:LGB_VER = (Get-Content VERSION.txt).trim() - } - Write-Output "PATH: $env:PATH" activate conda config --set always_yes yes --set changeps1 no conda update -q -y conda @@ -105,9 +107,6 @@ if ($env:TASK -eq "r-package"){ Write-Output "R_LIB_PATH: $env:R_LIB_PATH" Write-Output "R_LIBS: $env:R_LIBS" - # if (Test-Path env:APPVEYOR) { - # cd $env:APPVEYOR_BUILD_FOLDER - # } cd $env:BUILD_SOURCESDIRECTORY tzutil /s "GMT Standard Time" From 517e519311de7cbd1e04ea113568b6713b475b51 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Sun, 22 Mar 2020 13:23:48 -0500 Subject: [PATCH 42/87] commenting --- .appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.appveyor.yml b/.appveyor.yml index 01bda86dc3cd..80b0a25600c1 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -19,7 +19,7 @@ environment: clone_depth: 5 -# install: +install: - ps: Write-Output("using test_windows.ps1 to install") build_script: - ps: Write-Output("using test_windows.ps1 to build") From 56bf28a2251b2ed7387c2856324b36265b28cc38 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Sun, 22 Mar 2020 13:49:38 -0500 Subject: [PATCH 43/87] ch-ch-ch-ch-chaaaanges --- .ci/test_windows.ps1 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.ci/test_windows.ps1 b/.ci/test_windows.ps1 index 6f918a298d4e..0b98c9407206 100644 --- a/.ci/test_windows.ps1 +++ b/.ci/test_windows.ps1 @@ -25,7 +25,7 @@ if (Test-Path env:APPVEYOR) { "3.7" {$env:MINICONDA = "C:\Miniconda37-x64"} default {$env:MINICONDA = "C:\Miniconda37-x64"} } - $env:PATH = "$env:MINICONDA;$env:MINICONDA\Scripts;$env:PATH" + $env:PATH = "$env:MINICONDA;$env:MINICONDA\Scripts;$env:MINICONDA\bin;$env:PATH" $env:LGB_VER = (Get-Content VERSION.txt).trim() } Write-Output "PATH: $env:PATH" @@ -35,7 +35,7 @@ if ($env:TASK -ne "r-package") { activate conda config --set always_yes yes --set changeps1 no conda update -q -y conda - conda create -q -y -n $env:CONDA_ENV python=$env:PYTHON_VERSION joblib matplotlib numpy pandas psutil pytest python-graphviz "scikit-learn<=0.21.3" scipy + conda create -q -y -n $env:CONDA_ENV python=$env:PYTHON_VERSION joblib matplotlib numpy pandas psutil pytest python-graphviz "scikit-learn<=0.21.3" scipy wheel activate $env:CONDA_ENV cd $env:BUILD_SOURCESDIRECTORY\python-package Write-Output "Using compiler: '$env:COMPILER'" @@ -80,6 +80,7 @@ elseif ($env:TASK -eq "bdist") { if ($env:TASK -ne "r-package") { activate $env:CONDA_ENV + conda env export $tests = $env:BUILD_SOURCESDIRECTORY + $(If ($env:TASK -eq "sdist") {"/tests/python_package_test"} Else {"/tests"}) # cannot test C API with "sdist" task pytest $tests ; Check-Output $? } From f439ba20014bf90d2c6949fe570bb1c058b473e7 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Sun, 22 Mar 2020 14:09:42 -0500 Subject: [PATCH 44/87] paths --- .ci/test_windows.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/test_windows.ps1 b/.ci/test_windows.ps1 index 0b98c9407206..613ccf50bfa5 100644 --- a/.ci/test_windows.ps1 +++ b/.ci/test_windows.ps1 @@ -15,7 +15,7 @@ if (Test-Path env:APPVEYOR) { if (Test-Path env:APPVEYOR) { Write-Output "Running AppVeyor-specific setup" git submodule update --init --recursive # get `compute` folder - $env:PATH = "$env:PATH;C:\Program Files\Git\usr\bin;=" # delete sh.exe from PATH (mingw32-make fix) + $env:PATH = "$env:PATH:C:\Program Files\Git\usr\bin;=" # delete sh.exe from PATH (mingw32-make fix) $env:PATH = "C:\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin;$env:PATH" $env:PYTHON_VERSION=$env:CONFIGURATION switch ($env:PYTHON_VERSION) { From 2923111ab7a92463bfcfe723968d0226b98f8ef0 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Sun, 22 Mar 2020 14:17:17 -0500 Subject: [PATCH 45/87] plz work --- .ci/test_windows.ps1 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.ci/test_windows.ps1 b/.ci/test_windows.ps1 index 613ccf50bfa5..b3a412856871 100644 --- a/.ci/test_windows.ps1 +++ b/.ci/test_windows.ps1 @@ -15,7 +15,7 @@ if (Test-Path env:APPVEYOR) { if (Test-Path env:APPVEYOR) { Write-Output "Running AppVeyor-specific setup" git submodule update --init --recursive # get `compute` folder - $env:PATH = "$env:PATH:C:\Program Files\Git\usr\bin;=" # delete sh.exe from PATH (mingw32-make fix) + $env:PATH = "$env:PATH;C:\Program Files\Git\usr\bin;=" # delete sh.exe from PATH (mingw32-make fix) $env:PATH = "C:\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin;$env:PATH" $env:PYTHON_VERSION=$env:CONFIGURATION switch ($env:PYTHON_VERSION) { @@ -37,6 +37,9 @@ if ($env:TASK -ne "r-package") { conda update -q -y conda conda create -q -y -n $env:CONDA_ENV python=$env:PYTHON_VERSION joblib matplotlib numpy pandas psutil pytest python-graphviz "scikit-learn<=0.21.3" scipy wheel activate $env:CONDA_ENV + Write-Output "Fixing path" + pytest + Write-Output "hey it works" cd $env:BUILD_SOURCESDIRECTORY\python-package Write-Output "Using compiler: '$env:COMPILER'" if ($env:COMPILER -eq "MINGW") { From 65915a188f33a05fea38b534e036eb965810874b Mon Sep 17 00:00:00 2001 From: James Lamb Date: Sun, 22 Mar 2020 18:49:27 -0500 Subject: [PATCH 46/87] fixed conda stuff in Windows CI --- .appveyor.yml | 24 +++++++++++++++----- .ci/test_windows.ps1 | 52 +++++++++++++------------------------------- .vsts-ci.yml | 4 +++- 3 files changed, 37 insertions(+), 43 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index 80b0a25600c1..0fbd8d88f8c1 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -8,10 +8,10 @@ configuration: # a trick to construct a build matrix with multiple Python versi environment: matrix: - COMPILER: MSVC - TASK: regular + TASK: appveyor-python CONDA_ENV: test-env - COMPILER: MINGW - TASK: regular + TASK: appveyor-python CONDA_ENV: test-env - COMPILER: MINGW TASK: r-package @@ -20,9 +20,23 @@ environment: clone_depth: 5 install: - - ps: Write-Output("using test_windows.ps1 to install") -build_script: - - ps: Write-Output("using test_windows.ps1 to build") + - git submodule update --init --recursive # get `compute` folder + - set PATH=%PATH:C:\Program Files\Git\usr\bin;=% # delete sh.exe from PATH (mingw32-make fix) + - set PATH=C:\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin;%PATH% + - set PYTHON_VERSION=%CONFIGURATION% + - ps: >- + switch ($env:PYTHON_VERSION) { + "2.7" {$env:MINICONDA = "C:\Miniconda-x64"} + "3.5" {$env:MINICONDA = "C:\Miniconda35-x64"} + "3.6" {$env:MINICONDA = "C:\Miniconda36-x64"} + "3.7" {$env:MINICONDA = "C:\Miniconda37-x64"} + default {$env:MINICONDA = "C:\Miniconda37-x64"} + } + $env:PATH="$env:MINICONDA;$env:MINICONDA\Scripts;$env:PATH" + - ps: $env:LGB_VER = (Get-Content VERSION.txt).trim() + +build: false test_script: + - conda init powershell - powershell.exe -ExecutionPolicy Bypass -File .\.ci\test_windows.ps1 diff --git a/.ci/test_windows.ps1 b/.ci/test_windows.ps1 index b3a412856871..3da0cc773be3 100644 --- a/.ci/test_windows.ps1 +++ b/.ci/test_windows.ps1 @@ -11,42 +11,14 @@ if (Test-Path env:APPVEYOR) { $env:BUILD_SOURCESDIRECTORY = $env:APPVEYOR_BUILD_FOLDER } -# AppVeyor-specific setup -if (Test-Path env:APPVEYOR) { - Write-Output "Running AppVeyor-specific setup" - git submodule update --init --recursive # get `compute` folder - $env:PATH = "$env:PATH;C:\Program Files\Git\usr\bin;=" # delete sh.exe from PATH (mingw32-make fix) - $env:PATH = "C:\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin;$env:PATH" - $env:PYTHON_VERSION=$env:CONFIGURATION - switch ($env:PYTHON_VERSION) { - "2.7" {$env:MINICONDA = "C:\Miniconda-x64"} - "3.5" {$env:MINICONDA = "C:\Miniconda35-x64"} - "3.6" {$env:MINICONDA = "C:\Miniconda36-x64"} - "3.7" {$env:MINICONDA = "C:\Miniconda37-x64"} - default {$env:MINICONDA = "C:\Miniconda37-x64"} - } - $env:PATH = "$env:MINICONDA;$env:MINICONDA\Scripts;$env:MINICONDA\bin;$env:PATH" - $env:LGB_VER = (Get-Content VERSION.txt).trim() -} -Write-Output "PATH: $env:PATH" - # setup for Python if ($env:TASK -ne "r-package") { - activate + conda init powershell + conda activate conda config --set always_yes yes --set changeps1 no conda update -q -y conda - conda create -q -y -n $env:CONDA_ENV python=$env:PYTHON_VERSION joblib matplotlib numpy pandas psutil pytest python-graphviz "scikit-learn<=0.21.3" scipy wheel - activate $env:CONDA_ENV - Write-Output "Fixing path" - pytest - Write-Output "hey it works" - cd $env:BUILD_SOURCESDIRECTORY\python-package - Write-Output "Using compiler: '$env:COMPILER'" - if ($env:COMPILER -eq "MINGW") { - python setup.py install --mingw - } else { - python setup.py install - } + conda create -q -y -n $env:CONDA_ENV python=$env:PYTHON_VERSION joblib matplotlib numpy pandas psutil pytest python-graphviz "scikit-learn<=0.21.3" scipy wheel ; Check-Output $? + conda activate $env:CONDA_ENV } if ($env:TASK -eq "regular") { @@ -79,20 +51,26 @@ elseif ($env:TASK -eq "bdist") { python setup.py bdist_wheel --plat-name=win-amd64 --universal ; Check-Output $? cd dist; pip install @(Get-ChildItem *.whl) ; Check-Output $? cp @(Get-ChildItem *.whl) $env:BUILD_ARTIFACTSTAGINGDIRECTORY +} elseif ($env:TASK -eq "appveyor-python") { + cd $env:BUILD_SOURCESDIRECTORY\python-package + if ($env:COMPILER -eq "MINGW") { + python setup.py install --mingw | Check-Output $? + } else { + python setup.py install | Check-Output $? + } } if ($env:TASK -ne "r-package") { - activate $env:CONDA_ENV - conda env export - $tests = $env:BUILD_SOURCESDIRECTORY + $(If ($env:TASK -eq "sdist") {"/tests/python_package_test"} Else {"/tests"}) # cannot test C API with "sdist" task + conda activate $env:CONDA_ENV + $tests = $env:BUILD_SOURCESDIRECTORY + $(If (($env:TASK -eq "sdist") -or ($env:TASK -eq "appveyor-python")) {"/tests/python_package_test"} Else {"/tests"}) # cannot test C API with "sdist" task pytest $tests ; Check-Output $? } -if ($env:TASK -eq "regular") { +if (($env:TASK -eq "regular") -or ($env:TASK -eq "appveyor-python")) { activate $env:CONDA_ENV cd $env:BUILD_SOURCESDIRECTORY/examples/python-guide @("import matplotlib", "matplotlib.use('Agg')") + (Get-Content "plot_example.py") | Set-Content "plot_example.py" - (Get-Content "plot_example.py").replace('graph.render(view=True)', 'graph.render(view=False)') | Set-Content "plot_example.py" + (Get-Content "plot_example.py").replace('graph.render(view=True)', 'graph.render(view=False)') | Set-Content "plot_example.py" # prevent interactive window mode foreach ($file in @(Get-ChildItem *.py)) { @("import sys, warnings", "warnings.showwarning = lambda message, category, filename, lineno, file=None, line=None: sys.stdout.write(warnings.formatwarning(message, category, filename, lineno, line))") + (Get-Content $file) | Set-Content $file python $file ; Check-Output $? diff --git a/.vsts-ci.yml b/.vsts-ci.yml index 74ffc2092d5b..786bc5a81f8c 100644 --- a/.vsts-ci.yml +++ b/.vsts-ci.yml @@ -134,7 +134,9 @@ jobs: steps: - powershell: Write-Host "##vso[task.prependpath]$env:CONDA\Scripts" displayName: Enable conda - - script: cmd /c "powershell -ExecutionPolicy Bypass -File %BUILD_SOURCESDIRECTORY%/.ci/test_windows.ps1" + - script: | + cmd /c "conda init powershell" + cmd /c "powershell -ExecutionPolicy Bypass -File %BUILD_SOURCESDIRECTORY%/.ci/test_windows.ps1" displayName: Test - task: PublishBuildArtifacts@1 condition: and(succeeded(), in(variables['TASK'], 'regular', 'sdist', 'bdist'), not(startsWith(variables['Build.SourceBranch'], 'refs/pull/'))) From f18399ddbd7019e47a11e503d6e9514d87ac73ea Mon Sep 17 00:00:00 2001 From: James Lamb Date: Sun, 22 Mar 2020 19:31:37 -0500 Subject: [PATCH 47/87] uncommented stuff to test a full build --- .appveyor.yml | 10 ++--- .ci/test_windows.ps1 | 17 ++------ .travis.yml | 28 ++++++------ .vsts-ci.yml | 100 ++++++++++++++++++++++++++++++++----------- 4 files changed, 96 insertions(+), 59 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index 0fbd8d88f8c1..36b467e4001d 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -26,11 +26,11 @@ install: - set PYTHON_VERSION=%CONFIGURATION% - ps: >- switch ($env:PYTHON_VERSION) { - "2.7" {$env:MINICONDA = "C:\Miniconda-x64"} - "3.5" {$env:MINICONDA = "C:\Miniconda35-x64"} - "3.6" {$env:MINICONDA = "C:\Miniconda36-x64"} - "3.7" {$env:MINICONDA = "C:\Miniconda37-x64"} - default {$env:MINICONDA = "C:\Miniconda37-x64"} + "2.7" {$env:MINICONDA = """C:\Miniconda-x64"""} + "3.5" {$env:MINICONDA = """C:\Miniconda35-x64"""} + "3.6" {$env:MINICONDA = """C:\Miniconda36-x64"""} + "3.7" {$env:MINICONDA = """C:\Miniconda37-x64"""} + default {$env:MINICONDA = """C:\Miniconda37-x64"""} } $env:PATH="$env:MINICONDA;$env:MINICONDA\Scripts;$env:PATH" - ps: $env:LGB_VER = (Get-Content VERSION.txt).trim() diff --git a/.ci/test_windows.ps1 b/.ci/test_windows.ps1 index 3da0cc773be3..3f533b247264 100644 --- a/.ci/test_windows.ps1 +++ b/.ci/test_windows.ps1 @@ -81,24 +81,16 @@ if (($env:TASK -eq "regular") -or ($env:TASK -eq "appveyor-python")) { } # test R package -# based on https://github.com/RGF-team/rgf/blob/master/R-package/.R.appveyor.ps1 if ($env:TASK -eq "r-package"){ $env:R_LIB_PATH = "C:/RLibrary" - $env:R_LIBS = "$env:R_LIB_PATH/R/library" - Write-Output "R_LIB_PATH: $env:R_LIB_PATH" - Write-Output "R_LIBS: $env:R_LIBS" + $env:PATH = "$env:R_LIB_PATH/Rtools/bin;" + "$env:R_LIB_PATH/R/bin/x64;" + "$env:R_LIB_PATH/miktex/texmfs/install/miktex/bin/x64;" + $env:PATH + $env:BINPREF = "C:/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/bin/" cd $env:BUILD_SOURCESDIRECTORY - tzutil /s "GMT Standard Time" - [Void][System.IO.Directory]::CreateDirectory($env:R_LIB_PATH) - #$env:PATH = "$env:R_LIB_PATH\Rtools\bin;" + "$env:R_LIB_PATH\R\bin\x64;" + "$env:R_LIB_PATH\R\R-$env:R_WINDOWS_VERSION\bin\x64;" + "$env:R_LIB_PATH\R\R-$env:R_WINDOWS_VERSION\bin;" + "$env:R_LIB_PATH\miktex\texmfs\install\miktex\bin\x64;" + $env:PATH - $env:PATH = "$env:R_LIB_PATH/Rtools/bin;" + "$env:R_LIB_PATH/R/bin/x64;" + "$env:R_LIB_PATH/miktex/texmfs/install/miktex/bin/x64;" + $env:PATH - $env:BINPREF = "C:/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/bin/" - # set up R if it doesn't exist yet if (!(Get-Command R.exe -errorAction SilentlyContinue)) { @@ -138,12 +130,9 @@ if ($env:TASK -eq "r-package"){ Add-Content .Rprofile "options(install.packages.check.source = 'no')" Write-Output "Installing dependencies" - Rscript.exe -e "install.packages(c('data.table', 'jsonlite', 'Matrix', 'R6', 'testthat'), dependencies = c('Imports', 'Depends', 'LinkingTo'), lib = '$env:R_LIBS')" ; Check-Output $? + Rscript.exe -e "install.packages(c('data.table', 'jsonlite', 'Matrix', 'R6', 'testthat'), dependencies = c('Imports', 'Depends', 'LinkingTo'), lib = '$env:R_LIB_PATH')" ; Check-Output $? Write-Output "Building R package" - Rscript --no-save -e "print(.libPaths())" - Rscript --no-save -e "print('loading R6'); library(R6)" - Rscript --no-save -e "print('R_LIBS'); print(Sys.getenv('R_LIBS'))" Rscript build_r.R ; Check-Output $? $PKG_FILE_NAME = Get-Item *.tar.gz diff --git a/.travis.yml b/.travis.yml index fa66d281934d..dde786e9dfbb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,24 +14,24 @@ env: global: # default values - PYTHON_VERSION=3.7 matrix: - # - TASK=regular PYTHON_VERSION=3.6 - # - TASK=sdist PYTHON_VERSION=2.7 - # - TASK=bdist - # - TASK=if-else - # - TASK=lint - # - TASK=check-docs - # - TASK=mpi METHOD=source - # - TASK=mpi METHOD=pip - # - TASK=gpu METHOD=source PYTHON_VERSION=3.5 - # - TASK=gpu METHOD=pip PYTHON_VERSION=3.6 + - TASK=regular PYTHON_VERSION=3.6 + - TASK=sdist PYTHON_VERSION=2.7 + - TASK=bdist + - TASK=if-else + - TASK=lint + - TASK=check-docs + - TASK=mpi METHOD=source + - TASK=mpi METHOD=pip + - TASK=gpu METHOD=source PYTHON_VERSION=3.5 + - TASK=gpu METHOD=pip PYTHON_VERSION=3.6 - TASK=r-package matrix: exclude: - # - os: osx - # env: TASK=gpu METHOD=source PYTHON_VERSION=3.5 - # - os: osx - # env: TASK=gpu METHOD=pip PYTHON_VERSION=3.6 + - os: osx + env: TASK=gpu METHOD=source PYTHON_VERSION=3.5 + - os: osx + env: TASK=gpu METHOD=pip PYTHON_VERSION=3.6 - os: osx env: TASK=lint - os: osx diff --git a/.vsts-ci.yml b/.vsts-ci.yml index 786bc5a81f8c..51e96164533b 100644 --- a/.vsts-ci.yml +++ b/.vsts-ci.yml @@ -24,24 +24,24 @@ jobs: strategy: maxParallel: 6 matrix: - # regular: - # TASK: regular - # sdist: - # TASK: sdist - # PYTHON_VERSION: 3.5 - # bdist: - # TASK: bdist - # PYTHON_VERSION: 3.6 - # inference: - # TASK: if-else - # mpi_source: - # TASK: mpi - # METHOD: source - # PYTHON_VERSION: 2.7 - # gpu_source: - # TASK: gpu - # METHOD: source - # PYTHON_VERSION: 3.6 + regular: + TASK: regular + sdist: + TASK: sdist + PYTHON_VERSION: 3.5 + bdist: + TASK: bdist + PYTHON_VERSION: 3.6 + inference: + TASK: if-else + mpi_source: + TASK: mpi + METHOD: source + PYTHON_VERSION: 2.7 + gpu_source: + TASK: gpu + METHOD: source + PYTHON_VERSION: 3.6 r_package: TASK: r-package steps: @@ -78,14 +78,14 @@ jobs: strategy: maxParallel: 3 matrix: - # regular: - # TASK: regular - # PYTHON_VERSION: 3.6 - # sdist: - # TASK: sdist - # PYTHON_VERSION: 3.5 - # bdist: - # TASK: bdist + regular: + TASK: regular + PYTHON_VERSION: 3.6 + sdist: + TASK: sdist + PYTHON_VERSION: 3.5 + bdist: + TASK: bdist r_package: TASK: r-package steps: @@ -144,3 +144,51 @@ jobs: pathtoPublish: '$(Build.ArtifactStagingDirectory)' artifactName: PackageAssets artifactType: container + +# ########################################### +# - job: Package +# ########################################### +# dependsOn: +# - Linux +# - MacOS +# - Windows +# condition: and(succeeded(), not(startsWith(variables['Build.SourceBranch'], 'refs/pull/'))) +# pool: +# vmImage: 'vs2017-win2016' +# steps: +# # Download all agent packages from all previous phases +# - task: DownloadBuildArtifacts@0 +# displayName: Download package assets +# inputs: +# artifactName: PackageAssets +# downloadPath: $(Build.SourcesDirectory)/binaries +# - script: | +# python %BUILD_SOURCESDIRECTORY%/.nuget/create_nuget.py %BUILD_SOURCESDIRECTORY%/binaries/PackageAssets +# displayName: 'Create NuGet configuration files' +# - task: NuGetCommand@2 +# inputs: +# command: pack +# packagesToPack: '$(Build.SourcesDirectory)/.nuget/*.nuspec' +# packDestination: '$(Build.ArtifactStagingDirectory)' +# - task: PublishBuildArtifacts@1 +# inputs: +# pathtoPublish: '$(Build.ArtifactStagingDirectory)' +# artifactName: NuGet +# artifactType: container +# - task: GitHubRelease@0 +# displayName: 'Create GitHub Release' +# condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/v')) +# inputs: +# gitHubConnection: guolinke +# repositoryName: '$(Build.Repository.Name)' +# action: 'create' +# target: '$(Build.SourceVersion)' +# tagSource: 'auto' +# title: '$(Build.SourceBranchName)' +# assets: | +# $(Build.SourcesDirectory)/binaries/PackageAssets/* +# $(Build.ArtifactStagingDirectory)/*.nupkg +# assetUploadMode: 'delete' +# isDraft: true +# isPreRelease: false +# addChangeLog: false From 1de8f6cffde91ea8c7f69b77d4fb1c3efdecf084 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Sun, 22 Mar 2020 19:39:57 -0500 Subject: [PATCH 48/87] fixed quotes and removed some unnecessary stuff --- .appveyor.yml | 10 +++++----- .ci/test_windows.ps1 | 5 ----- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index 36b467e4001d..0fbd8d88f8c1 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -26,11 +26,11 @@ install: - set PYTHON_VERSION=%CONFIGURATION% - ps: >- switch ($env:PYTHON_VERSION) { - "2.7" {$env:MINICONDA = """C:\Miniconda-x64"""} - "3.5" {$env:MINICONDA = """C:\Miniconda35-x64"""} - "3.6" {$env:MINICONDA = """C:\Miniconda36-x64"""} - "3.7" {$env:MINICONDA = """C:\Miniconda37-x64"""} - default {$env:MINICONDA = """C:\Miniconda37-x64"""} + "2.7" {$env:MINICONDA = "C:\Miniconda-x64"} + "3.5" {$env:MINICONDA = "C:\Miniconda35-x64"} + "3.6" {$env:MINICONDA = "C:\Miniconda36-x64"} + "3.7" {$env:MINICONDA = "C:\Miniconda37-x64"} + default {$env:MINICONDA = "C:\Miniconda37-x64"} } $env:PATH="$env:MINICONDA;$env:MINICONDA\Scripts;$env:PATH" - ps: $env:LGB_VER = (Get-Content VERSION.txt).trim() diff --git a/.ci/test_windows.ps1 b/.ci/test_windows.ps1 index 3f533b247264..2cc654809604 100644 --- a/.ci/test_windows.ps1 +++ b/.ci/test_windows.ps1 @@ -22,7 +22,6 @@ if ($env:TASK -ne "r-package") { } if ($env:TASK -eq "regular") { - activate $env:CONDA_ENV mkdir $env:BUILD_SOURCESDIRECTORY/build; cd $env:BUILD_SOURCESDIRECTORY/build cmake -A x64 .. ; cmake --build . --target ALL_BUILD --config Release ; Check-Output $? cd $env:BUILD_SOURCESDIRECTORY/python-package @@ -31,7 +30,6 @@ if ($env:TASK -eq "regular") { cp $env:BUILD_SOURCESDIRECTORY/Release/lightgbm.exe $env:BUILD_ARTIFACTSTAGINGDIRECTORY } elseif ($env:TASK -eq "sdist") { - activate $env:CONDA_ENV cd $env:BUILD_SOURCESDIRECTORY/python-package python setup.py sdist --formats gztar ; Check-Output $? cd dist; pip install @(Get-ChildItem *.gz) -v ; Check-Output $? @@ -46,7 +44,6 @@ elseif ($env:TASK -eq "sdist") { cp $env:BUILD_SOURCESDIRECTORY/build/lightgbmlib.jar $env:BUILD_ARTIFACTSTAGINGDIRECTORY/lightgbmlib_win.jar } elseif ($env:TASK -eq "bdist") { - activate $env:CONDA_ENV cd $env:BUILD_SOURCESDIRECTORY/python-package python setup.py bdist_wheel --plat-name=win-amd64 --universal ; Check-Output $? cd dist; pip install @(Get-ChildItem *.whl) ; Check-Output $? @@ -61,13 +58,11 @@ elseif ($env:TASK -eq "bdist") { } if ($env:TASK -ne "r-package") { - conda activate $env:CONDA_ENV $tests = $env:BUILD_SOURCESDIRECTORY + $(If (($env:TASK -eq "sdist") -or ($env:TASK -eq "appveyor-python")) {"/tests/python_package_test"} Else {"/tests"}) # cannot test C API with "sdist" task pytest $tests ; Check-Output $? } if (($env:TASK -eq "regular") -or ($env:TASK -eq "appveyor-python")) { - activate $env:CONDA_ENV cd $env:BUILD_SOURCESDIRECTORY/examples/python-guide @("import matplotlib", "matplotlib.use('Agg')") + (Get-Content "plot_example.py") | Set-Content "plot_example.py" (Get-Content "plot_example.py").replace('graph.render(view=True)', 'graph.render(view=False)') | Set-Content "plot_example.py" # prevent interactive window mode From a912213b30eea41d16fc1458526bf2dc85a87e25 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Sun, 22 Mar 2020 19:52:35 -0500 Subject: [PATCH 49/87] added install.libs.R change --- .ci/test_windows.ps1 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.ci/test_windows.ps1 b/.ci/test_windows.ps1 index 2cc654809604..54edf563a894 100644 --- a/.ci/test_windows.ps1 +++ b/.ci/test_windows.ps1 @@ -86,6 +86,12 @@ if ($env:TASK -eq "r-package"){ tzutil /s "GMT Standard Time" [Void][System.IO.Directory]::CreateDirectory($env:R_LIB_PATH) + if ($env:COMPILER -eq "MINGW") { + Write-Output "Telling R to use MinGW" + $install_libs = $env:BUILD_SOURCESDIRECTORY\R-package\src\install.libs.R + ((Get-Content -path $install_libs -Raw) -replace 'use_mingw <- FALSE','use_mingw <- TRUE') | Set-Content -Path $install_libs + } + # set up R if it doesn't exist yet if (!(Get-Command R.exe -errorAction SilentlyContinue)) { From 290e5b738dc260bcf864f14ca2962df77a9c1108 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Sun, 22 Mar 2020 20:18:47 -0500 Subject: [PATCH 50/87] quotes are impoortant --- .ci/test_windows.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/test_windows.ps1 b/.ci/test_windows.ps1 index 54edf563a894..741a1a5c6f3f 100644 --- a/.ci/test_windows.ps1 +++ b/.ci/test_windows.ps1 @@ -88,7 +88,7 @@ if ($env:TASK -eq "r-package"){ if ($env:COMPILER -eq "MINGW") { Write-Output "Telling R to use MinGW" - $install_libs = $env:BUILD_SOURCESDIRECTORY\R-package\src\install.libs.R + $install_libs = "$env:BUILD_SOURCESDIRECTORY\R-package\src\install.libs.R" ((Get-Content -path $install_libs -Raw) -replace 'use_mingw <- FALSE','use_mingw <- TRUE') | Set-Content -Path $install_libs } From 2565df7420e78bc4b6badeda1f635352b28d9145 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Sun, 22 Mar 2020 21:38:41 -0500 Subject: [PATCH 51/87] added commented-out stuff back in --- .vsts-ci.yml | 94 ++++++++++++++++++------------------ R-package/src/install.libs.R | 2 +- 2 files changed, 48 insertions(+), 48 deletions(-) diff --git a/.vsts-ci.yml b/.vsts-ci.yml index 51e96164533b..6996e2dd19db 100644 --- a/.vsts-ci.yml +++ b/.vsts-ci.yml @@ -145,50 +145,50 @@ jobs: artifactName: PackageAssets artifactType: container -# ########################################### -# - job: Package -# ########################################### -# dependsOn: -# - Linux -# - MacOS -# - Windows -# condition: and(succeeded(), not(startsWith(variables['Build.SourceBranch'], 'refs/pull/'))) -# pool: -# vmImage: 'vs2017-win2016' -# steps: -# # Download all agent packages from all previous phases -# - task: DownloadBuildArtifacts@0 -# displayName: Download package assets -# inputs: -# artifactName: PackageAssets -# downloadPath: $(Build.SourcesDirectory)/binaries -# - script: | -# python %BUILD_SOURCESDIRECTORY%/.nuget/create_nuget.py %BUILD_SOURCESDIRECTORY%/binaries/PackageAssets -# displayName: 'Create NuGet configuration files' -# - task: NuGetCommand@2 -# inputs: -# command: pack -# packagesToPack: '$(Build.SourcesDirectory)/.nuget/*.nuspec' -# packDestination: '$(Build.ArtifactStagingDirectory)' -# - task: PublishBuildArtifacts@1 -# inputs: -# pathtoPublish: '$(Build.ArtifactStagingDirectory)' -# artifactName: NuGet -# artifactType: container -# - task: GitHubRelease@0 -# displayName: 'Create GitHub Release' -# condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/v')) -# inputs: -# gitHubConnection: guolinke -# repositoryName: '$(Build.Repository.Name)' -# action: 'create' -# target: '$(Build.SourceVersion)' -# tagSource: 'auto' -# title: '$(Build.SourceBranchName)' -# assets: | -# $(Build.SourcesDirectory)/binaries/PackageAssets/* -# $(Build.ArtifactStagingDirectory)/*.nupkg -# assetUploadMode: 'delete' -# isDraft: true -# isPreRelease: false -# addChangeLog: false +########################################### +- job: Package +########################################### + dependsOn: + - Linux + - MacOS + - Windows + condition: and(succeeded(), not(startsWith(variables['Build.SourceBranch'], 'refs/pull/'))) + pool: + vmImage: 'vs2017-win2016' + steps: + # Download all agent packages from all previous phases + - task: DownloadBuildArtifacts@0 + displayName: Download package assets + inputs: + artifactName: PackageAssets + downloadPath: $(Build.SourcesDirectory)/binaries + - script: | + python %BUILD_SOURCESDIRECTORY%/.nuget/create_nuget.py %BUILD_SOURCESDIRECTORY%/binaries/PackageAssets + displayName: 'Create NuGet configuration files' + - task: NuGetCommand@2 + inputs: + command: pack + packagesToPack: '$(Build.SourcesDirectory)/.nuget/*.nuspec' + packDestination: '$(Build.ArtifactStagingDirectory)' + - task: PublishBuildArtifacts@1 + inputs: + pathtoPublish: '$(Build.ArtifactStagingDirectory)' + artifactName: NuGet + artifactType: container + - task: GitHubRelease@0 + displayName: 'Create GitHub Release' + condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/v')) + inputs: + gitHubConnection: guolinke + repositoryName: '$(Build.Repository.Name)' + action: 'create' + target: '$(Build.SourceVersion)' + tagSource: 'auto' + title: '$(Build.SourceBranchName)' + assets: | + $(Build.SourcesDirectory)/binaries/PackageAssets/* + $(Build.ArtifactStagingDirectory)/*.nupkg + assetUploadMode: 'delete' + isDraft: true + isPreRelease: false + addChangeLog: false diff --git a/R-package/src/install.libs.R b/R-package/src/install.libs.R index f974cff97f0c..a79c93d846b7 100644 --- a/R-package/src/install.libs.R +++ b/R-package/src/install.libs.R @@ -1,7 +1,7 @@ # User options use_precompile <- FALSE use_gpu <- FALSE -use_mingw <- TRUE +use_mingw <- FALSE if (.Machine$sizeof.pointer != 8L) { stop("LightGBM only supports 64-bit R, please check the version of R and Rtools.") From cd89065bdef129c97f4248e4c196d1f36c06e946 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Mon, 23 Mar 2020 21:33:06 -0500 Subject: [PATCH 52/87] added Windows script, download retries, and MSVC linking --- .appveyor.yml | 3 + .ci/test_r_package_windows.ps1 | 86 ++++++++++++++++++ .ci/test_windows.ps1 | 100 +++------------------ CMakeLists.txt | 5 ++ R-package/src/cmake/modules/FindLibR.cmake | 40 +++++---- R-package/src/install.libs.R | 1 + 6 files changed, 129 insertions(+), 106 deletions(-) create mode 100644 .ci/test_r_package_windows.ps1 diff --git a/.appveyor.yml b/.appveyor.yml index 0fbd8d88f8c1..63651fb9f1b7 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -16,6 +16,9 @@ environment: - COMPILER: MINGW TASK: r-package R_WINDOWS_VERSION: 3.6.3 + - COMPILER: MSVC + TASK: r-package + R_WINDOWS_VERSION: 3.6.3 clone_depth: 5 diff --git a/.ci/test_r_package_windows.ps1 b/.ci/test_r_package_windows.ps1 new file mode 100644 index 000000000000..b416cae9eb11 --- /dev/null +++ b/.ci/test_r_package_windows.ps1 @@ -0,0 +1,86 @@ +# Download a file and retry upon failure. This looks like +# an infinite looop +function Download-File-With-Retries { + param( + [string]$url, + [string]$destfile + ) + do { + Write-Output "Downloading '${url}'" + sleep 5; + (New-Object System.Net.WebClient).DownloadFile($url, $destfile) + } while(!$?); +} + +$env:R_LIB_PATH = "C:/RLibrary" +$env:PATH = "$env:R_LIB_PATH/Rtools/bin;" + "$env:R_LIB_PATH/R/bin/x64;" + "$env:R_LIB_PATH/miktex/texmfs/install/miktex/bin/x64;" + $env:PATH +$env:BINPREF = "C:/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/bin/" + +cd $env:BUILD_SOURCESDIRECTORY +tzutil /s "GMT Standard Time" +[Void][System.IO.Directory]::CreateDirectory($env:R_LIB_PATH) + +if ($env:COMPILER -eq "MINGW") { + Write-Output "Telling R to use MinGW" + $install_libs = "$env:BUILD_SOURCESDIRECTORY\R-package\src\install.libs.R" + ((Get-Content -path $install_libs -Raw) -replace 'use_mingw <- FALSE','use_mingw <- TRUE') | Set-Content -Path $install_libs +} + +# set up R if it doesn't exist yet +if (!(Get-Command R.exe -errorAction SilentlyContinue)) { + + Write-Output "Downloading R and Rtools" + + # download 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/Rtools35.exe" -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=$env:R_LIB_PATH/Rtools" ; Check-Output $? + Write-Output "Done installing Rtools" + + # download Miktex + Write-Output "Downloading MiKTeX" + Download-File-With-Retries -url "https://miktex.org/download/win/miktexsetup-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.exe --local-package-repository=./miktex/download --package-set=essential --quiet download ; Check-Output $? + Write-Output "Installing MiKTeX" + .\miktex\download\miktexsetup.exe --portable="$env:R_LIB_PATH/miktex" --quiet install ; Check-Output $? + Write-Output "Done installing R, Rtools, and MiKTeX" +} + +initexmf --set-config-value [MPM]AutoInstall=1 +conda install -y --no-deps pandoc + +Add-Content .Renviron "R_LIBS=$env:R_LIB_PATH" +Add-Content .Rprofile "options(repos = 'https://cran.rstudio.com')" +Add-Content .Rprofile "options(pkgType = 'binary')" +Add-Content .Rprofile "options(install.packages.check.source = 'no')" + +Write-Output "Installing dependencies" +Rscript.exe -e "install.packages(c('data.table', 'jsonlite', 'Matrix', 'R6', 'testthat'), dependencies = c('Imports', 'Depends', 'LinkingTo'), lib = '$env:R_LIB_PATH')" ; Check-Output $? + +Write-Output "Building R package" +Rscript build_r.R ; Check-Output $? + +$PKG_FILE_NAME = Get-Item *.tar.gz +$PKG_NAME = $PKG_FILE_NAME.BaseName.split("_")[0] +$LOG_FILE_NAME = "$PKG_NAME.Rcheck/00check.log" + +Write-Output "Running R CMD check" +$env:_R_CHECK_FORCE_SUGGESTS_=0 +R.exe CMD check "${PKG_FILE_NAME}" --as-cran --no-multiarch; Check-Output $? + +if (Get-Content "$LOG_FILE_NAME" | Select-String -Pattern "WARNING" -Quiet) { + echo "WARNINGS have been found by R CMD check!" + Check-Output $False +} + +Exit 0 diff --git a/.ci/test_windows.ps1 b/.ci/test_windows.ps1 index 741a1a5c6f3f..e724be4cc48b 100644 --- a/.ci/test_windows.ps1 +++ b/.ci/test_windows.ps1 @@ -11,16 +11,19 @@ if (Test-Path env:APPVEYOR) { $env:BUILD_SOURCESDIRECTORY = $env:APPVEYOR_BUILD_FOLDER } -# setup for Python -if ($env:TASK -ne "r-package") { - conda init powershell - conda activate - conda config --set always_yes yes --set changeps1 no - conda update -q -y conda - conda create -q -y -n $env:CONDA_ENV python=$env:PYTHON_VERSION joblib matplotlib numpy pandas psutil pytest python-graphviz "scikit-learn<=0.21.3" scipy wheel ; Check-Output $? - conda activate $env:CONDA_ENV +if ($env:TASK -eq "r-package") { + & $env:BUILD_SOURCESDIRECTORY\.ci\test_r_package_windows.ps1 ; Check-Output $? + Exit 0 } +# setup for Python +conda init powershell +conda activate +conda config --set always_yes yes --set changeps1 no +conda update -q -y conda +conda create -q -y -n $env:CONDA_ENV python=$env:PYTHON_VERSION joblib matplotlib numpy pandas psutil pytest python-graphviz "scikit-learn<=0.21.3" scipy wheel ; Check-Output $? +conda activate $env:CONDA_ENV + if ($env:TASK -eq "regular") { mkdir $env:BUILD_SOURCESDIRECTORY/build; cd $env:BUILD_SOURCESDIRECTORY/build cmake -A x64 .. ; cmake --build . --target ALL_BUILD --config Release ; Check-Output $? @@ -57,10 +60,8 @@ elseif ($env:TASK -eq "bdist") { } } -if ($env:TASK -ne "r-package") { - $tests = $env:BUILD_SOURCESDIRECTORY + $(If (($env:TASK -eq "sdist") -or ($env:TASK -eq "appveyor-python")) {"/tests/python_package_test"} Else {"/tests"}) # cannot test C API with "sdist" task - pytest $tests ; Check-Output $? -} +$tests = $env:BUILD_SOURCESDIRECTORY + $(If (($env:TASK -eq "sdist") -or ($env:TASK -eq "appveyor-python")) {"/tests/python_package_test"} Else {"/tests"}) # cannot test C API with "sdist" task +pytest $tests ; Check-Output $? if (($env:TASK -eq "regular") -or ($env:TASK -eq "appveyor-python")) { cd $env:BUILD_SOURCESDIRECTORY/examples/python-guide @@ -74,78 +75,3 @@ if (($env:TASK -eq "regular") -or ($env:TASK -eq "appveyor-python")) { conda install -q -y -n $env:CONDA_ENV ipywidgets notebook jupyter nbconvert --ExecutePreprocessor.timeout=180 --to notebook --execute --inplace *.ipynb ; Check-Output $? # run all notebooks } - -# test R package -if ($env:TASK -eq "r-package"){ - - $env:R_LIB_PATH = "C:/RLibrary" - $env:PATH = "$env:R_LIB_PATH/Rtools/bin;" + "$env:R_LIB_PATH/R/bin/x64;" + "$env:R_LIB_PATH/miktex/texmfs/install/miktex/bin/x64;" + $env:PATH - $env:BINPREF = "C:/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/bin/" - - cd $env:BUILD_SOURCESDIRECTORY - tzutil /s "GMT Standard Time" - [Void][System.IO.Directory]::CreateDirectory($env:R_LIB_PATH) - - if ($env:COMPILER -eq "MINGW") { - Write-Output "Telling R to use MinGW" - $install_libs = "$env:BUILD_SOURCESDIRECTORY\R-package\src\install.libs.R" - ((Get-Content -path $install_libs -Raw) -replace 'use_mingw <- FALSE','use_mingw <- TRUE') | Set-Content -Path $install_libs - } - - # set up R if it doesn't exist yet - if (!(Get-Command R.exe -errorAction SilentlyContinue)) { - - Write-Output "Downloading R and Rtools" - - # download R and RTools - (New-Object System.Net.WebClient).DownloadFile("https://cloud.r-project.org/bin/windows/base/old/$env:R_WINDOWS_VERSION/R-$env:R_WINDOWS_VERSION-win.exe", "R-win.exe") - (New-Object System.Net.WebClient).DownloadFile("https://cloud.r-project.org/bin/windows/Rtools/Rtools35.exe", "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=$env:R_LIB_PATH/Rtools" ; Check-Output $? - Write-Output "Done installing Rtools" - - # download Miktex - Write-Output "Downloading MiKTeX" - (New-Object System.Net.WebClient).DownloadFile("https://miktex.org/download/win/miktexsetup-x64.zip", "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.exe --local-package-repository=./miktex/download --package-set=essential --quiet download ; Check-Output $? - Write-Output "Installing MiKTeX" - .\miktex\download\miktexsetup.exe --portable="$env:R_LIB_PATH/miktex" --quiet install ; Check-Output $? - Write-Output "Done installing R, Rtools, and MiKTeX" - } - - initexmf --set-config-value [MPM]AutoInstall=1 - conda install -y --no-deps pandoc - - Add-Content .Renviron "R_LIBS=$env:R_LIB_PATH" - Add-Content .Rprofile "options(repos = 'https://cran.rstudio.com')" - Add-Content .Rprofile "options(pkgType = 'binary')" - Add-Content .Rprofile "options(install.packages.check.source = 'no')" - - Write-Output "Installing dependencies" - Rscript.exe -e "install.packages(c('data.table', 'jsonlite', 'Matrix', 'R6', 'testthat'), dependencies = c('Imports', 'Depends', 'LinkingTo'), lib = '$env:R_LIB_PATH')" ; Check-Output $? - - Write-Output "Building R package" - Rscript build_r.R ; Check-Output $? - - $PKG_FILE_NAME = Get-Item *.tar.gz - $PKG_NAME = $PKG_FILE_NAME.BaseName.split("_")[0] - $LOG_FILE_NAME = "$PKG_NAME.Rcheck/00check.log" - - Write-Output "Running R CMD check" - $env:_R_CHECK_FORCE_SUGGESTS_=0 - R.exe CMD check "${PKG_FILE_NAME}" --as-cran --no-multiarch; Check-Output $? - - if (Get-Content "$LOG_FILE_NAME" | Select-String -Pattern "WARNING" -Quiet) { - echo "WARNINGS have been found by R CMD check!" - Check-Output $False - } -} diff --git a/CMakeLists.txt b/CMakeLists.txt index e0734b0534ab..494bfd4324bd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -316,7 +316,12 @@ if(WIN32 AND (MINGW OR CYGWIN)) endif() if(BUILD_FOR_R) + if(MSVC) + # https://docs.microsoft.com/en-us/cpp/build/reference/link-input-files?redirectedfrom=MSDN&view=vs-2019 + TARGET_LINK_LIBRARIES(_lightgbm ${CMAKE_CURRENT_BINARY_DIR}/R.lib) + else() TARGET_LINK_LIBRARIES(_lightgbm ${LIBR_CORE_LIBRARY}) + endif() endif(BUILD_FOR_R) install(TARGETS lightgbm _lightgbm diff --git a/R-package/src/cmake/modules/FindLibR.cmake b/R-package/src/cmake/modules/FindLibR.cmake index 20c0a974e1ff..9716f99ae3b3 100644 --- a/R-package/src/cmake/modules/FindLibR.cmake +++ b/R-package/src/cmake/modules/FindLibR.cmake @@ -10,7 +10,6 @@ # LIBR_HOME # LIBR_EXECUTABLE # LIBR_INCLUDE_DIRS -# LIBR_LIB_DIR # LIBR_CORE_LIBRARY # and a CMake function to create R.lib for MSVC @@ -36,8 +35,8 @@ function(create_rlib_for_msvc) message(FATAL_ERROR "create_rlib_for_msvc() can only be used with MSVC") endif() - if(NOT EXISTS "${LIBR_LIB_DIR}") - message(FATAL_ERROR "LIBR_LIB_DIR, '${LIBR_LIB_DIR}', not found") + if(NOT EXISTS "${LIBR_CORE_LIBRARY}") + message(FATAL_ERROR "LIBR_CORE_LIBRARY, '${LIBR_CORE_LIBRARY}', not found") endif() find_program(GENDEF_EXE gendef) @@ -50,7 +49,8 @@ function(create_rlib_for_msvc) # extract symbols from R.dll into R.def and R.lib import library execute_process(COMMAND ${GENDEF_EXE} - "-" "${LIBR_LIB_DIR}/R.dll" + #"-" "${LIBR_LIB_DIR}/R.dll" + "-" "${LIBR_CORE_LIBRARY}" OUTPUT_FILE "${CMAKE_CURRENT_BINARY_DIR}/R.def" ) execute_process(COMMAND ${DLLTOOL_EXE} @@ -168,25 +168,28 @@ execute_process( OUTPUT_VARIABLE LIBR_INCLUDE_DIRS ) -# ask R for the lib dir -execute_process( - COMMAND ${LIBR_EXECUTABLE} "--slave" "--vanilla" "-e" "cat(normalizePath(R.home('lib'), winslash='/'))" - OUTPUT_VARIABLE LIBR_LIB_DIR -) - -# look for the core R library -find_library( - LIBR_CORE_LIBRARY - NAMES R - HINTS "${CMAKE_CURRENT_BINARY_DIR}" "${LIBR_LIB_DIR}" "${LIBR_HOME}/bin" "${LIBR_LIBRARIES}" -) - set(LIBR_HOME ${LIBR_HOME} CACHE PATH "R home directory") set(LIBR_EXECUTABLE ${LIBR_EXECUTABLE} CACHE PATH "R executable") set(LIBR_INCLUDE_DIRS ${LIBR_INCLUDE_DIRS} CACHE PATH "R include directory") -set(LIBR_LIB_DIR ${LIBR_LIB_DIR} CACHE PATH "R shared libraries directory") + +# look for the core R library +if(WIN32) + set(LIBR_CORE_LIBRARY ${LIBR_HOME}/bin/${R_ARCH}/R.dll) +else() + find_library( + LIBR_CORE_LIBRARY + NAMES R + HINTS "${CMAKE_CURRENT_BINARY_DIR}" "${LIBR_HOME}/lib" "${LIBR_HOME}/bin/${R_ARCH}" "${LIBR_HOME}/bin" "${LIBR_LIBRARIES}" + ) +endif() + set(LIBR_CORE_LIBRARY ${LIBR_CORE_LIBRARY} CACHE PATH "R core shared library") +message(STATUS "LIBR_EXECUTABLE: ${LIBR_EXECUTABLE}") +message(STATUS "LIBR_HOME: ${LIBR_HOME}") +message(STATUS "LIBR_INCLUDE_DIRS: ${LIBR_INCLUDE_DIRS}") +message(STATUS "LIBR_CORE_LIBRARY: ${LIBR_CORE_LIBRARY}") + if(WIN32 AND MSVC) # create a local R.lib import library for R.dll if it doesn't exist @@ -203,6 +206,5 @@ find_package_handle_standard_args(LibR DEFAULT_MSG LIBR_HOME LIBR_EXECUTABLE LIBR_INCLUDE_DIRS - LIBR_LIB_DIR LIBR_CORE_LIBRARY ) diff --git a/R-package/src/install.libs.R b/R-package/src/install.libs.R index a79c93d846b7..339e8417ee70 100644 --- a/R-package/src/install.libs.R +++ b/R-package/src/install.libs.R @@ -67,6 +67,7 @@ if (!use_precompile) { # Check if Windows installation (for gcc vs Visual Studio) if (WINDOWS) { if (use_mingw) { + print("Trying to build with MinGW") cmake_cmd <- paste0(cmake_cmd, " -G \"MinGW Makefiles\" ") build_cmd <- "mingw32-make.exe _lightgbm" system(paste0(cmake_cmd, " ..")) # Must build twice for Windows due sh.exe in Rtools From fbf494cf2fbf9e812fe31f599ffbb70794279778 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Wed, 25 Mar 2020 14:36:08 -0500 Subject: [PATCH 53/87] minor fixes --- .appveyor.yml | 3 --- .ci/test_r_package_windows.ps1 | 1 + 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index 63651fb9f1b7..0fbd8d88f8c1 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -16,9 +16,6 @@ environment: - COMPILER: MINGW TASK: r-package R_WINDOWS_VERSION: 3.6.3 - - COMPILER: MSVC - TASK: r-package - R_WINDOWS_VERSION: 3.6.3 clone_depth: 5 diff --git a/.ci/test_r_package_windows.ps1 b/.ci/test_r_package_windows.ps1 index b416cae9eb11..f16ba1dc3d23 100644 --- a/.ci/test_r_package_windows.ps1 +++ b/.ci/test_r_package_windows.ps1 @@ -83,4 +83,5 @@ if (Get-Content "$LOG_FILE_NAME" | Select-String -Pattern "WARNING" -Quiet) { Check-Output $False } +Write-Output "No issues were found checking the R package" Exit 0 From 244a14a0446c2153c00db52d88b43887b557bd40 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Sun, 29 Mar 2020 17:52:46 -0500 Subject: [PATCH 54/87] cleaned up debugging code in FindLibR --- R-package/src/cmake/modules/FindLibR.cmake | 6 ------ 1 file changed, 6 deletions(-) diff --git a/R-package/src/cmake/modules/FindLibR.cmake b/R-package/src/cmake/modules/FindLibR.cmake index 9716f99ae3b3..7d3e9cf499ab 100644 --- a/R-package/src/cmake/modules/FindLibR.cmake +++ b/R-package/src/cmake/modules/FindLibR.cmake @@ -49,7 +49,6 @@ function(create_rlib_for_msvc) # extract symbols from R.dll into R.def and R.lib import library execute_process(COMMAND ${GENDEF_EXE} - #"-" "${LIBR_LIB_DIR}/R.dll" "-" "${LIBR_CORE_LIBRARY}" OUTPUT_FILE "${CMAKE_CURRENT_BINARY_DIR}/R.def" ) @@ -185,11 +184,6 @@ endif() set(LIBR_CORE_LIBRARY ${LIBR_CORE_LIBRARY} CACHE PATH "R core shared library") -message(STATUS "LIBR_EXECUTABLE: ${LIBR_EXECUTABLE}") -message(STATUS "LIBR_HOME: ${LIBR_HOME}") -message(STATUS "LIBR_INCLUDE_DIRS: ${LIBR_INCLUDE_DIRS}") -message(STATUS "LIBR_CORE_LIBRARY: ${LIBR_CORE_LIBRARY}") - if(WIN32 AND MSVC) # create a local R.lib import library for R.dll if it doesn't exist From 42609cd4ade8c4c91a819181f43af867eda39f43 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Sun, 29 Mar 2020 17:52:46 -0500 Subject: [PATCH 55/87] cleaned up debugging code and moved R first in CI --- .appveyor.yml | 6 +- .ci/test_r_package_windows.ps1 | 22 ++- .vsts-ci.yml | 292 +++++++++++++++++---------------- CMakeLists.txt | 4 + 4 files changed, 167 insertions(+), 157 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index 0fbd8d88f8c1..669b7b516199 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -7,15 +7,15 @@ configuration: # a trick to construct a build matrix with multiple Python versi environment: matrix: + - COMPILER: MINGW + TASK: r-package + R_WINDOWS_VERSION: 3.6.3 - COMPILER: MSVC TASK: appveyor-python CONDA_ENV: test-env - COMPILER: MINGW TASK: appveyor-python CONDA_ENV: test-env - - COMPILER: MINGW - TASK: r-package - R_WINDOWS_VERSION: 3.6.3 clone_depth: 5 diff --git a/.ci/test_r_package_windows.ps1 b/.ci/test_r_package_windows.ps1 index f16ba1dc3d23..6a39f0b83542 100644 --- a/.ci/test_r_package_windows.ps1 +++ b/.ci/test_r_package_windows.ps1 @@ -1,5 +1,5 @@ # Download a file and retry upon failure. This looks like -# an infinite looop +# an infinite loop but CI-level timeouts will kill it function Download-File-With-Retries { param( [string]$url, @@ -15,6 +15,7 @@ function Download-File-With-Retries { $env:R_LIB_PATH = "C:/RLibrary" $env:PATH = "$env:R_LIB_PATH/Rtools/bin;" + "$env:R_LIB_PATH/R/bin/x64;" + "$env:R_LIB_PATH/miktex/texmfs/install/miktex/bin/x64;" + $env:PATH $env:BINPREF = "C:/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/bin/" +$env:CRAN_MIRROR = "https://cloud.r-project.org/" cd $env:BUILD_SOURCESDIRECTORY tzutil /s "GMT Standard Time" @@ -60,24 +61,27 @@ initexmf --set-config-value [MPM]AutoInstall=1 conda install -y --no-deps pandoc Add-Content .Renviron "R_LIBS=$env:R_LIB_PATH" -Add-Content .Rprofile "options(repos = 'https://cran.rstudio.com')" -Add-Content .Rprofile "options(pkgType = 'binary')" -Add-Content .Rprofile "options(install.packages.check.source = 'no')" Write-Output "Installing dependencies" -Rscript.exe -e "install.packages(c('data.table', 'jsonlite', 'Matrix', 'R6', 'testthat'), dependencies = c('Imports', 'Depends', 'LinkingTo'), lib = '$env:R_LIB_PATH')" ; Check-Output $? +$packages = "c('data.table', 'jsonlite', 'Matrix', 'R6', 'testthat'), dependencies = c('Imports', 'Depends', 'LinkingTo')" +Rscript --vanilla -e "install.packages($packages, repos = '$env:CRAN_MIRROR', pkgType = 'binary', lib = '$env:R_LIB_PATH', install.packages.check.source = 'no')" ; Check-Output $? Write-Output "Building R package" -Rscript build_r.R ; Check-Output $? +Rscript build_r.R --skip-install ; Check-Output $? $PKG_FILE_NAME = Get-Item *.tar.gz -$PKG_NAME = $PKG_FILE_NAME.BaseName.split("_")[0] -$LOG_FILE_NAME = "$PKG_NAME.Rcheck/00check.log" +$LOG_FILE_NAME = "lightgbm.Rcheck/00check.log" Write-Output "Running R CMD check" +$check_flags = "--as-cran --no-multiarch" +if ($env:AZURE -eq "true") { + $check_flags = "--no-multiarch --no-manual --ignore-vignettes" +} +Write-Output "using check flags '$check_flags'" $env:_R_CHECK_FORCE_SUGGESTS_=0 -R.exe CMD check "${PKG_FILE_NAME}" --as-cran --no-multiarch; Check-Output $? +R.exe CMD check "${PKG_FILE_NAME}" $check_flags ; Check-Output $? +Write-Output "Looking for issues with R CMD check results" if (Get-Content "$LOG_FILE_NAME" | Select-String -Pattern "WARNING" -Quiet) { echo "WARNINGS have been found by R CMD check!" Check-Output $False diff --git a/.vsts-ci.yml b/.vsts-ci.yml index 6996e2dd19db..85311f6eac03 100644 --- a/.vsts-ci.yml +++ b/.vsts-ci.yml @@ -16,101 +16,101 @@ jobs: ########################################### - job: Linux ########################################### - variables: - COMPILER: gcc - pool: - vmImage: 'ubuntu-latest' - container: ubuntu1404 - strategy: - maxParallel: 6 - matrix: - regular: - TASK: regular - sdist: - TASK: sdist - PYTHON_VERSION: 3.5 - bdist: - TASK: bdist - PYTHON_VERSION: 3.6 - inference: - TASK: if-else - mpi_source: - TASK: mpi - METHOD: source - PYTHON_VERSION: 2.7 - gpu_source: - TASK: gpu - METHOD: source - PYTHON_VERSION: 3.6 - r_package: - TASK: r-package - steps: - - script: | - echo "##vso[task.setvariable variable=HOME_DIRECTORY]$AGENT_HOMEDIRECTORY" - echo "##vso[task.setvariable variable=BUILD_DIRECTORY]$BUILD_SOURCESDIRECTORY" - echo "##vso[task.setvariable variable=OS_NAME]linux" - echo "##vso[task.setvariable variable=AZURE]true" - echo "##vso[task.setvariable variable=LGB_VER]$(head -n 1 VERSION.txt)" - echo "##vso[task.prependpath]$CONDA/bin" - AMDAPPSDK_PATH=$BUILD_SOURCESDIRECTORY/AMDAPPSDK - echo "##vso[task.setvariable variable=AMDAPPSDK_PATH]$AMDAPPSDK_PATH" - LD_LIBRARY_PATH=$AMDAPPSDK_PATH/lib/x86_64:$LD_LIBRARY_PATH - echo "##vso[task.setvariable variable=LD_LIBRARY_PATH]$LD_LIBRARY_PATH" - echo "##vso[task.setvariable variable=OPENCL_VENDOR_PATH]$AMDAPPSDK_PATH/etc/OpenCL/vendors" - displayName: 'Set variables' - - bash: $(Build.SourcesDirectory)/.ci/setup.sh - displayName: Setup - - bash: $(Build.SourcesDirectory)/.ci/test.sh - displayName: Test - - task: PublishBuildArtifacts@1 - condition: and(succeeded(), in(variables['TASK'], 'regular', 'sdist', 'bdist'), not(startsWith(variables['Build.SourceBranch'], 'refs/pull/'))) - inputs: - pathtoPublish: '$(Build.ArtifactStagingDirectory)' - artifactName: PackageAssets - artifactType: container + variables: + COMPILER: gcc + pool: + vmImage: 'ubuntu-latest' + container: ubuntu1404 + strategy: + maxParallel: 6 + matrix: + regular: + TASK: regular + sdist: + TASK: sdist + PYTHON_VERSION: 3.5 + bdist: + TASK: bdist + PYTHON_VERSION: 3.6 + inference: + TASK: if-else + mpi_source: + TASK: mpi + METHOD: source + PYTHON_VERSION: 2.7 + gpu_source: + TASK: gpu + METHOD: source + PYTHON_VERSION: 3.6 + r_package: + TASK: r-package + steps: + - script: | + echo "##vso[task.setvariable variable=HOME_DIRECTORY]$AGENT_HOMEDIRECTORY" + echo "##vso[task.setvariable variable=BUILD_DIRECTORY]$BUILD_SOURCESDIRECTORY" + echo "##vso[task.setvariable variable=OS_NAME]linux" + echo "##vso[task.setvariable variable=AZURE]true" + echo "##vso[task.setvariable variable=LGB_VER]$(head -n 1 VERSION.txt)" + echo "##vso[task.prependpath]$CONDA/bin" + AMDAPPSDK_PATH=$BUILD_SOURCESDIRECTORY/AMDAPPSDK + echo "##vso[task.setvariable variable=AMDAPPSDK_PATH]$AMDAPPSDK_PATH" + LD_LIBRARY_PATH=$AMDAPPSDK_PATH/lib/x86_64:$LD_LIBRARY_PATH + echo "##vso[task.setvariable variable=LD_LIBRARY_PATH]$LD_LIBRARY_PATH" + echo "##vso[task.setvariable variable=OPENCL_VENDOR_PATH]$AMDAPPSDK_PATH/etc/OpenCL/vendors" + displayName: 'Set variables' + - bash: $(Build.SourcesDirectory)/.ci/setup.sh + displayName: Setup + - bash: $(Build.SourcesDirectory)/.ci/test.sh + displayName: Test + - task: PublishBuildArtifacts@1 + condition: and(succeeded(), in(variables['TASK'], 'regular', 'sdist', 'bdist'), not(startsWith(variables['Build.SourceBranch'], 'refs/pull/'))) + inputs: + pathtoPublish: '$(Build.ArtifactStagingDirectory)' + artifactName: PackageAssets + artifactType: container ########################################### - job: MacOS ########################################### - variables: - COMPILER: clang - pool: - vmImage: 'macOS-10.14' - strategy: - maxParallel: 3 - matrix: - regular: - TASK: regular - PYTHON_VERSION: 3.6 - sdist: - TASK: sdist - PYTHON_VERSION: 3.5 - bdist: - TASK: bdist - r_package: - TASK: r-package - steps: - - script: | - echo "##vso[task.setvariable variable=HOME_DIRECTORY]$AGENT_HOMEDIRECTORY" - echo "##vso[task.setvariable variable=BUILD_DIRECTORY]$BUILD_SOURCESDIRECTORY" - echo "##vso[task.setvariable variable=OS_NAME]macos" - echo "##vso[task.setvariable variable=AZURE]true" - echo "##vso[task.setvariable variable=LGB_VER]$(head -n 1 VERSION.txt)" - CONDA=$AGENT_HOMEDIRECTORY/miniconda - echo "##vso[task.setvariable variable=CONDA]$CONDA" - echo "##vso[task.prependpath]$CONDA/bin" - echo "##vso[task.setvariable variable=JAVA_HOME]$JAVA_HOME_8_X64" - echo "##vso[task.setvariable variable=R_MAC_VERSION]3.6.3" - displayName: 'Set variables' - - bash: $(Build.SourcesDirectory)/.ci/setup.sh - displayName: Setup - - bash: $(Build.SourcesDirectory)/.ci/test.sh - displayName: Test - - task: PublishBuildArtifacts@1 - condition: and(succeeded(), in(variables['TASK'], 'regular', 'sdist', 'bdist'), not(startsWith(variables['Build.SourceBranch'], 'refs/pull/'))) - inputs: - pathtoPublish: '$(Build.ArtifactStagingDirectory)' - artifactName: PackageAssets - artifactType: container + variables: + COMPILER: clang + pool: + vmImage: 'macOS-10.14' + strategy: + maxParallel: 3 + matrix: + regular: + TASK: regular + PYTHON_VERSION: 3.6 + sdist: + TASK: sdist + PYTHON_VERSION: 3.5 + bdist: + TASK: bdist + r_package: + TASK: r-package + steps: + - script: | + echo "##vso[task.setvariable variable=HOME_DIRECTORY]$AGENT_HOMEDIRECTORY" + echo "##vso[task.setvariable variable=BUILD_DIRECTORY]$BUILD_SOURCESDIRECTORY" + echo "##vso[task.setvariable variable=OS_NAME]macos" + echo "##vso[task.setvariable variable=AZURE]true" + echo "##vso[task.setvariable variable=LGB_VER]$(head -n 1 VERSION.txt)" + CONDA=$AGENT_HOMEDIRECTORY/miniconda + echo "##vso[task.setvariable variable=CONDA]$CONDA" + echo "##vso[task.prependpath]$CONDA/bin" + echo "##vso[task.setvariable variable=JAVA_HOME]$JAVA_HOME_8_X64" + echo "##vso[task.setvariable variable=R_MAC_VERSION]3.6.3" + displayName: 'Set variables' + - bash: $(Build.SourcesDirectory)/.ci/setup.sh + displayName: Setup + - bash: $(Build.SourcesDirectory)/.ci/test.sh + displayName: Test + - task: PublishBuildArtifacts@1 + condition: and(succeeded(), in(variables['TASK'], 'regular', 'sdist', 'bdist'), not(startsWith(variables['Build.SourceBranch'], 'refs/pull/'))) + inputs: + pathtoPublish: '$(Build.ArtifactStagingDirectory)' + artifactName: PackageAssets + artifactType: container ########################################### - job: Windows ########################################### @@ -119,21 +119,23 @@ jobs: strategy: maxParallel: 3 matrix: + rpkg: + TASK: r-package + R_WINDOWS_VERSION: 3.6.3 regular: TASK: regular PYTHON_VERSION: 3.7 sdist: - TASK: sdist - PYTHON_VERSION: 2.7 + TASK: sdist + PYTHON_VERSION: 2.7 bdist: - TASK: bdist - PYTHON_VERSION: 3.5 - rpkg: - TASK: r-package - R_WINDOWS_VERSION: 3.6.3 + TASK: bdist + PYTHON_VERSION: 3.5 steps: - - powershell: Write-Host "##vso[task.prependpath]$env:CONDA\Scripts" - displayName: Enable conda + - powershell: | + Write-Host "##vso[task.prependpath]$env:CONDA\Scripts" + Write-Host "##vso[task.setvariable variable=AZURE]true" + displayName: 'Set Variables' - script: | cmd /c "conda init powershell" cmd /c "powershell -ExecutionPolicy Bypass -File %BUILD_SOURCESDIRECTORY%/.ci/test_windows.ps1" @@ -148,47 +150,47 @@ jobs: ########################################### - job: Package ########################################### - dependsOn: - - Linux - - MacOS - - Windows - condition: and(succeeded(), not(startsWith(variables['Build.SourceBranch'], 'refs/pull/'))) - pool: - vmImage: 'vs2017-win2016' - steps: - # Download all agent packages from all previous phases - - task: DownloadBuildArtifacts@0 - displayName: Download package assets - inputs: - artifactName: PackageAssets - downloadPath: $(Build.SourcesDirectory)/binaries - - script: | - python %BUILD_SOURCESDIRECTORY%/.nuget/create_nuget.py %BUILD_SOURCESDIRECTORY%/binaries/PackageAssets - displayName: 'Create NuGet configuration files' - - task: NuGetCommand@2 - inputs: - command: pack - packagesToPack: '$(Build.SourcesDirectory)/.nuget/*.nuspec' - packDestination: '$(Build.ArtifactStagingDirectory)' - - task: PublishBuildArtifacts@1 - inputs: - pathtoPublish: '$(Build.ArtifactStagingDirectory)' - artifactName: NuGet - artifactType: container - - task: GitHubRelease@0 - displayName: 'Create GitHub Release' - condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/v')) - inputs: - gitHubConnection: guolinke - repositoryName: '$(Build.Repository.Name)' - action: 'create' - target: '$(Build.SourceVersion)' - tagSource: 'auto' - title: '$(Build.SourceBranchName)' - assets: | - $(Build.SourcesDirectory)/binaries/PackageAssets/* - $(Build.ArtifactStagingDirectory)/*.nupkg - assetUploadMode: 'delete' - isDraft: true - isPreRelease: false - addChangeLog: false + dependsOn: + - Linux + - MacOS + - Windows + condition: and(succeeded(), not(startsWith(variables['Build.SourceBranch'], 'refs/pull/'))) + pool: + vmImage: 'vs2017-win2016' + steps: + # Download all agent packages from all previous phases + - task: DownloadBuildArtifacts@0 + displayName: Download package assets + inputs: + artifactName: PackageAssets + downloadPath: $(Build.SourcesDirectory)/binaries + - script: | + python %BUILD_SOURCESDIRECTORY%/.nuget/create_nuget.py %BUILD_SOURCESDIRECTORY%/binaries/PackageAssets + displayName: 'Create NuGet configuration files' + - task: NuGetCommand@2 + inputs: + command: pack + packagesToPack: '$(Build.SourcesDirectory)/.nuget/*.nuspec' + packDestination: '$(Build.ArtifactStagingDirectory)' + - task: PublishBuildArtifacts@1 + inputs: + pathtoPublish: '$(Build.ArtifactStagingDirectory)' + artifactName: NuGet + artifactType: container + - task: GitHubRelease@0 + displayName: 'Create GitHub Release' + condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/v')) + inputs: + gitHubConnection: guolinke + repositoryName: '$(Build.Repository.Name)' + action: 'create' + target: '$(Build.SourceVersion)' + tagSource: 'auto' + title: '$(Build.SourceBranchName)' + assets: | + $(Build.SourcesDirectory)/binaries/PackageAssets/* + $(Build.ArtifactStagingDirectory)/*.nupkg + assetUploadMode: 'delete' + isDraft: true + isPreRelease: false + addChangeLog: false diff --git a/CMakeLists.txt b/CMakeLists.txt index 494bfd4324bd..2ecd401831fc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -318,6 +318,10 @@ endif() if(BUILD_FOR_R) if(MSVC) # https://docs.microsoft.com/en-us/cpp/build/reference/link-input-files?redirectedfrom=MSDN&view=vs-2019 + set_property( + TARGET _lightgbm + PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreadedDLL" + ) TARGET_LINK_LIBRARIES(_lightgbm ${CMAKE_CURRENT_BINARY_DIR}/R.lib) else() TARGET_LINK_LIBRARIES(_lightgbm ${LIBR_CORE_LIBRARY}) From 2804d45e70afb88156f37a17f4346cb86cf3f1b3 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Mon, 30 Mar 2020 22:00:30 -0500 Subject: [PATCH 56/87] fixed vsts-ci indentation --- .vsts-ci.yml | 272 +++++++++++++++++++++++++-------------------------- 1 file changed, 136 insertions(+), 136 deletions(-) diff --git a/.vsts-ci.yml b/.vsts-ci.yml index 85311f6eac03..879a039caf90 100644 --- a/.vsts-ci.yml +++ b/.vsts-ci.yml @@ -16,101 +16,101 @@ jobs: ########################################### - job: Linux ########################################### - variables: - COMPILER: gcc - pool: - vmImage: 'ubuntu-latest' - container: ubuntu1404 - strategy: - maxParallel: 6 - matrix: - regular: - TASK: regular - sdist: - TASK: sdist - PYTHON_VERSION: 3.5 - bdist: - TASK: bdist - PYTHON_VERSION: 3.6 - inference: - TASK: if-else - mpi_source: - TASK: mpi - METHOD: source - PYTHON_VERSION: 2.7 - gpu_source: - TASK: gpu - METHOD: source - PYTHON_VERSION: 3.6 - r_package: - TASK: r-package - steps: - - script: | - echo "##vso[task.setvariable variable=HOME_DIRECTORY]$AGENT_HOMEDIRECTORY" - echo "##vso[task.setvariable variable=BUILD_DIRECTORY]$BUILD_SOURCESDIRECTORY" - echo "##vso[task.setvariable variable=OS_NAME]linux" - echo "##vso[task.setvariable variable=AZURE]true" - echo "##vso[task.setvariable variable=LGB_VER]$(head -n 1 VERSION.txt)" - echo "##vso[task.prependpath]$CONDA/bin" - AMDAPPSDK_PATH=$BUILD_SOURCESDIRECTORY/AMDAPPSDK - echo "##vso[task.setvariable variable=AMDAPPSDK_PATH]$AMDAPPSDK_PATH" - LD_LIBRARY_PATH=$AMDAPPSDK_PATH/lib/x86_64:$LD_LIBRARY_PATH - echo "##vso[task.setvariable variable=LD_LIBRARY_PATH]$LD_LIBRARY_PATH" - echo "##vso[task.setvariable variable=OPENCL_VENDOR_PATH]$AMDAPPSDK_PATH/etc/OpenCL/vendors" - displayName: 'Set variables' - - bash: $(Build.SourcesDirectory)/.ci/setup.sh - displayName: Setup - - bash: $(Build.SourcesDirectory)/.ci/test.sh - displayName: Test - - task: PublishBuildArtifacts@1 - condition: and(succeeded(), in(variables['TASK'], 'regular', 'sdist', 'bdist'), not(startsWith(variables['Build.SourceBranch'], 'refs/pull/'))) - inputs: - pathtoPublish: '$(Build.ArtifactStagingDirectory)' - artifactName: PackageAssets - artifactType: container + variables: + COMPILER: gcc + pool: + vmImage: 'ubuntu-latest' + container: ubuntu1404 + strategy: + maxParallel: 6 + matrix: + regular: + TASK: regular + sdist: + TASK: sdist + PYTHON_VERSION: 3.5 + bdist: + TASK: bdist + PYTHON_VERSION: 3.6 + inference: + TASK: if-else + mpi_source: + TASK: mpi + METHOD: source + PYTHON_VERSION: 2.7 + gpu_source: + TASK: gpu + METHOD: source + PYTHON_VERSION: 3.6 + r_package: + TASK: r-package + steps: + - script: | + echo "##vso[task.setvariable variable=HOME_DIRECTORY]$AGENT_HOMEDIRECTORY" + echo "##vso[task.setvariable variable=BUILD_DIRECTORY]$BUILD_SOURCESDIRECTORY" + echo "##vso[task.setvariable variable=OS_NAME]linux" + echo "##vso[task.setvariable variable=AZURE]true" + echo "##vso[task.setvariable variable=LGB_VER]$(head -n 1 VERSION.txt)" + echo "##vso[task.prependpath]$CONDA/bin" + AMDAPPSDK_PATH=$BUILD_SOURCESDIRECTORY/AMDAPPSDK + echo "##vso[task.setvariable variable=AMDAPPSDK_PATH]$AMDAPPSDK_PATH" + LD_LIBRARY_PATH=$AMDAPPSDK_PATH/lib/x86_64:$LD_LIBRARY_PATH + echo "##vso[task.setvariable variable=LD_LIBRARY_PATH]$LD_LIBRARY_PATH" + echo "##vso[task.setvariable variable=OPENCL_VENDOR_PATH]$AMDAPPSDK_PATH/etc/OpenCL/vendors" + displayName: 'Set variables' + - bash: $(Build.SourcesDirectory)/.ci/setup.sh + displayName: Setup + - bash: $(Build.SourcesDirectory)/.ci/test.sh + displayName: Test + - task: PublishBuildArtifacts@1 + condition: and(succeeded(), in(variables['TASK'], 'regular', 'sdist', 'bdist'), not(startsWith(variables['Build.SourceBranch'], 'refs/pull/'))) + inputs: + pathtoPublish: '$(Build.ArtifactStagingDirectory)' + artifactName: PackageAssets + artifactType: container ########################################### - job: MacOS ########################################### - variables: - COMPILER: clang - pool: - vmImage: 'macOS-10.14' - strategy: - maxParallel: 3 - matrix: - regular: - TASK: regular - PYTHON_VERSION: 3.6 - sdist: - TASK: sdist - PYTHON_VERSION: 3.5 - bdist: - TASK: bdist - r_package: - TASK: r-package - steps: - - script: | - echo "##vso[task.setvariable variable=HOME_DIRECTORY]$AGENT_HOMEDIRECTORY" - echo "##vso[task.setvariable variable=BUILD_DIRECTORY]$BUILD_SOURCESDIRECTORY" - echo "##vso[task.setvariable variable=OS_NAME]macos" - echo "##vso[task.setvariable variable=AZURE]true" - echo "##vso[task.setvariable variable=LGB_VER]$(head -n 1 VERSION.txt)" - CONDA=$AGENT_HOMEDIRECTORY/miniconda - echo "##vso[task.setvariable variable=CONDA]$CONDA" - echo "##vso[task.prependpath]$CONDA/bin" - echo "##vso[task.setvariable variable=JAVA_HOME]$JAVA_HOME_8_X64" - echo "##vso[task.setvariable variable=R_MAC_VERSION]3.6.3" - displayName: 'Set variables' - - bash: $(Build.SourcesDirectory)/.ci/setup.sh - displayName: Setup - - bash: $(Build.SourcesDirectory)/.ci/test.sh - displayName: Test - - task: PublishBuildArtifacts@1 - condition: and(succeeded(), in(variables['TASK'], 'regular', 'sdist', 'bdist'), not(startsWith(variables['Build.SourceBranch'], 'refs/pull/'))) - inputs: - pathtoPublish: '$(Build.ArtifactStagingDirectory)' - artifactName: PackageAssets - artifactType: container + variables: + COMPILER: clang + pool: + vmImage: 'macOS-10.14' + strategy: + maxParallel: 3 + matrix: + regular: + TASK: regular + PYTHON_VERSION: 3.6 + sdist: + TASK: sdist + PYTHON_VERSION: 3.5 + bdist: + TASK: bdist + r_package: + TASK: r-package + steps: + - script: | + echo "##vso[task.setvariable variable=HOME_DIRECTORY]$AGENT_HOMEDIRECTORY" + echo "##vso[task.setvariable variable=BUILD_DIRECTORY]$BUILD_SOURCESDIRECTORY" + echo "##vso[task.setvariable variable=OS_NAME]macos" + echo "##vso[task.setvariable variable=AZURE]true" + echo "##vso[task.setvariable variable=LGB_VER]$(head -n 1 VERSION.txt)" + CONDA=$AGENT_HOMEDIRECTORY/miniconda + echo "##vso[task.setvariable variable=CONDA]$CONDA" + echo "##vso[task.prependpath]$CONDA/bin" + echo "##vso[task.setvariable variable=JAVA_HOME]$JAVA_HOME_8_X64" + echo "##vso[task.setvariable variable=R_MAC_VERSION]3.6.3" + displayName: 'Set variables' + - bash: $(Build.SourcesDirectory)/.ci/setup.sh + displayName: Setup + - bash: $(Build.SourcesDirectory)/.ci/test.sh + displayName: Test + - task: PublishBuildArtifacts@1 + condition: and(succeeded(), in(variables['TASK'], 'regular', 'sdist', 'bdist'), not(startsWith(variables['Build.SourceBranch'], 'refs/pull/'))) + inputs: + pathtoPublish: '$(Build.ArtifactStagingDirectory)' + artifactName: PackageAssets + artifactType: container ########################################### - job: Windows ########################################### @@ -150,47 +150,47 @@ jobs: ########################################### - job: Package ########################################### - dependsOn: - - Linux - - MacOS - - Windows - condition: and(succeeded(), not(startsWith(variables['Build.SourceBranch'], 'refs/pull/'))) - pool: - vmImage: 'vs2017-win2016' - steps: - # Download all agent packages from all previous phases - - task: DownloadBuildArtifacts@0 - displayName: Download package assets - inputs: - artifactName: PackageAssets - downloadPath: $(Build.SourcesDirectory)/binaries - - script: | - python %BUILD_SOURCESDIRECTORY%/.nuget/create_nuget.py %BUILD_SOURCESDIRECTORY%/binaries/PackageAssets - displayName: 'Create NuGet configuration files' - - task: NuGetCommand@2 - inputs: - command: pack - packagesToPack: '$(Build.SourcesDirectory)/.nuget/*.nuspec' - packDestination: '$(Build.ArtifactStagingDirectory)' - - task: PublishBuildArtifacts@1 - inputs: - pathtoPublish: '$(Build.ArtifactStagingDirectory)' - artifactName: NuGet - artifactType: container - - task: GitHubRelease@0 - displayName: 'Create GitHub Release' - condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/v')) - inputs: - gitHubConnection: guolinke - repositoryName: '$(Build.Repository.Name)' - action: 'create' - target: '$(Build.SourceVersion)' - tagSource: 'auto' - title: '$(Build.SourceBranchName)' - assets: | - $(Build.SourcesDirectory)/binaries/PackageAssets/* - $(Build.ArtifactStagingDirectory)/*.nupkg - assetUploadMode: 'delete' - isDraft: true - isPreRelease: false - addChangeLog: false + dependsOn: + - Linux + - MacOS + - Windows + condition: and(succeeded(), not(startsWith(variables['Build.SourceBranch'], 'refs/pull/'))) + pool: + vmImage: 'vs2017-win2016' + steps: + # Download all agent packages from all previous phases + - task: DownloadBuildArtifacts@0 + displayName: Download package assets + inputs: + artifactName: PackageAssets + downloadPath: $(Build.SourcesDirectory)/binaries + - script: | + python %BUILD_SOURCESDIRECTORY%/.nuget/create_nuget.py %BUILD_SOURCESDIRECTORY%/binaries/PackageAssets + displayName: 'Create NuGet configuration files' + - task: NuGetCommand@2 + inputs: + command: pack + packagesToPack: '$(Build.SourcesDirectory)/.nuget/*.nuspec' + packDestination: '$(Build.ArtifactStagingDirectory)' + - task: PublishBuildArtifacts@1 + inputs: + pathtoPublish: '$(Build.ArtifactStagingDirectory)' + artifactName: NuGet + artifactType: container + - task: GitHubRelease@0 + displayName: 'Create GitHub Release' + condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/v')) + inputs: + gitHubConnection: guolinke + repositoryName: '$(Build.Repository.Name)' + action: 'create' + target: '$(Build.SourceVersion)' + tagSource: 'auto' + title: '$(Build.SourceBranchName)' + assets: | + $(Build.SourcesDirectory)/binaries/PackageAssets/* + $(Build.ArtifactStagingDirectory)/*.nupkg + assetUploadMode: 'delete' + isDraft: true + isPreRelease: false + addChangeLog: false From af3c0047160b959729eed7b05a2dbf9602b39f97 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Mon, 30 Mar 2020 22:43:58 -0500 Subject: [PATCH 57/87] cut documentation stuff out of MSVC build --- .ci/test_r_package_windows.ps1 | 11 ++++++----- .vsts-ci.yml | 16 ++++++++-------- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/.ci/test_r_package_windows.ps1 b/.ci/test_r_package_windows.ps1 index 6a39f0b83542..3021a1ecadcd 100644 --- a/.ci/test_r_package_windows.ps1 +++ b/.ci/test_r_package_windows.ps1 @@ -73,13 +73,14 @@ $PKG_FILE_NAME = Get-Item *.tar.gz $LOG_FILE_NAME = "lightgbm.Rcheck/00check.log" Write-Output "Running R CMD check" -$check_flags = "--as-cran --no-multiarch" +$env:_R_CHECK_FORCE_SUGGESTS_=0 if ($env:AZURE -eq "true") { - $check_flags = "--no-multiarch --no-manual --ignore-vignettes" + Write-Output "Running R CMD check without checking documentation" + R.exe CMD check --no-multiarch --no-manual --ignore-vignettes ; Check-Output $? +} else { + Write-Output "Running R CMD check as CRAN" + R.exe CMD check --no-multiarch --as-cran ${PKG_FILE_NAME} ; Check-Output $? } -Write-Output "using check flags '$check_flags'" -$env:_R_CHECK_FORCE_SUGGESTS_=0 -R.exe CMD check "${PKG_FILE_NAME}" $check_flags ; Check-Output $? Write-Output "Looking for issues with R CMD check results" if (Get-Content "$LOG_FILE_NAME" | Select-String -Pattern "WARNING" -Quiet) { diff --git a/.vsts-ci.yml b/.vsts-ci.yml index 879a039caf90..81fbc1c38366 100644 --- a/.vsts-ci.yml +++ b/.vsts-ci.yml @@ -24,6 +24,8 @@ jobs: strategy: maxParallel: 6 matrix: + r_package: + TASK: r-package regular: TASK: regular sdist: @@ -42,8 +44,6 @@ jobs: TASK: gpu METHOD: source PYTHON_VERSION: 3.6 - r_package: - TASK: r-package steps: - script: | echo "##vso[task.setvariable variable=HOME_DIRECTORY]$AGENT_HOMEDIRECTORY" @@ -78,6 +78,8 @@ jobs: strategy: maxParallel: 3 matrix: + r_package: + TASK: r-package regular: TASK: regular PYTHON_VERSION: 3.6 @@ -86,8 +88,6 @@ jobs: PYTHON_VERSION: 3.5 bdist: TASK: bdist - r_package: - TASK: r-package steps: - script: | echo "##vso[task.setvariable variable=HOME_DIRECTORY]$AGENT_HOMEDIRECTORY" @@ -126,11 +126,11 @@ jobs: TASK: regular PYTHON_VERSION: 3.7 sdist: - TASK: sdist - PYTHON_VERSION: 2.7 + TASK: sdist + PYTHON_VERSION: 2.7 bdist: - TASK: bdist - PYTHON_VERSION: 3.5 + TASK: bdist + PYTHON_VERSION: 3.5 steps: - powershell: | Write-Host "##vso[task.prependpath]$env:CONDA\Scripts" From 1c498d00e29057ed0a69b185e339800acc8aa029 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Mon, 30 Mar 2020 22:58:19 -0500 Subject: [PATCH 58/87] fix R CMD check for Azure --- .ci/test_r_package_windows.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.ci/test_r_package_windows.ps1 b/.ci/test_r_package_windows.ps1 index 3021a1ecadcd..5ac5a49cb6f0 100644 --- a/.ci/test_r_package_windows.ps1 +++ b/.ci/test_r_package_windows.ps1 @@ -76,10 +76,10 @@ Write-Output "Running R CMD check" $env:_R_CHECK_FORCE_SUGGESTS_=0 if ($env:AZURE -eq "true") { Write-Output "Running R CMD check without checking documentation" - R.exe CMD check --no-multiarch --no-manual --ignore-vignettes ; Check-Output $? + R.exe CMD check --no-multiarch --no-manual --ignore-vignettes ${PKG_FILE_NAME} ; Check-Output $? } else { Write-Output "Running R CMD check as CRAN" - R.exe CMD check --no-multiarch --as-cran ${PKG_FILE_NAME} ; Check-Output $? + R.exe CMD check --no-multiarch --as-cran ${PKG_FILE_NAME} ; Check-Output $? } Write-Output "Looking for issues with R CMD check results" From 9e6aa498623dd44cce346417928ed3af46d95a82 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Tue, 31 Mar 2020 11:06:28 -0500 Subject: [PATCH 59/87] misc whitespace changes --- .ci/test_r_package_windows.ps1 | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.ci/test_r_package_windows.ps1 b/.ci/test_r_package_windows.ps1 index 5ac5a49cb6f0..e4bf86158fc9 100644 --- a/.ci/test_r_package_windows.ps1 +++ b/.ci/test_r_package_windows.ps1 @@ -72,13 +72,12 @@ Rscript build_r.R --skip-install ; Check-Output $? $PKG_FILE_NAME = Get-Item *.tar.gz $LOG_FILE_NAME = "lightgbm.Rcheck/00check.log" -Write-Output "Running R CMD check" $env:_R_CHECK_FORCE_SUGGESTS_=0 if ($env:AZURE -eq "true") { Write-Output "Running R CMD check without checking documentation" R.exe CMD check --no-multiarch --no-manual --ignore-vignettes ${PKG_FILE_NAME} ; Check-Output $? } else { - Write-Output "Running R CMD check as CRAN" + Write-Output "Running R CMD check as CRAN" R.exe CMD check --no-multiarch --as-cran ${PKG_FILE_NAME} ; Check-Output $? } From d100027e2c8a781f8b07bc433d72b2fb09b7d869 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Fri, 3 Apr 2020 22:28:44 -0500 Subject: [PATCH 60/87] Added echoing of build logs from R CMD check --- .ci/test_r_package_windows.ps1 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.ci/test_r_package_windows.ps1 b/.ci/test_r_package_windows.ps1 index e4bf86158fc9..5273e26809b4 100644 --- a/.ci/test_r_package_windows.ps1 +++ b/.ci/test_r_package_windows.ps1 @@ -81,6 +81,9 @@ if ($env:AZURE -eq "true") { R.exe CMD check --no-multiarch --as-cran ${PKG_FILE_NAME} ; Check-Output $? } +Write-Output "R CMD check build logs:" +Get-Content -Path $env:BUILD_SOURCESDIRECTORY\lightgbm.Rcheck\00install.out + Write-Output "Looking for issues with R CMD check results" if (Get-Content "$LOG_FILE_NAME" | Select-String -Pattern "WARNING" -Quiet) { echo "WARNINGS have been found by R CMD check!" From 912a2fd4a33cf97fde2a05472787f4c6ebdd50dc Mon Sep 17 00:00:00 2001 From: James Lamb Date: Fri, 3 Apr 2020 23:55:10 -0500 Subject: [PATCH 61/87] cut out more documentation tests --- .ci/test_r_package_windows.ps1 | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/.ci/test_r_package_windows.ps1 b/.ci/test_r_package_windows.ps1 index 5273e26809b4..a8dfa5fcdac8 100644 --- a/.ci/test_r_package_windows.ps1 +++ b/.ci/test_r_package_windows.ps1 @@ -45,7 +45,12 @@ if (!(Get-Command R.exe -errorAction SilentlyContinue)) { Start-Process -FilePath Rtools.exe -NoNewWindow -Wait -ArgumentList "/VERYSILENT /DIR=$env:R_LIB_PATH/Rtools" ; Check-Output $? Write-Output "Done installing Rtools" - # download Miktex +} + +# MiKTeX and pandoc can be skipped on Azure builds, since we don't +# build the package documentation there +if ($env:AZURE -ne "true") { + Write-Output "Downloading MiKTeX" Download-File-With-Retries -url "https://miktex.org/download/win/miktexsetup-x64.zip" -destfile "miktexsetup-x64.zip" Add-Type -AssemblyName System.IO.Compression.FileSystem @@ -54,17 +59,17 @@ if (!(Get-Command R.exe -errorAction SilentlyContinue)) { .\miktex\miktexsetup.exe --local-package-repository=./miktex/download --package-set=essential --quiet download ; Check-Output $? Write-Output "Installing MiKTeX" .\miktex\download\miktexsetup.exe --portable="$env:R_LIB_PATH/miktex" --quiet install ; Check-Output $? - Write-Output "Done installing R, Rtools, and MiKTeX" -} + Write-Output "Done installing MiKTeX" -initexmf --set-config-value [MPM]AutoInstall=1 -conda install -y --no-deps pandoc + initexmf --set-config-value [MPM]AutoInstall=1 + conda install -y --no-deps pandoc +} Add-Content .Renviron "R_LIBS=$env:R_LIB_PATH" Write-Output "Installing dependencies" $packages = "c('data.table', 'jsonlite', 'Matrix', 'R6', 'testthat'), dependencies = c('Imports', 'Depends', 'LinkingTo')" -Rscript --vanilla -e "install.packages($packages, repos = '$env:CRAN_MIRROR', pkgType = 'binary', lib = '$env:R_LIB_PATH', install.packages.check.source = 'no')" ; Check-Output $? +Rscript --vanilla -e "options(install.packages.check.source = 'no'); install.packages($packages, repos = '$env:CRAN_MIRROR', type = 'binary', lib = '$env:R_LIB_PATH')" ; Check-Output $? Write-Output "Building R package" Rscript build_r.R --skip-install ; Check-Output $? @@ -75,7 +80,7 @@ $LOG_FILE_NAME = "lightgbm.Rcheck/00check.log" $env:_R_CHECK_FORCE_SUGGESTS_=0 if ($env:AZURE -eq "true") { Write-Output "Running R CMD check without checking documentation" - R.exe CMD check --no-multiarch --no-manual --ignore-vignettes ${PKG_FILE_NAME} ; Check-Output $? + R.exe CMD check --no-multiarch --no-examples --no-manual --ignore-vignettes ${PKG_FILE_NAME} ; Check-Output $? } else { Write-Output "Running R CMD check as CRAN" R.exe CMD check --no-multiarch --as-cran ${PKG_FILE_NAME} ; Check-Output $? From d76b551f3090a4084abe48b869d07f8436f3b7fc Mon Sep 17 00:00:00 2001 From: James Lamb Date: Sat, 4 Apr 2020 00:27:54 -0500 Subject: [PATCH 62/87] fixed NOTE about imports from Matrix --- R-package/NAMESPACE | 1 + R-package/R/lightgbm.R | 1 + 2 files changed, 2 insertions(+) diff --git a/R-package/NAMESPACE b/R-package/NAMESPACE index 7aef39a1f6de..14db7ba98d6c 100644 --- a/R-package/NAMESPACE +++ b/R-package/NAMESPACE @@ -36,6 +36,7 @@ export(saveRDS.lgb.Booster) export(setinfo) export(slice) import(methods) +importFrom(Matrix,Matrix) importFrom(R6,R6Class) importFrom(data.table,":=") importFrom(data.table,as.data.table) diff --git a/R-package/R/lightgbm.R b/R-package/R/lightgbm.R index 9459ccc4d5c4..12640ecfb0af 100644 --- a/R-package/R/lightgbm.R +++ b/R-package/R/lightgbm.R @@ -178,6 +178,7 @@ NULL # Various imports #' @import methods +#' @importFrom Matrix Matrix #' @importFrom R6 R6Class #' @useDynLib lib_lightgbm , .registration = TRUE NULL From 88a7a099893747df4ba4739b74531d866a35e097 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Tue, 14 Apr 2020 21:19:08 -0500 Subject: [PATCH 63/87] moved some changes out of this PR and into #2963 --- .vsts-ci.yml | 11 +++----- CMakeLists.txt | 15 +++-------- R-package/src/cmake/modules/FindLibR.cmake | 30 +++++++++++++--------- 3 files changed, 25 insertions(+), 31 deletions(-) diff --git a/.vsts-ci.yml b/.vsts-ci.yml index 5e99f9d36f45..a39dbc0e105b 100644 --- a/.vsts-ci.yml +++ b/.vsts-ci.yml @@ -24,8 +24,6 @@ jobs: strategy: maxParallel: 6 matrix: - r_package: - TASK: r-package regular: TASK: regular sdist: @@ -44,6 +42,8 @@ jobs: TASK: gpu METHOD: source PYTHON_VERSION: 3.6 + r_package: + TASK: r-package steps: - script: | echo "##vso[task.setvariable variable=HOME_DIRECTORY]$AGENT_HOMEDIRECTORY" @@ -78,8 +78,6 @@ jobs: strategy: maxParallel: 3 matrix: - r_package: - TASK: r-package regular: TASK: regular PYTHON_VERSION: 3.7 @@ -88,6 +86,8 @@ jobs: PYTHON_VERSION: 3.5 bdist: TASK: bdist + r_package: + TASK: r-package steps: - script: | echo "##vso[task.setvariable variable=HOME_DIRECTORY]$AGENT_HOMEDIRECTORY" @@ -119,9 +119,6 @@ jobs: strategy: maxParallel: 3 matrix: - rpkg: - TASK: r-package - R_WINDOWS_VERSION: 3.6.3 regular: TASK: regular PYTHON_VERSION: 3.6 diff --git a/CMakeLists.txt b/CMakeLists.txt index 2ecd401831fc..ed09e3c03dd7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -280,9 +280,9 @@ if(USE_SWIG) COMMAND "${Java_JAR_EXECUTABLE}" -cf lightgbmlib.jar com) else() add_custom_command(TARGET _lightgbm_swig POST_BUILD - COMMAND "${Java_JAVAC_EXECUTABLE}" -d . java/*.java - COMMAND cp "${PROJECT_SOURCE_DIR}/*.so" com/microsoft/ml/lightgbm/linux/x86_64 - COMMAND "${Java_JAR_EXECUTABLE}" -cf lightgbmlib.jar com) + COMMAND "${Java_JAVAC_EXECUTABLE}" -d . java/*.java + COMMAND cp "${PROJECT_SOURCE_DIR}/*.so" com/microsoft/ml/lightgbm/linux/x86_64 + COMMAND "${Java_JAR_EXECUTABLE}" -cf lightgbmlib.jar com) endif() endif(USE_SWIG) @@ -316,16 +316,7 @@ if(WIN32 AND (MINGW OR CYGWIN)) endif() if(BUILD_FOR_R) - if(MSVC) - # https://docs.microsoft.com/en-us/cpp/build/reference/link-input-files?redirectedfrom=MSDN&view=vs-2019 - set_property( - TARGET _lightgbm - PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreadedDLL" - ) - TARGET_LINK_LIBRARIES(_lightgbm ${CMAKE_CURRENT_BINARY_DIR}/R.lib) - else() TARGET_LINK_LIBRARIES(_lightgbm ${LIBR_CORE_LIBRARY}) - endif() endif(BUILD_FOR_R) install(TARGETS lightgbm _lightgbm diff --git a/R-package/src/cmake/modules/FindLibR.cmake b/R-package/src/cmake/modules/FindLibR.cmake index 7d3e9cf499ab..307b23fa19d7 100644 --- a/R-package/src/cmake/modules/FindLibR.cmake +++ b/R-package/src/cmake/modules/FindLibR.cmake @@ -10,6 +10,7 @@ # LIBR_HOME # LIBR_EXECUTABLE # LIBR_INCLUDE_DIRS +# LIBR_LIB_DIR # LIBR_CORE_LIBRARY # and a CMake function to create R.lib for MSVC @@ -35,8 +36,8 @@ function(create_rlib_for_msvc) message(FATAL_ERROR "create_rlib_for_msvc() can only be used with MSVC") endif() - if(NOT EXISTS "${LIBR_CORE_LIBRARY}") - message(FATAL_ERROR "LIBR_CORE_LIBRARY, '${LIBR_CORE_LIBRARY}', not found") + if(NOT EXISTS "${LIBR_LIB_DIR}") + message(FATAL_ERROR "LIBR_LIB_DIR, '${LIBR_LIB_DIR}', not found") endif() find_program(GENDEF_EXE gendef) @@ -49,7 +50,7 @@ function(create_rlib_for_msvc) # extract symbols from R.dll into R.def and R.lib import library execute_process(COMMAND ${GENDEF_EXE} - "-" "${LIBR_CORE_LIBRARY}" + "-" "${LIBR_LIB_DIR}/R.dll" OUTPUT_FILE "${CMAKE_CURRENT_BINARY_DIR}/R.def" ) execute_process(COMMAND ${DLLTOOL_EXE} @@ -167,20 +168,24 @@ execute_process( OUTPUT_VARIABLE LIBR_INCLUDE_DIRS ) +# ask R for the lib dir +execute_process( + COMMAND ${LIBR_EXECUTABLE} "--slave" "--vanilla" "-e" "cat(normalizePath(R.home('lib'), winslash='/'))" + OUTPUT_VARIABLE LIBR_LIB_DIR +) + set(LIBR_HOME ${LIBR_HOME} CACHE PATH "R home directory") set(LIBR_EXECUTABLE ${LIBR_EXECUTABLE} CACHE PATH "R executable") set(LIBR_INCLUDE_DIRS ${LIBR_INCLUDE_DIRS} CACHE PATH "R include directory") +set(LIBR_LIB_DIR ${LIBR_LIB_DIR} CACHE PATH "R shared libraries directory") # look for the core R library -if(WIN32) - set(LIBR_CORE_LIBRARY ${LIBR_HOME}/bin/${R_ARCH}/R.dll) -else() - find_library( - LIBR_CORE_LIBRARY - NAMES R - HINTS "${CMAKE_CURRENT_BINARY_DIR}" "${LIBR_HOME}/lib" "${LIBR_HOME}/bin/${R_ARCH}" "${LIBR_HOME}/bin" "${LIBR_LIBRARIES}" - ) -endif() +find_library( + LIBR_CORE_LIBRARY + NAMES R R.dll + HINTS "${CMAKE_CURRENT_BINARY_DIR}" "${LIBR_HOME}/lib" "${LIBR_HOME}/bin/${R_ARCH}" "${LIBR_HOME}/bin" "${LIBR_LIBRARIES}" + PATHS "${LIBR_HOME}/bin/${R_ARCH}/R.dll" +) set(LIBR_CORE_LIBRARY ${LIBR_CORE_LIBRARY} CACHE PATH "R core shared library") @@ -200,5 +205,6 @@ find_package_handle_standard_args(LibR DEFAULT_MSG LIBR_HOME LIBR_EXECUTABLE LIBR_INCLUDE_DIRS + LIBR_LIB_DIR LIBR_CORE_LIBRARY ) From ae813f2b1f1627c8bce4703db4e0bc17792e5770 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Tue, 14 Apr 2020 21:23:50 -0500 Subject: [PATCH 64/87] fixed whitespace stuff --- .appveyor.yml | 2 +- CMakeLists.txt | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index 70764849c0de..abb0459de7b5 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -1,4 +1,4 @@ -version: 2.3.2.{build} +version: 2.3.2.{build} image: Visual Studio 2015 platform: x64 diff --git a/CMakeLists.txt b/CMakeLists.txt index ed09e3c03dd7..e0734b0534ab 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -280,9 +280,9 @@ if(USE_SWIG) COMMAND "${Java_JAR_EXECUTABLE}" -cf lightgbmlib.jar com) else() add_custom_command(TARGET _lightgbm_swig POST_BUILD - COMMAND "${Java_JAVAC_EXECUTABLE}" -d . java/*.java - COMMAND cp "${PROJECT_SOURCE_DIR}/*.so" com/microsoft/ml/lightgbm/linux/x86_64 - COMMAND "${Java_JAR_EXECUTABLE}" -cf lightgbmlib.jar com) + COMMAND "${Java_JAVAC_EXECUTABLE}" -d . java/*.java + COMMAND cp "${PROJECT_SOURCE_DIR}/*.so" com/microsoft/ml/lightgbm/linux/x86_64 + COMMAND "${Java_JAR_EXECUTABLE}" -cf lightgbmlib.jar com) endif() endif(USE_SWIG) From 1b2363a64145a2931f0f02947de751c1f973578c Mon Sep 17 00:00:00 2001 From: James Lamb Date: Tue, 14 Apr 2020 22:14:56 -0500 Subject: [PATCH 65/87] added check on number of NOTES --- .ci/test_r_package_windows.ps1 | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.ci/test_r_package_windows.ps1 b/.ci/test_r_package_windows.ps1 index a8dfa5fcdac8..26290b5dac7e 100644 --- a/.ci/test_r_package_windows.ps1 +++ b/.ci/test_r_package_windows.ps1 @@ -95,5 +95,13 @@ if (Get-Content "$LOG_FILE_NAME" | Select-String -Pattern "WARNING" -Quiet) { Check-Output $False } +$ALLOWED_CHECK_NOTES=3 +$note_str = Get-Content "${LOG_FILE_NAME}" | Select-String -Pattern ' NOTE' | Out-String +$NUM_CHECK_NOTES = $note_str.replace("Status: ", "").replace(" ", "").replace("NOTE", "").replace("s", "") +if ( [int]$NUM_CHECK_NOTES -gt $ALLOWED_CHECK_NOTES ){ + Write-Output "Found ${NUM_CHECK_NOTES} NOTEs from R CMD check. Only ${ALLOWED_CHECK_NOTES} are allowed" + Check-Output $False +} + Write-Output "No issues were found checking the R package" Exit 0 From dd52dbf6908a37f1cb2809beee53d33b1c79c0a4 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Tue, 14 Apr 2020 22:38:50 -0500 Subject: [PATCH 66/87] adding better checks --- .ci/test_r_package_windows.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.ci/test_r_package_windows.ps1 b/.ci/test_r_package_windows.ps1 index 26290b5dac7e..e888c0d497a0 100644 --- a/.ci/test_r_package_windows.ps1 +++ b/.ci/test_r_package_windows.ps1 @@ -96,8 +96,8 @@ if (Get-Content "$LOG_FILE_NAME" | Select-String -Pattern "WARNING" -Quiet) { } $ALLOWED_CHECK_NOTES=3 -$note_str = Get-Content "${LOG_FILE_NAME}" | Select-String -Pattern ' NOTE' | Out-String -$NUM_CHECK_NOTES = $note_str.replace("Status: ", "").replace(" ", "").replace("NOTE", "").replace("s", "") +$note_str = Get-Content "${LOG_FILE_NAME}" | Select-String -Pattern ' NOTE' | Out-String ; Check-Output $? +$NUM_CHECK_NOTES = $note_str.replace("Status: ", "").replace(" ", "").replace("NOTE", "").replace("s", "") ; Check-Output $? if ( [int]$NUM_CHECK_NOTES -gt $ALLOWED_CHECK_NOTES ){ Write-Output "Found ${NUM_CHECK_NOTES} NOTEs from R CMD check. Only ${ALLOWED_CHECK_NOTES} are allowed" Check-Output $False From 7f9eb7cba5d2a5d097f6692beb0d08b0bcdc3f8a Mon Sep 17 00:00:00 2001 From: James Lamb Date: Tue, 14 Apr 2020 22:52:48 -0500 Subject: [PATCH 67/87] fixing check on NOTEs --- .ci/test_r_package_windows.ps1 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.ci/test_r_package_windows.ps1 b/.ci/test_r_package_windows.ps1 index e888c0d497a0..96f1bcbdcd15 100644 --- a/.ci/test_r_package_windows.ps1 +++ b/.ci/test_r_package_windows.ps1 @@ -95,9 +95,10 @@ if (Get-Content "$LOG_FILE_NAME" | Select-String -Pattern "WARNING" -Quiet) { Check-Output $False } -$ALLOWED_CHECK_NOTES=3 $note_str = Get-Content "${LOG_FILE_NAME}" | Select-String -Pattern ' NOTE' | Out-String ; Check-Output $? -$NUM_CHECK_NOTES = $note_str.replace("Status: ", "").replace(" ", "").replace("NOTE", "").replace("s", "") ; Check-Output $? +$relevant_line = $note_str -match '.*Status: (\d+) NOTE.*' +$NUM_CHECK_NOTES = $matches[1] +$ALLOWED_CHECK_NOTES=3 if ( [int]$NUM_CHECK_NOTES -gt $ALLOWED_CHECK_NOTES ){ Write-Output "Found ${NUM_CHECK_NOTES} NOTEs from R CMD check. Only ${ALLOWED_CHECK_NOTES} are allowed" Check-Output $False From 374ba312734697365ac9fedea9f856b06b75c4f2 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Tue, 14 Apr 2020 23:30:20 -0500 Subject: [PATCH 68/87] removing unnecessary variable --- .ci/test_r_package_windows.ps1 | 1 - 1 file changed, 1 deletion(-) diff --git a/.ci/test_r_package_windows.ps1 b/.ci/test_r_package_windows.ps1 index 96f1bcbdcd15..83aeb986a6ae 100644 --- a/.ci/test_r_package_windows.ps1 +++ b/.ci/test_r_package_windows.ps1 @@ -14,7 +14,6 @@ function Download-File-With-Retries { $env:R_LIB_PATH = "C:/RLibrary" $env:PATH = "$env:R_LIB_PATH/Rtools/bin;" + "$env:R_LIB_PATH/R/bin/x64;" + "$env:R_LIB_PATH/miktex/texmfs/install/miktex/bin/x64;" + $env:PATH -$env:BINPREF = "C:/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/bin/" $env:CRAN_MIRROR = "https://cloud.r-project.org/" cd $env:BUILD_SOURCESDIRECTORY From 30d8af19b974dd56109aa08e26a5a85b1b82e901 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Wed, 15 Apr 2020 23:35:25 +0100 Subject: [PATCH 69/87] Update .ci/test_r_package_windows.ps1 Co-Authored-By: Nikita Titov --- .ci/test_r_package_windows.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/test_r_package_windows.ps1 b/.ci/test_r_package_windows.ps1 index 83aeb986a6ae..51efbbc17416 100644 --- a/.ci/test_r_package_windows.ps1 +++ b/.ci/test_r_package_windows.ps1 @@ -98,7 +98,7 @@ $note_str = Get-Content "${LOG_FILE_NAME}" | Select-String -Pattern ' NOTE' | Ou $relevant_line = $note_str -match '.*Status: (\d+) NOTE.*' $NUM_CHECK_NOTES = $matches[1] $ALLOWED_CHECK_NOTES=3 -if ( [int]$NUM_CHECK_NOTES -gt $ALLOWED_CHECK_NOTES ){ +if ([int]$NUM_CHECK_NOTES -gt $ALLOWED_CHECK_NOTES) { Write-Output "Found ${NUM_CHECK_NOTES} NOTEs from R CMD check. Only ${ALLOWED_CHECK_NOTES} are allowed" Check-Output $False } From e3b9ac8c83a357c44d64f755c774ed74128dea56 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Wed, 15 Apr 2020 17:51:44 -0500 Subject: [PATCH 70/87] some changes --- .appveyor.yml | 1 - .ci/test_r_package_windows.ps1 | 5 +++-- R-package/src/cmake/modules/FindLibR.cmake | 1 - 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index abb0459de7b5..20807e36e6f5 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -9,7 +9,6 @@ environment: matrix: - COMPILER: MINGW TASK: r-package - R_WINDOWS_VERSION: 3.6.3 - COMPILER: MSVC TASK: python - COMPILER: MINGW diff --git a/.ci/test_r_package_windows.ps1 b/.ci/test_r_package_windows.ps1 index 51efbbc17416..d859ef11b9c2 100644 --- a/.ci/test_r_package_windows.ps1 +++ b/.ci/test_r_package_windows.ps1 @@ -12,7 +12,9 @@ function Download-File-With-Retries { } while(!$?); } -$env:R_LIB_PATH = "C:/RLibrary" +$env:R_WINDOWS_VERSION = "3.6.3" + +$env:R_LIB_PATH = "$env:BUILD_SOURCESDIRECTORY/RLibrary" $env:PATH = "$env:R_LIB_PATH/Rtools/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/" @@ -104,4 +106,3 @@ if ([int]$NUM_CHECK_NOTES -gt $ALLOWED_CHECK_NOTES) { } Write-Output "No issues were found checking the R package" -Exit 0 diff --git a/R-package/src/cmake/modules/FindLibR.cmake b/R-package/src/cmake/modules/FindLibR.cmake index 307b23fa19d7..db1821398d27 100644 --- a/R-package/src/cmake/modules/FindLibR.cmake +++ b/R-package/src/cmake/modules/FindLibR.cmake @@ -184,7 +184,6 @@ find_library( LIBR_CORE_LIBRARY NAMES R R.dll HINTS "${CMAKE_CURRENT_BINARY_DIR}" "${LIBR_HOME}/lib" "${LIBR_HOME}/bin/${R_ARCH}" "${LIBR_HOME}/bin" "${LIBR_LIBRARIES}" - PATHS "${LIBR_HOME}/bin/${R_ARCH}/R.dll" ) set(LIBR_CORE_LIBRARY ${LIBR_CORE_LIBRARY} CACHE PATH "R core shared library") From 419e39b339438ffc7c88814283d5d350031a9a78 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Wed, 15 Apr 2020 18:10:49 -0500 Subject: [PATCH 71/87] fix quoting --- .ci/test_r_package_windows.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/test_r_package_windows.ps1 b/.ci/test_r_package_windows.ps1 index d859ef11b9c2..e811db89cb7b 100644 --- a/.ci/test_r_package_windows.ps1 +++ b/.ci/test_r_package_windows.ps1 @@ -14,7 +14,7 @@ function Download-File-With-Retries { $env:R_WINDOWS_VERSION = "3.6.3" -$env:R_LIB_PATH = "$env:BUILD_SOURCESDIRECTORY/RLibrary" +$env:R_LIB_PATH = $env:BUILD_SOURCESDIRECTORY/RLibrary $env:PATH = "$env:R_LIB_PATH/Rtools/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/" From bfebf1d39d62055024be23dec26101555e702b75 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Thu, 16 Apr 2020 03:33:09 +0100 Subject: [PATCH 72/87] trying MINGW on Azure DevOps --- .ci/test_r_package_windows.ps1 | 8 ++-- .vsts-ci.yml | 71 ++++++++++++++++++---------------- 2 files changed, 41 insertions(+), 38 deletions(-) diff --git a/.ci/test_r_package_windows.ps1 b/.ci/test_r_package_windows.ps1 index e811db89cb7b..cc0cb1030893 100644 --- a/.ci/test_r_package_windows.ps1 +++ b/.ci/test_r_package_windows.ps1 @@ -48,9 +48,9 @@ if (!(Get-Command R.exe -errorAction SilentlyContinue)) { } -# MiKTeX and pandoc can be skipped on Azure builds, since we don't -# build the package documentation there -if ($env:AZURE -ne "true") { +# MiKTeX and pandoc can be skipped on MSVC builds, since we don't +# build the package documentation for those +if ($env:COMPILER -ne "MSVC") { Write-Output "Downloading MiKTeX" Download-File-With-Retries -url "https://miktex.org/download/win/miktexsetup-x64.zip" -destfile "miktexsetup-x64.zip" @@ -79,7 +79,7 @@ $PKG_FILE_NAME = Get-Item *.tar.gz $LOG_FILE_NAME = "lightgbm.Rcheck/00check.log" $env:_R_CHECK_FORCE_SUGGESTS_=0 -if ($env:AZURE -eq "true") { +if ($env:COMPILER -eq "MSVC") { Write-Output "Running R CMD check without checking documentation" R.exe CMD check --no-multiarch --no-examples --no-manual --ignore-vignettes ${PKG_FILE_NAME} ; Check-Output $? } else { diff --git a/.vsts-ci.yml b/.vsts-ci.yml index a39dbc0e105b..909f9439547b 100644 --- a/.vsts-ci.yml +++ b/.vsts-ci.yml @@ -24,24 +24,24 @@ jobs: strategy: maxParallel: 6 matrix: - regular: - TASK: regular - sdist: - TASK: sdist - PYTHON_VERSION: 3.5 - bdist: - TASK: bdist - PYTHON_VERSION: 3.7 - inference: - TASK: if-else - mpi_source: - TASK: mpi - METHOD: source - PYTHON_VERSION: 2.7 - gpu_source: - TASK: gpu - METHOD: source - PYTHON_VERSION: 3.6 + #regular: + # TASK: regular + #sdist: + # TASK: sdist + # PYTHON_VERSION: 3.5 + #bdist: + # TASK: bdist + # PYTHON_VERSION: 3.7 + #inference: + # TASK: if-else + #mpi_source: + # TASK: mpi + # METHOD: source + # PYTHON_VERSION: 2.7 + #gpu_source: + # TASK: gpu + # METHOD: source + # PYTHON_VERSION: 3.6 r_package: TASK: r-package steps: @@ -78,14 +78,14 @@ jobs: strategy: maxParallel: 3 matrix: - regular: - TASK: regular - PYTHON_VERSION: 3.7 - sdist: - TASK: sdist - PYTHON_VERSION: 3.5 - bdist: - TASK: bdist + #regular: + # TASK: regular + # PYTHON_VERSION: 3.7 + #sdist: + # TASK: sdist + # PYTHON_VERSION: 3.5 + #bdist: + # TASK: bdist r_package: TASK: r-package steps: @@ -119,14 +119,17 @@ jobs: strategy: maxParallel: 3 matrix: - regular: - TASK: regular - PYTHON_VERSION: 3.6 - sdist: - TASK: sdist - PYTHON_VERSION: 2.7 - bdist: - TASK: bdist + rpkg: + TASK: r-package + COMPILER: MINGW + #regular: + # TASK: regular + # PYTHON_VERSION: 3.6 + #sdist: + # TASK: sdist + # PYTHON_VERSION: 2.7 + #bdist: + # TASK: bdist steps: - powershell: | Write-Host "##vso[task.prependpath]$env:CONDA\Scripts" From 3e2dcfd92fe235b0c2b03955ff51fa0c4ac2de1a Mon Sep 17 00:00:00 2001 From: James Lamb Date: Thu, 16 Apr 2020 03:36:57 +0100 Subject: [PATCH 73/87] fixing paths --- .ci/test_r_package_windows.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/test_r_package_windows.ps1 b/.ci/test_r_package_windows.ps1 index cc0cb1030893..c39a3b184edd 100644 --- a/.ci/test_r_package_windows.ps1 +++ b/.ci/test_r_package_windows.ps1 @@ -14,7 +14,7 @@ function Download-File-With-Retries { $env:R_WINDOWS_VERSION = "3.6.3" -$env:R_LIB_PATH = $env:BUILD_SOURCESDIRECTORY/RLibrary +$env:R_LIB_PATH = "$env:BUILD_SOURCESDIRECTORY/RLibrary"" $env:PATH = "$env:R_LIB_PATH/Rtools/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/" From 8ba021a50e6664d937cf7d6f9fe4f0fd4718b873 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Thu, 16 Apr 2020 03:42:20 +0100 Subject: [PATCH 74/87] more paths --- .ci/test_r_package_windows.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/test_r_package_windows.ps1 b/.ci/test_r_package_windows.ps1 index c39a3b184edd..57d2bca83d40 100644 --- a/.ci/test_r_package_windows.ps1 +++ b/.ci/test_r_package_windows.ps1 @@ -14,7 +14,7 @@ function Download-File-With-Retries { $env:R_WINDOWS_VERSION = "3.6.3" -$env:R_LIB_PATH = "$env:BUILD_SOURCESDIRECTORY/RLibrary"" +$env:R_LIB_PATH = "$env:BUILD_SOURCESDIRECTORY/RLibrary" $env:PATH = "$env:R_LIB_PATH/Rtools/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/" From 51e4d2da4c44b8429554fef4fd2fe30a182c9f0d Mon Sep 17 00:00:00 2001 From: James Lamb Date: Thu, 16 Apr 2020 03:51:35 +0100 Subject: [PATCH 75/87] fixing paths --- .ci/test_r_package_windows.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/test_r_package_windows.ps1 b/.ci/test_r_package_windows.ps1 index 57d2bca83d40..0595bb2458eb 100644 --- a/.ci/test_r_package_windows.ps1 +++ b/.ci/test_r_package_windows.ps1 @@ -14,7 +14,7 @@ function Download-File-With-Retries { $env:R_WINDOWS_VERSION = "3.6.3" -$env:R_LIB_PATH = "$env:BUILD_SOURCESDIRECTORY/RLibrary" +$env:R_LIB_PATH = "$env:BUILD_SOURCESDIRECTORY\RLibrary" $env:PATH = "$env:R_LIB_PATH/Rtools/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/" From 5d74019187cbaf0968cc3fafc938443b4da89d7d Mon Sep 17 00:00:00 2001 From: James Lamb Date: Thu, 16 Apr 2020 05:10:08 +0100 Subject: [PATCH 76/87] testing paths --- .ci/test_r_package_windows.ps1 | 1 + 1 file changed, 1 insertion(+) diff --git a/.ci/test_r_package_windows.ps1 b/.ci/test_r_package_windows.ps1 index 0595bb2458eb..11cddd7fc1e6 100644 --- a/.ci/test_r_package_windows.ps1 +++ b/.ci/test_r_package_windows.ps1 @@ -15,6 +15,7 @@ function Download-File-With-Retries { $env:R_WINDOWS_VERSION = "3.6.3" $env:R_LIB_PATH = "$env:BUILD_SOURCESDIRECTORY\RLibrary" +Write-Output "R_LIB_PATH: $env:R_LIB_PATH" $env:PATH = "$env:R_LIB_PATH/Rtools/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/" From d7c160bcf2689e8a9cdfd55d97b3eeb10cc2017d Mon Sep 17 00:00:00 2001 From: James Lamb Date: Thu, 16 Apr 2020 05:30:19 +0100 Subject: [PATCH 77/87] fixing slashes --- .ci/test_r_package_windows.ps1 | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.ci/test_r_package_windows.ps1 b/.ci/test_r_package_windows.ps1 index 11cddd7fc1e6..eed649ce9169 100644 --- a/.ci/test_r_package_windows.ps1 +++ b/.ci/test_r_package_windows.ps1 @@ -13,8 +13,7 @@ function Download-File-With-Retries { } $env:R_WINDOWS_VERSION = "3.6.3" - -$env:R_LIB_PATH = "$env:BUILD_SOURCESDIRECTORY\RLibrary" +$env:R_LIB_PATH = "$env:BUILD_SOURCESDIRECTORY/RLibrary" -replace '[\\]', '/' Write-Output "R_LIB_PATH: $env:R_LIB_PATH" $env:PATH = "$env:R_LIB_PATH/Rtools/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/" @@ -25,7 +24,7 @@ tzutil /s "GMT Standard Time" if ($env:COMPILER -eq "MINGW") { Write-Output "Telling R to use MinGW" - $install_libs = "$env:BUILD_SOURCESDIRECTORY\R-package\src\install.libs.R" + $install_libs = "$env:BUILD_SOURCESDIRECTORY/R-package/src/install.libs.R" ((Get-Content -path $install_libs -Raw) -replace 'use_mingw <- FALSE','use_mingw <- TRUE') | Set-Content -Path $install_libs } From a8582dbf76ff134fcd32c9fbb6f50e8173f85358 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Fri, 17 Apr 2020 02:25:11 +0100 Subject: [PATCH 78/87] pinned CTAN mirror --- .ci/test_r_package_windows.ps1 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.ci/test_r_package_windows.ps1 b/.ci/test_r_package_windows.ps1 index eed649ce9169..839ff125ce9d 100644 --- a/.ci/test_r_package_windows.ps1 +++ b/.ci/test_r_package_windows.ps1 @@ -17,6 +17,7 @@ $env:R_LIB_PATH = "$env:BUILD_SOURCESDIRECTORY/RLibrary" -replace '[\\]', '/' Write-Output "R_LIB_PATH: $env:R_LIB_PATH" $env:PATH = "$env:R_LIB_PATH/Rtools/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:CTAN_MIRROR = "https://ctan.math.illinois.edu/systems/win32/miktex/tm/packages/" cd $env:BUILD_SOURCESDIRECTORY tzutil /s "GMT Standard Time" @@ -57,9 +58,9 @@ if ($env:COMPILER -ne "MSVC") { Add-Type -AssemblyName System.IO.Compression.FileSystem [System.IO.Compression.ZipFile]::ExtractToDirectory("miktexsetup-x64.zip", "miktex") Write-Output "Setting up MiKTeX" - .\miktex\miktexsetup.exe --local-package-repository=./miktex/download --package-set=essential --quiet download ; Check-Output $? + .\miktex\miktexsetup.exe --remote-package-repository="$env:CTAN_MIRROR" --local-package-repository=./miktex/download --package-set=essential --quiet download ; Check-Output $? Write-Output "Installing MiKTeX" - .\miktex\download\miktexsetup.exe --portable="$env:R_LIB_PATH/miktex" --quiet install ; Check-Output $? + .\miktex\download\miktexsetup.exe --remote-package-repository="$env:CTAN_MIRROR" --portable="$env:R_LIB_PATH/miktex" --quiet install ; Check-Output $? Write-Output "Done installing MiKTeX" initexmf --set-config-value [MPM]AutoInstall=1 From 8264f4a3336d4fcc4eb18e4d7257ea20ba69773b Mon Sep 17 00:00:00 2001 From: James Lamb Date: Fri, 17 Apr 2020 02:36:58 +0100 Subject: [PATCH 79/87] get better logs --- .ci/test_r_package_windows.ps1 | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/.ci/test_r_package_windows.ps1 b/.ci/test_r_package_windows.ps1 index 839ff125ce9d..aa59e6069f40 100644 --- a/.ci/test_r_package_windows.ps1 +++ b/.ci/test_r_package_windows.ps1 @@ -29,25 +29,22 @@ if ($env:COMPILER -eq "MINGW") { ((Get-Content -path $install_libs -Raw) -replace 'use_mingw <- FALSE','use_mingw <- TRUE') | Set-Content -Path $install_libs } -# set up R if it doesn't exist yet -if (!(Get-Command R.exe -errorAction SilentlyContinue)) { +# set up R - Write-Output "Downloading R and Rtools" +Write-Output "Downloading R and Rtools" - # download 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/Rtools35.exe" -destfile "Rtools.exe" +# download 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/Rtools35.exe" -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" +# 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=$env:R_LIB_PATH/Rtools" ; Check-Output $? - Write-Output "Done installing Rtools" - -} +Write-Output "Installing Rtools" +Start-Process -FilePath Rtools.exe -NoNewWindow -Wait -ArgumentList "/VERYSILENT /DIR=$env:R_LIB_PATH/Rtools" ; Check-Output $? +Write-Output "Done installing Rtools" # MiKTeX and pandoc can be skipped on MSVC builds, since we don't # build the package documentation for those @@ -82,15 +79,17 @@ $LOG_FILE_NAME = "lightgbm.Rcheck/00check.log" $env:_R_CHECK_FORCE_SUGGESTS_=0 if ($env:COMPILER -eq "MSVC") { Write-Output "Running R CMD check without checking documentation" - R.exe CMD check --no-multiarch --no-examples --no-manual --ignore-vignettes ${PKG_FILE_NAME} ; Check-Output $? + R.exe CMD check --no-multiarch --no-examples --no-manual --ignore-vignettes ${PKG_FILE_NAME} ; $check_succeeded=$? } else { Write-Output "Running R CMD check as CRAN" - R.exe CMD check --no-multiarch --as-cran ${PKG_FILE_NAME} ; Check-Output $? + R.exe CMD check --no-multiarch --as-cran ${PKG_FILE_NAME} ; $check_succeeded=$? } Write-Output "R CMD check build logs:" Get-Content -Path $env:BUILD_SOURCESDIRECTORY\lightgbm.Rcheck\00install.out +Check-Output $check_succeeded + Write-Output "Looking for issues with R CMD check results" if (Get-Content "$LOG_FILE_NAME" | Select-String -Pattern "WARNING" -Quiet) { echo "WARNINGS have been found by R CMD check!" From d843795087e363ffe7bbc53c502fdbe8d36df9fc Mon Sep 17 00:00:00 2001 From: James Lamb Date: Sun, 19 Apr 2020 00:59:32 -0500 Subject: [PATCH 80/87] made sure Azure finds MinGW, fixed search for LIBR_CORE_LIBRARY, stopped building R docs on Azure --- .ci/test_r_package_windows.ps1 | 10 ++-- .vsts-ci.yml | 68 +++++++++++----------- R-package/src/cmake/modules/FindLibR.cmake | 10 ++++ 3 files changed, 49 insertions(+), 39 deletions(-) diff --git a/.ci/test_r_package_windows.ps1 b/.ci/test_r_package_windows.ps1 index aa59e6069f40..359aeb1acca3 100644 --- a/.ci/test_r_package_windows.ps1 +++ b/.ci/test_r_package_windows.ps1 @@ -6,7 +6,7 @@ function Download-File-With-Retries { [string]$destfile ) do { - Write-Output "Downloading '${url}'" + Write-Output "Downloading ${url}" sleep 5; (New-Object System.Net.WebClient).DownloadFile($url, $destfile) } while(!$?); @@ -15,7 +15,7 @@ function Download-File-With-Retries { $env:R_WINDOWS_VERSION = "3.6.3" $env:R_LIB_PATH = "$env:BUILD_SOURCESDIRECTORY/RLibrary" -replace '[\\]', '/' Write-Output "R_LIB_PATH: $env:R_LIB_PATH" -$env:PATH = "$env:R_LIB_PATH/Rtools/bin;" + "$env:R_LIB_PATH/R/bin/x64;" + "$env:R_LIB_PATH/miktex/texmfs/install/miktex/bin/x64;" + $env:PATH +$env:PATH = "$env:R_LIB_PATH/Rtools/mingw_64/bin;" + "$env:R_LIB_PATH/Rtools/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:CTAN_MIRROR = "https://ctan.math.illinois.edu/systems/win32/miktex/tm/packages/" @@ -46,9 +46,9 @@ Write-Output "Installing Rtools" Start-Process -FilePath Rtools.exe -NoNewWindow -Wait -ArgumentList "/VERYSILENT /DIR=$env:R_LIB_PATH/Rtools" ; Check-Output $? Write-Output "Done installing Rtools" -# MiKTeX and pandoc can be skipped on MSVC builds, since we don't +# MiKTeX and pandoc can be skipped on Azure builds, since we don't # build the package documentation for those -if ($env:COMPILER -ne "MSVC") { +if ($env:AZURE -ne "true") { Write-Output "Downloading MiKTeX" Download-File-With-Retries -url "https://miktex.org/download/win/miktexsetup-x64.zip" -destfile "miktexsetup-x64.zip" @@ -77,7 +77,7 @@ $PKG_FILE_NAME = Get-Item *.tar.gz $LOG_FILE_NAME = "lightgbm.Rcheck/00check.log" $env:_R_CHECK_FORCE_SUGGESTS_=0 -if ($env:COMPILER -eq "MSVC") { +if ($env:AZURE -eq "true") { Write-Output "Running R CMD check without checking documentation" R.exe CMD check --no-multiarch --no-examples --no-manual --ignore-vignettes ${PKG_FILE_NAME} ; $check_succeeded=$? } else { diff --git a/.vsts-ci.yml b/.vsts-ci.yml index 909f9439547b..76b57e9cfc63 100644 --- a/.vsts-ci.yml +++ b/.vsts-ci.yml @@ -24,24 +24,24 @@ jobs: strategy: maxParallel: 6 matrix: - #regular: - # TASK: regular - #sdist: - # TASK: sdist - # PYTHON_VERSION: 3.5 - #bdist: - # TASK: bdist - # PYTHON_VERSION: 3.7 - #inference: - # TASK: if-else - #mpi_source: - # TASK: mpi - # METHOD: source - # PYTHON_VERSION: 2.7 - #gpu_source: - # TASK: gpu - # METHOD: source - # PYTHON_VERSION: 3.6 + regular: + TASK: regular + sdist: + TASK: sdist + PYTHON_VERSION: 3.5 + bdist: + TASK: bdist + PYTHON_VERSION: 3.7 + inference: + TASK: if-else + mpi_source: + TASK: mpi + METHOD: source + PYTHON_VERSION: 2.7 + gpu_source: + TASK: gpu + METHOD: source + PYTHON_VERSION: 3.6 r_package: TASK: r-package steps: @@ -78,14 +78,14 @@ jobs: strategy: maxParallel: 3 matrix: - #regular: - # TASK: regular - # PYTHON_VERSION: 3.7 - #sdist: - # TASK: sdist - # PYTHON_VERSION: 3.5 - #bdist: - # TASK: bdist + regular: + TASK: regular + PYTHON_VERSION: 3.7 + sdist: + TASK: sdist + PYTHON_VERSION: 3.5 + bdist: + TASK: bdist r_package: TASK: r-package steps: @@ -122,14 +122,14 @@ jobs: rpkg: TASK: r-package COMPILER: MINGW - #regular: - # TASK: regular - # PYTHON_VERSION: 3.6 - #sdist: - # TASK: sdist - # PYTHON_VERSION: 2.7 - #bdist: - # TASK: bdist + regular: + TASK: regular + PYTHON_VERSION: 3.6 + sdist: + TASK: sdist + PYTHON_VERSION: 2.7 + bdist: + TASK: bdist steps: - powershell: | Write-Host "##vso[task.prependpath]$env:CONDA\Scripts" diff --git a/R-package/src/cmake/modules/FindLibR.cmake b/R-package/src/cmake/modules/FindLibR.cmake index db1821398d27..dc10104eb861 100644 --- a/R-package/src/cmake/modules/FindLibR.cmake +++ b/R-package/src/cmake/modules/FindLibR.cmake @@ -186,6 +186,16 @@ find_library( HINTS "${CMAKE_CURRENT_BINARY_DIR}" "${LIBR_HOME}/lib" "${LIBR_HOME}/bin/${R_ARCH}" "${LIBR_HOME}/bin" "${LIBR_LIBRARIES}" ) +# starting from CMake 3.17, find_library() will not find .dll files by default +# https://cmake.org/cmake/help/v3.17/release/3.17.html#id17 +if (WIN32 AND NOT LIBR_CORE_LIBRARY) + find_file( + LIBR_CORE_LIBRARY + NAME R.dll + HINTS "${CMAKE_CURRENT_BINARY_DIR}" "${LIBR_HOME}/lib" "${LIBR_HOME}/bin/${R_ARCH}" "${LIBR_HOME}/bin" "${LIBR_LIBRARIES}" + ) +endif() + set(LIBR_CORE_LIBRARY ${LIBR_CORE_LIBRARY} CACHE PATH "R core shared library") if(WIN32 AND MSVC) From 10bd18daab00b1ebb52295ec4f2aeef1b088e698 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Sun, 19 Apr 2020 16:18:09 +0100 Subject: [PATCH 81/87] Apply suggestions from code review Co-Authored-By: Nikita Titov --- .vsts-ci.yml | 2 +- R-package/src/cmake/modules/FindLibR.cmake | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.vsts-ci.yml b/.vsts-ci.yml index 76b57e9cfc63..36a9db1f23f0 100644 --- a/.vsts-ci.yml +++ b/.vsts-ci.yml @@ -119,7 +119,7 @@ jobs: strategy: maxParallel: 3 matrix: - rpkg: + r_package: TASK: r-package COMPILER: MINGW regular: diff --git a/R-package/src/cmake/modules/FindLibR.cmake b/R-package/src/cmake/modules/FindLibR.cmake index dc10104eb861..99aeed23fb57 100644 --- a/R-package/src/cmake/modules/FindLibR.cmake +++ b/R-package/src/cmake/modules/FindLibR.cmake @@ -187,7 +187,7 @@ find_library( ) # starting from CMake 3.17, find_library() will not find .dll files by default -# https://cmake.org/cmake/help/v3.17/release/3.17.html#id17 +# https://cmake.org/cmake/help/v3.17/release/3.17.html#other-changes if (WIN32 AND NOT LIBR_CORE_LIBRARY) find_file( LIBR_CORE_LIBRARY From 6ca2be8f3c66f16607f655344e51030e4e56c8ec Mon Sep 17 00:00:00 2001 From: James Lamb Date: Sun, 19 Apr 2020 12:31:57 -0500 Subject: [PATCH 82/87] added CXX, CC for Windows builds and changed back to building docs on all MINGW builds --- .ci/test_r_package_windows.ps1 | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/.ci/test_r_package_windows.ps1 b/.ci/test_r_package_windows.ps1 index 359aeb1acca3..496275728056 100644 --- a/.ci/test_r_package_windows.ps1 +++ b/.ci/test_r_package_windows.ps1 @@ -15,10 +15,15 @@ function Download-File-With-Retries { $env:R_WINDOWS_VERSION = "3.6.3" $env:R_LIB_PATH = "$env:BUILD_SOURCESDIRECTORY/RLibrary" -replace '[\\]', '/' Write-Output "R_LIB_PATH: $env:R_LIB_PATH" -$env:PATH = "$env:R_LIB_PATH/Rtools/mingw_64/bin;" + "$env:R_LIB_PATH/Rtools/bin;" + "$env:R_LIB_PATH/R/bin/x64;" + "$env:R_LIB_PATH/miktex/texmfs/install/miktex/bin/x64;" + $env:PATH +$env:PATH = "$env:R_LIB_PATH/Rtools/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:CTAN_MIRROR = "https://ctan.math.illinois.edu/systems/win32/miktex/tm/packages/" +if ($env:COMPILER -eq "MINGW") { + $env:CXX = "$env:R_LIB_PATH/Rtools/mingw_64/bin/g++.exe" + $env:CC = "$env:R_LIB_PATH/Rtools/mingw_64/bin/gcc.exe" +} + cd $env:BUILD_SOURCESDIRECTORY tzutil /s "GMT Standard Time" [Void][System.IO.Directory]::CreateDirectory($env:R_LIB_PATH) @@ -29,11 +34,8 @@ if ($env:COMPILER -eq "MINGW") { ((Get-Content -path $install_libs -Raw) -replace 'use_mingw <- FALSE','use_mingw <- TRUE') | Set-Content -Path $install_libs } -# set up R - -Write-Output "Downloading R and Rtools" - # 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/Rtools35.exe" -destfile "Rtools.exe" @@ -46,9 +48,9 @@ Write-Output "Installing Rtools" Start-Process -FilePath Rtools.exe -NoNewWindow -Wait -ArgumentList "/VERYSILENT /DIR=$env:R_LIB_PATH/Rtools" ; Check-Output $? Write-Output "Done installing Rtools" -# MiKTeX and pandoc can be skipped on Azure builds, since we don't +# MiKTeX and pandoc can be skipped on non-MINGW builds, since we don't # build the package documentation for those -if ($env:AZURE -ne "true") { +if ($env:COMPILER -eq "MINGW") { Write-Output "Downloading MiKTeX" Download-File-With-Retries -url "https://miktex.org/download/win/miktexsetup-x64.zip" -destfile "miktexsetup-x64.zip" @@ -77,7 +79,7 @@ $PKG_FILE_NAME = Get-Item *.tar.gz $LOG_FILE_NAME = "lightgbm.Rcheck/00check.log" $env:_R_CHECK_FORCE_SUGGESTS_=0 -if ($env:AZURE -eq "true") { +if ($env:COMPILER -ne "MINGW") { Write-Output "Running R CMD check without checking documentation" R.exe CMD check --no-multiarch --no-examples --no-manual --ignore-vignettes ${PKG_FILE_NAME} ; $check_succeeded=$? } else { From cdf1df8696846b86853d1858996e0211805d0eed Mon Sep 17 00:00:00 2001 From: James Lamb Date: Sun, 19 Apr 2020 12:41:21 -0500 Subject: [PATCH 83/87] stored LIBR_CORE_LIBRARY hints in one variable --- R-package/src/cmake/modules/FindLibR.cmake | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/R-package/src/cmake/modules/FindLibR.cmake b/R-package/src/cmake/modules/FindLibR.cmake index 99aeed23fb57..16b04137235e 100644 --- a/R-package/src/cmake/modules/FindLibR.cmake +++ b/R-package/src/cmake/modules/FindLibR.cmake @@ -179,11 +179,14 @@ set(LIBR_EXECUTABLE ${LIBR_EXECUTABLE} CACHE PATH "R executable") set(LIBR_INCLUDE_DIRS ${LIBR_INCLUDE_DIRS} CACHE PATH "R include directory") set(LIBR_LIB_DIR ${LIBR_LIB_DIR} CACHE PATH "R shared libraries directory") +# where is R.so / R.dll / libR.so likely to be found? +set(LIBR_PATH_HINTS "${CMAKE_CURRENT_BINARY_DIR}" "${LIBR_HOME}/lib" "${LIBR_HOME}/bin/${R_ARCH}" "${LIBR_HOME}/bin" "${LIBR_LIBRARIES}") + # look for the core R library find_library( LIBR_CORE_LIBRARY NAMES R R.dll - HINTS "${CMAKE_CURRENT_BINARY_DIR}" "${LIBR_HOME}/lib" "${LIBR_HOME}/bin/${R_ARCH}" "${LIBR_HOME}/bin" "${LIBR_LIBRARIES}" + HINTS ${LIBR_PATH_HINTS} ) # starting from CMake 3.17, find_library() will not find .dll files by default @@ -192,7 +195,7 @@ if (WIN32 AND NOT LIBR_CORE_LIBRARY) find_file( LIBR_CORE_LIBRARY NAME R.dll - HINTS "${CMAKE_CURRENT_BINARY_DIR}" "${LIBR_HOME}/lib" "${LIBR_HOME}/bin/${R_ARCH}" "${LIBR_HOME}/bin" "${LIBR_LIBRARIES}" + HINTS ${LIBR_PATH_HINTS} ) endif() From 9c59f3325c1f2ab117a94167e0f5c4a14efc1f59 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Mon, 20 Apr 2020 02:49:58 +0100 Subject: [PATCH 84/87] Apply suggestions from code review Co-Authored-By: Nikita Titov --- .ci/test_r_package_windows.ps1 | 4 ++-- .vsts-ci.yml | 2 +- R-package/src/cmake/modules/FindLibR.cmake | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.ci/test_r_package_windows.ps1 b/.ci/test_r_package_windows.ps1 index 496275728056..d9f633d4ae48 100644 --- a/.ci/test_r_package_windows.ps1 +++ b/.ci/test_r_package_windows.ps1 @@ -78,7 +78,7 @@ Rscript build_r.R --skip-install ; Check-Output $? $PKG_FILE_NAME = Get-Item *.tar.gz $LOG_FILE_NAME = "lightgbm.Rcheck/00check.log" -$env:_R_CHECK_FORCE_SUGGESTS_=0 +$env:_R_CHECK_FORCE_SUGGESTS_ = 0 if ($env:COMPILER -ne "MINGW") { Write-Output "Running R CMD check without checking documentation" R.exe CMD check --no-multiarch --no-examples --no-manual --ignore-vignettes ${PKG_FILE_NAME} ; $check_succeeded=$? @@ -101,7 +101,7 @@ if (Get-Content "$LOG_FILE_NAME" | Select-String -Pattern "WARNING" -Quiet) { $note_str = Get-Content "${LOG_FILE_NAME}" | Select-String -Pattern ' NOTE' | Out-String ; Check-Output $? $relevant_line = $note_str -match '.*Status: (\d+) NOTE.*' $NUM_CHECK_NOTES = $matches[1] -$ALLOWED_CHECK_NOTES=3 +$ALLOWED_CHECK_NOTES = 3 if ([int]$NUM_CHECK_NOTES -gt $ALLOWED_CHECK_NOTES) { Write-Output "Found ${NUM_CHECK_NOTES} NOTEs from R CMD check. Only ${ALLOWED_CHECK_NOTES} are allowed" Check-Output $False diff --git a/.vsts-ci.yml b/.vsts-ci.yml index 36a9db1f23f0..47aac09d2ab0 100644 --- a/.vsts-ci.yml +++ b/.vsts-ci.yml @@ -117,7 +117,7 @@ jobs: pool: vmImage: 'vs2017-win2016' strategy: - maxParallel: 3 + maxParallel: 4 matrix: r_package: TASK: r-package diff --git a/R-package/src/cmake/modules/FindLibR.cmake b/R-package/src/cmake/modules/FindLibR.cmake index 16b04137235e..ad26f06dfeef 100644 --- a/R-package/src/cmake/modules/FindLibR.cmake +++ b/R-package/src/cmake/modules/FindLibR.cmake @@ -180,7 +180,7 @@ set(LIBR_INCLUDE_DIRS ${LIBR_INCLUDE_DIRS} CACHE PATH "R include directory") set(LIBR_LIB_DIR ${LIBR_LIB_DIR} CACHE PATH "R shared libraries directory") # where is R.so / R.dll / libR.so likely to be found? -set(LIBR_PATH_HINTS "${CMAKE_CURRENT_BINARY_DIR}" "${LIBR_HOME}/lib" "${LIBR_HOME}/bin/${R_ARCH}" "${LIBR_HOME}/bin" "${LIBR_LIBRARIES}") +set(LIBR_PATH_HINTS "${CMAKE_CURRENT_BINARY_DIR}" "${LIBR_LIB_DIR}" "${LIBR_HOME}/bin/${R_ARCH}" "${LIBR_HOME}/bin" "${LIBR_LIBRARIES}") # look for the core R library find_library( From 747378eb41b74d5124b905f9cca5f76727d3a5ae Mon Sep 17 00:00:00 2001 From: James Lamb Date: Sun, 19 Apr 2020 20:56:02 -0500 Subject: [PATCH 85/87] changes from code review --- .ci/test_r_package_windows.ps1 | 2 -- 1 file changed, 2 deletions(-) diff --git a/.ci/test_r_package_windows.ps1 b/.ci/test_r_package_windows.ps1 index d9f633d4ae48..87343c73ff0f 100644 --- a/.ci/test_r_package_windows.ps1 +++ b/.ci/test_r_package_windows.ps1 @@ -14,7 +14,6 @@ function Download-File-With-Retries { $env:R_WINDOWS_VERSION = "3.6.3" $env:R_LIB_PATH = "$env:BUILD_SOURCESDIRECTORY/RLibrary" -replace '[\\]', '/' -Write-Output "R_LIB_PATH: $env:R_LIB_PATH" $env:PATH = "$env:R_LIB_PATH/Rtools/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:CTAN_MIRROR = "https://ctan.math.illinois.edu/systems/win32/miktex/tm/packages/" @@ -51,7 +50,6 @@ Write-Output "Done installing Rtools" # MiKTeX and pandoc can be skipped on non-MINGW builds, since we don't # build the package documentation for those if ($env:COMPILER -eq "MINGW") { - Write-Output "Downloading MiKTeX" Download-File-With-Retries -url "https://miktex.org/download/win/miktexsetup-x64.zip" -destfile "miktexsetup-x64.zip" Add-Type -AssemblyName System.IO.Compression.FileSystem From c0b87d6bb22b0d863bb99e1024371510133f8e44 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Sun, 19 Apr 2020 20:58:18 -0500 Subject: [PATCH 86/87] increased parallel builds for Azure CI --- .vsts-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.vsts-ci.yml b/.vsts-ci.yml index 47aac09d2ab0..a533ab1659e4 100644 --- a/.vsts-ci.yml +++ b/.vsts-ci.yml @@ -22,7 +22,7 @@ jobs: vmImage: 'ubuntu-latest' container: ubuntu1404 strategy: - maxParallel: 6 + maxParallel: 7 matrix: regular: TASK: regular @@ -76,7 +76,7 @@ jobs: pool: vmImage: 'macOS-10.14' strategy: - maxParallel: 3 + maxParallel: 4 matrix: regular: TASK: regular From 6820fc6bc60f1e001a1b605bd27f5be4699ee22e Mon Sep 17 00:00:00 2001 From: James Lamb Date: Tue, 21 Apr 2020 04:24:24 +0100 Subject: [PATCH 87/87] Apply suggestions from code review Co-Authored-By: Nikita Titov --- .ci/test_r_package_windows.ps1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.ci/test_r_package_windows.ps1 b/.ci/test_r_package_windows.ps1 index 87343c73ff0f..5bd65d28408b 100644 --- a/.ci/test_r_package_windows.ps1 +++ b/.ci/test_r_package_windows.ps1 @@ -61,7 +61,7 @@ if ($env:COMPILER -eq "MINGW") { Write-Output "Done installing MiKTeX" initexmf --set-config-value [MPM]AutoInstall=1 - conda install -y --no-deps pandoc + conda install -q -y --no-deps pandoc } Add-Content .Renviron "R_LIBS=$env:R_LIB_PATH" @@ -79,10 +79,10 @@ $LOG_FILE_NAME = "lightgbm.Rcheck/00check.log" $env:_R_CHECK_FORCE_SUGGESTS_ = 0 if ($env:COMPILER -ne "MINGW") { Write-Output "Running R CMD check without checking documentation" - R.exe CMD check --no-multiarch --no-examples --no-manual --ignore-vignettes ${PKG_FILE_NAME} ; $check_succeeded=$? + R.exe CMD check --no-multiarch --no-examples --no-manual --ignore-vignettes ${PKG_FILE_NAME} ; $check_succeeded = $? } else { Write-Output "Running R CMD check as CRAN" - R.exe CMD check --no-multiarch --as-cran ${PKG_FILE_NAME} ; $check_succeeded=$? + R.exe CMD check --no-multiarch --as-cran ${PKG_FILE_NAME} ; $check_succeeded = $? } Write-Output "R CMD check build logs:"