Skip to content

Commit

Permalink
Speedup R test on github. (#8388)
Browse files Browse the repository at this point in the history
  • Loading branch information
trivialfis committed Oct 26, 2022
1 parent 786aa27 commit a2593e6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/r_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
- name: Run lintr
run: |
cd R-package
R CMD INSTALL .
MAKE="make -j$(nproc)" R CMD INSTALL .
# Disable lintr errors for now: https://github.com/dmlc/xgboost/issues/8012
Rscript tests/helper_scripts/run_lint.R || true
Expand Down
8 changes: 6 additions & 2 deletions tests/ci_build/test_r_package.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import argparse
import os
import subprocess
from time import time

from test_utils import DirectoryExcursion

ROOT = os.path.normpath(
Expand All @@ -20,7 +22,7 @@ def test_with_autotools(args):
CC = os.path.join(mingw_bin, 'gcc.exe')
cmd = ['R.exe', 'CMD', 'INSTALL', str(os.path.curdir)]
env = os.environ.copy()
env.update({'CC': CC, 'CXX': CXX})
env.update({'CC': CC, 'CXX': CXX, "MAKE": "make -j$(nproc)"})
subprocess.check_call(cmd, env=env)
subprocess.check_call([
'R.exe', '-q', '-e',
Expand Down Expand Up @@ -69,11 +71,13 @@ def test_with_cmake(args):
])


def main(args):
def main(args: argparse.Namespace) -> None:
start = time()
if args.build_tool == 'autotools':
test_with_autotools(args)
else:
test_with_cmake(args)
print("Duration:", time() - start)


if __name__ == '__main__':
Expand Down

0 comments on commit a2593e6

Please sign in to comment.