Speedup R test on github. (#8388)

This commit is contained in:
Jiaming Yuan 2022-10-26 18:02:27 +08:00 committed by GitHub
parent 786aa27134
commit a2593e60bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 3 deletions

View File

@ -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

View File

@ -1,6 +1,8 @@
import argparse
import os
import subprocess
from time import time
from test_utils import DirectoryExcursion
ROOT = os.path.normpath(
@ -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',
@ -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__':