From 7cf330e3f9de3a5d732808dc95dc907f7c618fa4 Mon Sep 17 00:00:00 2001 From: ISSOtm Date: Wed, 18 Mar 2026 02:53:02 +0100 Subject: [PATCH] Enable CMake parallelism in a central place Shortening command lines is useful --- .github/workflows/create-release-artifacts.yml | 6 +++++- .github/workflows/testing.yml | 12 ++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/.github/workflows/create-release-artifacts.yml b/.github/workflows/create-release-artifacts.yml index fea5e79f..79e2c57a 100644 --- a/.github/workflows/create-release-artifacts.yml +++ b/.github/workflows/create-release-artifacts.yml @@ -7,6 +7,10 @@ on: env: CLICOLOR_FORCE: 1 # Tells CMake to have colored output. 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_INSTALL_PARALLEL_LEVEL: 4 # `cmake --install` now implies `--parallel 4`. jobs: windows: @@ -38,7 +42,7 @@ jobs: # otherwise they can trigger `-Werror=dev` (from the `develop` preset). run: | cmake -S . -B build -A ${{ matrix.platform }} -DCMAKE_BUILD_TYPE=Release -DFETCHCONTENT_BASE_DIR="$TEMP/cmake-deps" -DBISON_EXECUTABLE=bison/win_bison.exe - cmake --build build --config Release -j + cmake --build build --config Release cmake --install build --config Release --prefix install_dir --verbose - name: Package binaries run: | diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index decb53dc..b1b0fa67 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -6,6 +6,10 @@ on: env: CLICOLOR_FORCE: 1 # Tells CMake to have colored output. 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_INSTALL_PARALLEL_LEVEL: 4 # `cmake --install` now implies `--parallel 4`. jobs: unix: @@ -41,7 +45,7 @@ jobs: # better applied here than in our CMakeLists, where it could affect and break someone else. run: | cmake -S . -B build --preset develop -DCMAKE_FIND_FRAMEWORK=LAST -DCMAKE_CXX_COMPILER=${{ matrix.cxx }} -DTESTS_OS_NAME=${{ matrix.os }} - cmake --build build -j --verbose + cmake --build build --verbose sudo cmake --install build --verbose - name: Package binaries run: | @@ -162,7 +166,7 @@ jobs: # otherwise they can trigger `-Werror=dev` (from the `develop` preset). run: | # ASan seems to be broken on Windows, so we disable it. cmake -S . -B build -A ${{ matrix.platform }} --preset develop -DFETCHCONTENT_BASE_DIR="$TEMP/cmake-deps" -DBISON_EXECUTABLE=bison/win_bison.exe -DSANITIZERS=OFF - cmake --build build --config Debug -j + cmake --build build --config Debug cmake --install build --config Debug --prefix install_dir --verbose - name: Package binaries shell: bash @@ -363,13 +367,13 @@ jobs: - name: Build & test using CMake on FreeBSD uses: vmactions/freebsd-vm@v1 with: - envs: CLICOLOR_FORCE CMAKE_COLOR_DIAGNOSTICS + envs: CLICOLOR_FORCE CMAKE_COLOR_DIAGNOSTICS CMAKE_BUILD_PARALLEL_LEVEL CMAKE_INSTALL_PARALLEL_LEVEL release: "14.3" usesh: true prepare: | .github/scripts/install_deps.sh freebsd run: | # FreeBSD `c++` compiler does not support `make develop` sanitizers ASan or UBSan cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_COMPILER=c++ -DTESTS_RUN_EXTERNAL=OFF -DTESTS_OS_NAME=freebsd - cmake --build build -j4 --verbose + cmake --build build --verbose cmake --install build --verbose ctest --test-dir build --verbose