Skip to content

Commit 0afdac7

Browse files
authored
Trying -j core-count to speed things up
This approach is more multiplatform portable than Linux oriented getconf _NPROCESSORS_ONLN || sysctl -n hw.ncpu || nproc --all 2>/dev/null
1 parent 2e4bb46 commit 0afdac7

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

.github/workflows/cmake-multi-platform.yml

+7-3
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs:
4545
run: |
4646
echo "project-root-dir=${{ github.workspace }}/inflection" >> "$GITHUB_OUTPUT"
4747
echo "build-output-dir=${{ github.workspace }}/inflection/build" >> "$GITHUB_OUTPUT"
48-
48+
4949
- name: Configure CMake
5050
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
5151
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
@@ -56,10 +56,14 @@ jobs:
5656
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
5757
-S ${{ steps.strings.outputs.project-root-dir }}
5858
59+
- name: Get number of CPU cores
60+
uses: SimenB/github-actions-cpu-cores@v2
61+
id: cpu-cores
62+
5963
- name: Build
6064
# Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
61-
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }}
65+
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} -j ${{ steps.cpu-cores.outputs.count }}
6266

6367
- name: Test
6468
working-directory: ${{ steps.strings.outputs.build-output-dir }}
65-
run: cmake --build . -t check
69+
run: cmake --build . -t check -j ${{ steps.cpu-cores.outputs.count }}

0 commit comments

Comments
 (0)