Parallelize build jobs according to CPU count

This commit is contained in:
Rangi
2026-07-05 20:58:50 -04:00
committed by Rangi
parent 5d5000011a
commit 189c679e13
9 changed files with 99 additions and 44 deletions
+1 -1
View File
@@ -20,7 +20,7 @@ jobs:
.github/scripts/install_deps.sh ubuntu-latest lcov
- name: Generate coverage report
run: |
contrib/coverage.bash ubuntu-ci
contrib/coverage.bash --os ubuntu-latest --jobs "$(getconf _NPROCESSORS_ONLN)"
- name: Upload coverage report
uses: actions/upload-artifact@v7
with:
@@ -11,9 +11,6 @@ env:
CLICOLOR_FORCE: 1
CMAKE_COLOR_DIAGNOSTICS: ON # Tells CMake-generated build systems to have colored output.
# Approximate number of CPU cores in GitHub's runners as of 2026-03-18:
# https://docs.github.com/en/actions/reference/runners/github-hosted-runners#standard-github-hosted-runners-for-public-repositories
CMAKE_BUILD_PARALLEL_LEVEL: 4 # `cmake --build` now implies `--parallel 4`.
CMAKE_BUILD_TYPE: Release # `cmake -S` now implies `-DCMAKE_BUILD_TYPE=Release`.
CMAKE_CONFIG_TYPE: Release # `cmake --build` now implies `--config Release`.
@@ -92,7 +89,7 @@ jobs:
./.github/scripts/install_deps.sh ubuntu-22.04
- name: Build binaries
run: |
make -kj WARNFLAGS="-Wall -Wextra -pedantic -static" PKG_CONFIG="pkg-config --static" Q=
make -k -j "$(getconf _NPROCESSORS_ONLN)" WARNFLAGS="-Wall -Wextra -pedantic -static" PKG_CONFIG="pkg-config --static" Q=
strip rgb{asm,link,fix,gfx}
- name: Create install script
run: |
+10 -11
View File
@@ -11,9 +11,8 @@ env:
CMAKE_COLOR_DIAGNOSTICS: ON # Tells CMake-generated build systems to have colored output.
CMAKE_CONFIG_TYPE: Debug # `cmake --build` now implies `--config Debug`.
# Approximate number of CPU cores in GitHub's runners as of 2026-03-18:
# https://docs.github.com/en/actions/reference/runners/github-hosted-runners#standard-github-hosted-runners-for-public-repositories
CTEST_PARALLEL_LEVEL: 0 # `ctest` now implies `--parallel 0` (number of logical CPUs).
CTEST_PARALLEL_LEVEL: "" # `ctest` now implies `--parallel` (default number of logical CPUs).
CTEST_NO_TESTS_ACTION: error # Make CTest fail if it cannot find any tests. (That should never happen.)
CTEST_OUTPUT_ON_FAILURE: ON # CTest reports test program output on failure.
@@ -57,11 +56,11 @@ jobs:
- name: Build using Make
if: matrix.buildsys == 'make'
run: |
make develop -kj Q= CXX=${{ matrix.cxx }}
make develop -k -j "$(getconf _NPROCESSORS_ONLN)" Q= CXX=${{ matrix.cxx }}
- name: Install using Make
if: matrix.buildsys == 'make'
run: |
sudo make install -j Q=
sudo make install Q=
type rgbasm rgblink rgbfix rgbgfx
man -w 1 rgbasm rgblink rgbfix rgbgfx
- name: Build using CMake
@@ -111,7 +110,7 @@ jobs:
- name: Run tests using our script
if: matrix.buildsys == 'make'
run: |
CXX=${{ matrix.cxx }} test/run-tests.sh --os ${{ matrix.os }}
CXX=${{ matrix.cxx }} test/run-tests.sh --os ${{ matrix.os }} --jobs "$(getconf _NPROCESSORS_ONLN)"
- name: Run tests using CTest
if: matrix.buildsys == 'cmake'
run: |
@@ -328,7 +327,7 @@ jobs:
test/external/fetch-repos.sh
- name: Run tests
run: |
test/run-tests.sh --os ${{ matrix.os }}
test/run-tests.sh --os ${{ matrix.os }} --jobs "$(getconf _NPROCESSORS_ONLN)"
cygwin:
strategy:
@@ -365,15 +364,15 @@ jobs:
pkg-config
- name: Build
run: | # Cygwin does not support `make develop` sanitizers ASan or UBSan
make -kj Q=
make -k -j "$(getconf _NPROCESSORS_ONLN)" Q=
- name: Install
run: |
make install -j Q=
make install Q=
type rgbasm rgblink rgbfix rgbgfx
man -w 1 rgbasm rgblink rgbfix rgbgfx
- name: Run tests
run: |
test/run-tests.sh --only-internal
test/run-tests.sh --only-internal --jobs "$(getconf _NPROCESSORS_ONLN)"
- name: Use Windows git location in the PATH
shell: pwsh
run: | # Prevents the `actions/checkout` post-job cleanup from using Cygwin's git binary
@@ -400,7 +399,7 @@ jobs:
.github/scripts/install_deps.sh freebsd
run: | # Leak detection is not supported on FreeBSD, so disable it.
cmake -B build --preset develop
cmake --build build --verbose -- -k -j 4
cmake --build build --verbose -- -k -j "$(getconf _NPROCESSORS_ONLN)"
ASAN_OPTIONS=detect_leaks=0 ctest --test-dir build --schedule-random --label-exclude external
cmake --install build --verbose
type rgbasm rgblink rgbfix rgbgfx