Skip to content

Commit 11d225f

Browse files
committed
Use 2 cores per job in github build
As of today, https://docs.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners states that hosted runners have a 2-core CPU. This uses make -j $physical_cores to try and be better about utilizing the time spent on those machines. When github upgrades runners to have more cores we'll benefit from that too.
1 parent a6e0486 commit 11d225f

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

tools/build_release_files.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
# SPDX-License-Identifier: MIT
66

77
import os
8+
import multiprocessing
89
import sys
910
import subprocess
1011
import shutil
@@ -27,6 +28,8 @@
2728

2829
languages = build_info.get_languages()
2930
exit_status = 0
31+
cores = multiprocessing.cpu_count()
32+
print('building boards with parallelism {}'.format(cores))
3033
for board in build_boards:
3134
bin_directory = "../bin/{}/".format(board)
3235
os.makedirs(bin_directory, exist_ok=True)
@@ -41,8 +44,8 @@
4144
# But sometimes a particular language needs to be built from scratch, if, for instance,
4245
# CFLAGS_INLINE_LIMIT is set for a particular language to make it fit.
4346
clean_build_check_result = subprocess.run(
44-
"make -C ../ports/{port} TRANSLATION={language} BOARD={board} check-release-needs-clean-build | fgrep 'RELEASE_NEEDS_CLEAN_BUILD = 1'".format(
45-
port = board_info["port"], language=language, board=board),
47+
"make -C ../ports/{port} TRANSLATION={language} BOARD={board} check-release-needs-clean-build -j {cores} | fgrep 'RELEASE_NEEDS_CLEAN_BUILD = 1'".format(
48+
port = board_info["port"], language=language, board=board, cores=cores),
4649
shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
4750
clean_build = clean_build_check_result.returncode == 0
4851

0 commit comments

Comments
 (0)