Unverified Commit 45dd49ec authored by James Lamb's avatar James Lamb Committed by GitHub
Browse files

[ci] [R-package] use R 4.2.1 in Windows CI jobs (fixes #4881) (#5503)

parent 7fa4432b
...@@ -54,11 +54,13 @@ Remove-From-Path ".*PostgreSQL.*" ...@@ -54,11 +54,13 @@ Remove-From-Path ".*PostgreSQL.*"
Remove-From-Path ".*\\R\\.*" Remove-From-Path ".*\\R\\.*"
Remove-From-Path ".*R Client.*" Remove-From-Path ".*R Client.*"
Remove-From-Path ".*rtools40.*" Remove-From-Path ".*rtools40.*"
Remove-From-Path ".*rtools42.*"
Remove-From-Path ".*shells.*" Remove-From-Path ".*shells.*"
Remove-From-Path ".*Strawberry.*" Remove-From-Path ".*Strawberry.*"
Remove-From-Path ".*tools.*" Remove-From-Path ".*tools.*"
Remove-Item C:\rtools40 -Force -Recurse -ErrorAction Ignore Remove-Item C:\rtools40 -Force -Recurse -ErrorAction Ignore
Remove-Item C:\rtools42 -Force -Recurse -ErrorAction Ignore
# Get details needed for installing R components # Get details needed for installing R components
# #
...@@ -74,11 +76,11 @@ if ($env:R_MAJOR_VERSION -eq "3") { ...@@ -74,11 +76,11 @@ if ($env:R_MAJOR_VERSION -eq "3") {
$env:RTOOLS_EXE_FILE = "rtools35-x86_64.exe" $env:RTOOLS_EXE_FILE = "rtools35-x86_64.exe"
$env:R_WINDOWS_VERSION = "3.6.3" $env:R_WINDOWS_VERSION = "3.6.3"
} elseif ($env:R_MAJOR_VERSION -eq "4") { } elseif ($env:R_MAJOR_VERSION -eq "4") {
$RTOOLS_INSTALL_PATH = "C:\rtools40" $RTOOLS_INSTALL_PATH = "C:\rtools42"
$env:RTOOLS_BIN = "$RTOOLS_INSTALL_PATH\usr\bin" $env:RTOOLS_BIN = "$RTOOLS_INSTALL_PATH\usr\bin"
$env:RTOOLS_MINGW_BIN = "$RTOOLS_INSTALL_PATH\mingw64\bin" $env:RTOOLS_MINGW_BIN = "$RTOOLS_INSTALL_PATH\x86_64-w64-mingw32.static.posix\bin"
$env:RTOOLS_EXE_FILE = "rtools40v2-x86_64.exe" $env:RTOOLS_EXE_FILE = "rtools42-5253-5107.exe"
$env:R_WINDOWS_VERSION = "4.1.3" $env:R_WINDOWS_VERSION = "4.2.1"
} else { } else {
Write-Output "[ERROR] Unrecognized R version: $env:R_VERSION" Write-Output "[ERROR] Unrecognized R version: $env:R_VERSION"
Check-Output $false Check-Output $false
...@@ -147,7 +149,7 @@ Write-Output "Building R package" ...@@ -147,7 +149,7 @@ Write-Output "Building R package"
# R CMD check is not used for MSVC builds # R CMD check is not used for MSVC builds
if ($env:COMPILER -ne "MSVC") { if ($env:COMPILER -ne "MSVC") {
$PKG_FILE_NAME = "lightgbm_*.tar.gz" $PKG_FILE_NAME = "lightgbm_$env:LGB_VER.tar.gz"
$LOG_FILE_NAME = "lightgbm.Rcheck/00check.log" $LOG_FILE_NAME = "lightgbm.Rcheck/00check.log"
if ($env:R_BUILD_TYPE -eq "cmake") { if ($env:R_BUILD_TYPE -eq "cmake") {
......
...@@ -83,7 +83,7 @@ jobs: ...@@ -83,7 +83,7 @@ jobs:
task: r-package task: r-package
compiler: MINGW compiler: MINGW
toolchain: MSYS toolchain: MSYS
r_version: 4.1 r_version: 4.2
build_type: cmake build_type: cmake
# Visual Studio 2019 # Visual Studio 2019
- os: windows-2019 - os: windows-2019
...@@ -97,7 +97,7 @@ jobs: ...@@ -97,7 +97,7 @@ jobs:
task: r-package task: r-package
compiler: MSVC compiler: MSVC
toolchain: MSVC toolchain: MSVC
r_version: 4.1 r_version: 4.2
build_type: cmake build_type: cmake
############### ###############
# CRAN builds # # CRAN builds #
...@@ -112,7 +112,7 @@ jobs: ...@@ -112,7 +112,7 @@ jobs:
task: r-package task: r-package
compiler: MINGW compiler: MINGW
toolchain: MSYS toolchain: MSYS
r_version: 4.1 r_version: 4.2
build_type: cran build_type: cran
- os: ubuntu-latest - os: ubuntu-latest
task: r-package task: r-package
...@@ -166,6 +166,7 @@ jobs: ...@@ -166,6 +166,7 @@ jobs:
shell: pwsh -command ". {0}" shell: pwsh -command ". {0}"
run: | run: |
$env:BUILD_SOURCESDIRECTORY = $env:GITHUB_WORKSPACE $env:BUILD_SOURCESDIRECTORY = $env:GITHUB_WORKSPACE
$env:LGB_VER = (Get-Content -TotalCount 1 $env:BUILD_SOURCESDIRECTORY\VERSION.txt).trim().replace('rc', '-')
$env:TOOLCHAIN = "${{ matrix.toolchain }}" $env:TOOLCHAIN = "${{ matrix.toolchain }}"
$env:R_VERSION = "${{ matrix.r_version }}" $env:R_VERSION = "${{ matrix.r_version }}"
$env:R_BUILD_TYPE = "${{ matrix.build_type }}" $env:R_BUILD_TYPE = "${{ matrix.build_type }}"
......
...@@ -97,6 +97,9 @@ After installing `Rtools` and `CMake`, be sure the following paths are added to ...@@ -97,6 +97,9 @@ After installing `Rtools` and `CMake`, be sure the following paths are added to
- If you have `Rtools` 4.0, example: - If you have `Rtools` 4.0, example:
- `C:\rtools40\mingw64\bin` - `C:\rtools40\mingw64\bin`
- `C:\rtools40\usr\bin` - `C:\rtools40\usr\bin`
- If you have `Rtools` 4.2, example:
- `C:\rtools42\x86_64-w64-mingw32.static.posix\bin`
- `C:\rtools42\usr\bin`
* `CMake` * `CMake`
- example: `C:\Program Files\CMake\bin` - example: `C:\Program Files\CMake\bin`
* `R` * `R`
...@@ -104,6 +107,8 @@ After installing `Rtools` and `CMake`, be sure the following paths are added to ...@@ -104,6 +107,8 @@ After installing `Rtools` and `CMake`, be sure the following paths are added to
NOTE: Two `Rtools` paths are required from `Rtools` 4.0 onwards because paths and the list of included software was changed in `Rtools` 4.0. NOTE: Two `Rtools` paths are required from `Rtools` 4.0 onwards because paths and the list of included software was changed in `Rtools` 4.0.
NOTE: `Rtools42` takes a very different approach to the compiler toolchain than previous releases, and how you install it changes what is required to build packages. See ["Howto: Building R 4.2 and packages on Windows"](https://cran.r-project.org/bin/windows/base/howto-R-4.2.html).
#### Windows Toolchain Options #### Windows Toolchain Options
A "toolchain" refers to the collection of software used to build the library. The R package can be built with three different toolchains. A "toolchain" refers to the collection of software used to build the library. The R package can be built with three different toolchains.
......
...@@ -79,7 +79,8 @@ ac_inet_pton="no" ...@@ -79,7 +79,8 @@ ac_inet_pton="no"
cat > conftest.cpp <<EOL cat > conftest.cpp <<EOL
#include <ws2tcpip.h> #include <ws2tcpip.h>
int main() { int main() {
void* p = inet_pton; int (*fptr)(int, const char*, void*);
fptr = &inet_pton;
return 0; return 0;
} }
EOL EOL
......
...@@ -219,8 +219,8 @@ test_that("lgb.Dataset: Dataset should be able to construct from matrix and retu ...@@ -219,8 +219,8 @@ test_that("lgb.Dataset: Dataset should be able to construct from matrix and retu
test_that("cpp errors should be raised as proper R errors", { test_that("cpp errors should be raised as proper R errors", {
testthat::skip_if( testthat::skip_if(
Sys.getenv("COMPILER", "") == "MSVC" && as.integer(R.Version()[["major"]]) < 4L Sys.getenv("COMPILER", "") == "MSVC"
, message = "Skipping on R 3.x and Visual Studio" , message = "Skipping on Visual Studio"
) )
data(agaricus.train, package = "lightgbm") data(agaricus.train, package = "lightgbm")
train <- agaricus.train train <- agaricus.train
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment