diff --git a/.github/workflows/r_tests.yml b/.github/workflows/r_tests.yml index c353fd0d2dd5..917245ec6399 100644 --- a/.github/workflows/r_tests.yml +++ b/.github/workflows/r_tests.yml @@ -25,7 +25,7 @@ jobs: with: submodules: 'true' - - uses: r-lib/actions/setup-r@11a22a908006c25fe054c4ef0ac0436b1de3edbe # v2.6.4 + - uses: r-lib/actions/setup-r@e40ad904310fc92e96951c1b0d64f3de6cbe9e14 # v2.6.5 with: r-version: ${{ matrix.config.r }} @@ -54,7 +54,7 @@ jobs: matrix: config: - {os: windows-latest, r: 'release', compiler: 'mingw', build: 'autotools'} - - {os: windows-latest, r: '4.2.0', compiler: 'msvc', build: 'cmake'} + - {os: windows-latest, r: '4.3.0', compiler: 'msvc', build: 'cmake'} env: R_REMOTES_NO_ERRORS_FROM_WARNINGS: true RSPM: ${{ matrix.config.rspm }} @@ -64,7 +64,7 @@ jobs: with: submodules: 'true' - - uses: r-lib/actions/setup-r@11a22a908006c25fe054c4ef0ac0436b1de3edbe # v2.6.4 + - uses: r-lib/actions/setup-r@e40ad904310fc92e96951c1b0d64f3de6cbe9e14 # v2.6.5 with: r-version: ${{ matrix.config.r }} diff --git a/R-package/CMakeLists.txt b/R-package/CMakeLists.txt index a19e56f4e6eb..d3a69abc278e 100644 --- a/R-package/CMakeLists.txt +++ b/R-package/CMakeLists.txt @@ -14,6 +14,15 @@ if(ENABLE_ALL_WARNINGS) target_compile_options(xgboost-r PRIVATE -Wall -Wextra) endif() +if(MSVC) + # https://github.com/microsoft/LightGBM/pull/6061 + # MSVC doesn't work with anonymous types in structs. (R complex) + # + # syntax error: missing ';' before identifier 'private_data_c' + # + target_compile_definitions(xgboost-r PRIVATE -DR_LEGACY_RCOMPLEX) +endif() + target_compile_definitions( xgboost-r PUBLIC -DXGBOOST_STRICT_R_MODE=1 diff --git a/R-package/DESCRIPTION b/R-package/DESCRIPTION index d301b0a5cb81..92b53a660e88 100644 --- a/R-package/DESCRIPTION +++ b/R-package/DESCRIPTION @@ -58,7 +58,7 @@ Suggests: float, titanic Depends: - R (>= 3.3.0) + R (>= 4.3.0) Imports: Matrix (>= 1.1-0), methods, diff --git a/tests/ci_build/test_r_package.py b/tests/ci_build/test_r_package.py index 853bf05022b1..cc1225b0340b 100644 --- a/tests/ci_build/test_r_package.py +++ b/tests/ci_build/test_r_package.py @@ -261,6 +261,8 @@ def test_with_cmake(args: argparse.Namespace) -> None: "-DCMAKE_CONFIGURATION_TYPES=Release", "-A", "x64", + "-G", + "Visual Studio 17 2022", ] ) subprocess.check_call(