Skip to content

Commit 23a37dc

Browse files
authored
[CI] Test R package with CMake (dmlc#10087)
* [CI] Test R package with CMake * Fix * Fix * Update test_r_package.py * Fix CMake flag for R package * Install system deps * Fix * Use sudo
1 parent d07b7fe commit 23a37dc

File tree

3 files changed

+28
-4
lines changed

3 files changed

+28
-4
lines changed

.github/workflows/r_tests.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,19 +46,25 @@ jobs:
4646
MAKEFLAGS="-j$(nproc)" R CMD INSTALL R-package/
4747
Rscript tests/ci_build/lint_r.R $(pwd)
4848
49-
test-R-on-Windows:
49+
test-Rpkg:
5050
runs-on: ${{ matrix.config.os }}
5151
name: Test R on OS ${{ matrix.config.os }}, R ${{ matrix.config.r }}, Compiler ${{ matrix.config.compiler }}, Build ${{ matrix.config.build }}
5252
strategy:
5353
fail-fast: false
5454
matrix:
5555
config:
5656
- {os: windows-latest, r: 'release', compiler: 'mingw', build: 'autotools'}
57+
- {os: ubuntu-latest, r: 'release', compiler: 'none', build: 'cmake'}
5758
env:
5859
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
5960
RSPM: ${{ matrix.config.rspm }}
6061

6162
steps:
63+
- name: Install system dependencies
64+
run: |
65+
sudo apt update
66+
sudo apt install libcurl4-openssl-dev libssl-dev libssh2-1-dev libgit2-dev libglpk-dev libxml2-dev libharfbuzz-dev libfribidi-dev
67+
if: matrix.config.os == 'ubuntu-latest'
6268
- uses: actions/checkout@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.0
6369
with:
6470
submodules: 'true'
@@ -89,6 +95,12 @@ jobs:
8995
- name: Test R
9096
run: |
9197
python tests/ci_build/test_r_package.py --compiler='${{ matrix.config.compiler }}' --build-tool="${{ matrix.config.build }}" --task=check
98+
if: matrix.config.compiler != 'none'
99+
100+
- name: Test R
101+
run: |
102+
python tests/ci_build/test_r_package.py --build-tool="${{ matrix.config.build }}" --task=check
103+
if: matrix.config.compiler == 'none'
92104

93105
test-R-on-Debian:
94106
name: Test R package on Debian

R-package/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ endif()
2626
target_compile_definitions(
2727
xgboost-r PUBLIC
2828
-DXGBOOST_STRICT_R_MODE=1
29-
-DXGBOOST_CUSTOMIZE_GLOBAL_PRNG=1
3029
-DDMLC_LOG_BEFORE_THROW=0
3130
-DDMLC_DISABLE_STDIN=1
3231
-DDMLC_LOG_CUSTOMIZE=1

tests/ci_build/test_r_package.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,19 @@ def test_with_cmake(args: argparse.Namespace) -> None:
277277
"Release",
278278
]
279279
)
280+
elif args.compiler == "none":
281+
subprocess.check_call(
282+
[
283+
"cmake",
284+
os.path.pardir,
285+
"-DUSE_OPENMP=ON",
286+
"-DR_LIB=ON",
287+
"-DCMAKE_CONFIGURATION_TYPES=Release",
288+
"-G",
289+
"Unix Makefiles",
290+
]
291+
)
292+
subprocess.check_call(["make", "-j", "install"])
280293
else:
281294
raise ValueError("Wrong compiler")
282295
with DirectoryExcursion(R_PACKAGE):
@@ -333,9 +346,9 @@ def main(args: argparse.Namespace) -> None:
333346
parser.add_argument(
334347
"--compiler",
335348
type=str,
336-
choices=["mingw", "msvc"],
349+
choices=["mingw", "msvc", "none"],
337350
help="Compiler used for compiling CXX code. Only relevant for windows build",
338-
default="mingw",
351+
default="none",
339352
required=False,
340353
)
341354
parser.add_argument(

0 commit comments

Comments
 (0)