Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use the true number of cores avaliable #125

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,23 @@ jobs:
pluginval-binary: ./pluginval.exe

steps:
# Figure out how many cores we have to work with
- name: Set number of cores
run: |
echo "Determining number of cores..."
if [[ "$RUNNER_OS" == "Linux" ]]; then
CORES=$(nproc)
elif [[ "$RUNNER_OS" == "macOS" ]]; then
CORES=$(sysctl -n hw.ncpu)
elif [[ "$RUNNER_OS" == "Windows" ]]; then
CORES=$NUMBER_OF_PROCESSORS
else
echo "Unknown OS. Defaulting to 2 cores."
CORES=2
fi
echo "NUMBER_OF_CORES=$CORES" >> $GITHUB_ENV
echo "Detected $CORES cores"

# Setup MSVC toolchain and developer command prompt (Windows)
- uses: ilammy/msvc-dev-cmd@v1

Expand Down Expand Up @@ -119,7 +136,7 @@ jobs:
run: cmake -B ${{ env.BUILD_DIR }} -G Ninja -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE}} -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache ${{ matrix.extra-flags }} .

- name: Build
run: cmake --build ${{ env.BUILD_DIR }} --config ${{ env.BUILD_TYPE }} --parallel 4
run: cmake --build ${{ env.BUILD_DIR }} --config ${{ env.BUILD_TYPE }} --parallel ${{ env.NUMBER_OF_CORES }}

- name: Test
working-directory: ${{ env.BUILD_DIR }}
Expand Down
Loading