Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 4 commits into from
Oct 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions .ci/test_r_package_windows.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,13 @@ Remove-From-Path ".*PostgreSQL.*"
Remove-From-Path ".*\\R\\.*"
Remove-From-Path ".*R Client.*"
Remove-From-Path ".*rtools40.*"
Remove-From-Path ".*rtools42.*"
Remove-From-Path ".*shells.*"
Remove-From-Path ".*Strawberry.*"
Remove-From-Path ".*tools.*"

Remove-Item C:\rtools40 -Force -Recurse -ErrorAction Ignore
Remove-Item C:\rtools42 -Force -Recurse -ErrorAction Ignore

# Get details needed for installing R components
#
Expand All @@ -74,11 +76,11 @@ if ($env:R_MAJOR_VERSION -eq "3") {
$env:RTOOLS_EXE_FILE = "rtools35-x86_64.exe"
$env:R_WINDOWS_VERSION = "3.6.3"
} 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_MINGW_BIN = "$RTOOLS_INSTALL_PATH\mingw64\bin"
$env:RTOOLS_EXE_FILE = "rtools40v2-x86_64.exe"
$env:R_WINDOWS_VERSION = "4.1.3"
$env:RTOOLS_MINGW_BIN = "$RTOOLS_INSTALL_PATH\x86_64-w64-mingw32.static.posix\bin"
$env:RTOOLS_EXE_FILE = "rtools42-5253-5107.exe"
$env:R_WINDOWS_VERSION = "4.2.1"
} else {
Write-Output "[ERROR] Unrecognized R version: $env:R_VERSION"
Check-Output $false
Expand Down Expand Up @@ -147,7 +149,7 @@ Write-Output "Building R package"
# R CMD check is not used for MSVC builds
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"

if ($env:R_BUILD_TYPE -eq "cmake") {
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/r_package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ jobs:
task: r-package
compiler: MINGW
toolchain: MSYS
r_version: 4.1
r_version: 4.2
build_type: cmake
# Visual Studio 2019
- os: windows-2019
Expand All @@ -96,7 +96,7 @@ jobs:
task: r-package
compiler: MSVC
toolchain: MSVC
r_version: 4.1
r_version: 4.2
build_type: cmake
###############
# CRAN builds #
Expand All @@ -111,7 +111,7 @@ jobs:
task: r-package
compiler: MINGW
toolchain: MSYS
r_version: 4.1
r_version: 4.2
build_type: cran
- os: ubuntu-latest
task: r-package
Expand Down Expand Up @@ -165,6 +165,7 @@ jobs:
shell: pwsh -command ". {0}"
run: |
$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:R_VERSION = "${{ matrix.r_version }}"
$env:R_BUILD_TYPE = "${{ matrix.build_type }}"
Expand Down
5 changes: 5 additions & 0 deletions R-package/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,18 @@ After installing `Rtools` and `CMake`, be sure the following paths are added to
- If you have `Rtools` 4.0, example:
- `C:\rtools40\mingw64\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`
- example: `C:\Program Files\CMake\bin`
* `R`
- example: `C:\Program Files\R\R-3.6.1\bin`

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

A "toolchain" refers to the collection of software used to build the library. The R package can be built with three different toolchains.
Expand Down
3 changes: 2 additions & 1 deletion R-package/configure.win
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ ac_inet_pton="no"
cat > conftest.cpp <<EOL
#include <ws2tcpip.h>
int main() {
void* p = inet_pton;
int (*fptr)(int, const char*, void*);
fptr = &inet_pton;
return 0;
}
EOL
Expand Down
4 changes: 2 additions & 2 deletions R-package/tests/testthat/test_dataset.R
Original file line number Diff line number Diff line change
Expand Up @@ -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", {
testthat::skip_if(
Sys.getenv("COMPILER", "") == "MSVC" && as.integer(R.Version()[["major"]]) < 4L
, message = "Skipping on R 3.x and Visual Studio"
Sys.getenv("COMPILER", "") == "MSVC"
, message = "Skipping on Visual Studio"
)
data(agaricus.train, package = "lightgbm")
train <- agaricus.train
Expand Down