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

feat: Set parallelization level #130

Closed
wants to merge 1 commit into from
Closed
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
8 changes: 8 additions & 0 deletions src/cmake-action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import * as runcmakelib from '@lukka/run-cmake-lib'
import * as cmakeglobals from '@lukka/run-cmake-lib/build/cmake-globals'
import * as vcpkgglobals from '@lukka/run-cmake-lib/build/vcpkg-globals'
import * as core from '@actions/core'
import * as process from "process"
import * as os from "os"

export async function main(): Promise<void> {
const actionLib: libaction.ActionLib = new libaction.ActionLib();
Expand All @@ -26,6 +28,12 @@ export async function main(): Promise<void> {
const testPresetAdditionalArgs = actionLib.getInput(cmakeglobals.testPresetAdditionalArgs, false);
const packagePresetAdditionalArgs = actionLib.getInput(cmakeglobals.packagePresetAdditionalArgs, false);
const runVcpkgEnvFormatString = actionLib.getInput(vcpkgglobals.runVcpkgEnvFormatStringInput, false);

// Set parallelization level
const nproc = os.availableParallelism();
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From what I've read os.availableParallelism should take into account the virtualization and get the actual available processors, i.e. nproc vs nproc --all

process.env["CMAKE_BUILD_PARALLEL_LEVEL"] = `${nproc}`;
process.env["CTEST_PARALLEL_LEVEL"] = `${nproc}`;

await runcmakelib.CMakeRunner.run(
actionLib,
workflowPreset, workflowPresetCmdStringFormat,
Expand Down