From a2593e60bf49e229d418a940e80a138da475d604 Mon Sep 17 00:00:00 2001 From: Jiaming Yuan Date: Wed, 26 Oct 2022 18:02:27 +0800 Subject: [PATCH] Speedup R test on github. (#8388) --- .github/workflows/r_tests.yml | 2 +- tests/ci_build/test_r_package.py | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/r_tests.yml b/.github/workflows/r_tests.yml index 6bc95941d..4045234fc 100644 --- a/.github/workflows/r_tests.yml +++ b/.github/workflows/r_tests.yml @@ -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 diff --git a/tests/ci_build/test_r_package.py b/tests/ci_build/test_r_package.py index a720e7c60..cf8932fec 100644 --- a/tests/ci_build/test_r_package.py +++ b/tests/ci_build/test_r_package.py @@ -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__':