diff options
| author | Markus Pettersson <markus.pettersson@mullvad.net> | 2025-08-28 10:25:29 +0200 |
|---|---|---|
| committer | Markus Pettersson <markus.pettersson@mullvad.net> | 2025-08-28 13:43:14 +0200 |
| commit | 1df9c815d8e3deea665de92a6e283e94d2319403 (patch) | |
| tree | d89dfb84e2abd76b4429faec60edef9dffc3beb5 | |
| parent | 6d09010a73efd48457091629537d47c92bef64c8 (diff) | |
| download | mullvadvpn-1df9c815d8e3deea665de92a6e283e94d2319403.tar.xz mullvadvpn-1df9c815d8e3deea665de92a6e283e94d2319403.zip | |
Allow caping concurrent processes when building Windows modules
| -rw-r--r-- | .github/workflows/daemon.yml | 14 | ||||
| -rwxr-xr-x | build-windows-modules.sh | 12 |
2 files changed, 23 insertions, 3 deletions
diff --git a/.github/workflows/daemon.yml b/.github/workflows/daemon.yml index b31502ad63..c2e7df53eb 100644 --- a/.github/workflows/daemon.yml +++ b/.github/workflows/daemon.yml @@ -192,11 +192,21 @@ jobs: with: go-version: 1.21.3 - - name: Build Windows modules - if: steps.cache-windows-modules.outputs.cache-hit != 'true' + - name: Build Windows modules (x86_64) + if: ${{ (steps.cache-windows-modules.outputs.cache-hit != 'true') && (matrix.config.arch == 'x64') }} shell: bash run: ./build-windows-modules.sh + - name: Build Windows modules (ARM64) + if: ${{ (steps.cache-windows-modules.outputs.cache-hit != 'true') && (matrix.config.arch == 'arm64') }} + shell: bash + # By default, ./build-windows-modules.sh will use 4 concurrent processes during compilation + # because the Windows 11 ARM runner has 4 cores: + # https://docs.github.com/en/actions/how-tos/write-workflows/choose-where-workflows-run/choose-the-runner-for-a-job#standard-github-hosted-runners-for-public-repositories + # + # Cap the number of concurrent processes to something less than 4 to avoid OOM issues. + run: ./build-windows-modules.sh --max-concurrent-processes 3 + - name: Build and test crates shell: bash env: diff --git a/build-windows-modules.sh b/build-windows-modules.sh index 32a1a98c05..4019b68a46 100755 --- a/build-windows-modules.sh +++ b/build-windows-modules.sh @@ -22,6 +22,10 @@ ACTION=build while [[ "$#" -gt 0 ]]; do case $1 in clean) ACTION="clean";; + --max-concurrent-processes) + MAX_CPUS="$2" + shift + ;; *) log_error "Unknown parameter: $1" exit 1 @@ -49,8 +53,14 @@ function build_solution_config { local config="$2" local platform="$3" + if [ -z ${MAX_CPUS+x} ]; then + MAX_CPU_COUNT_ARG="/m" + else + MAX_CPU_COUNT_ARG="/m:${MAX_CPUS}" + fi + set -x - cmd.exe "/c msbuild.exe /m $(to_win_path "$sln") /p:Configuration=$config /p:Platform=$platform" + cmd.exe "/c msbuild.exe $MAX_CPU_COUNT_ARG $(to_win_path "$sln") /p:Configuration=$config /p:Platform=$platform" set +x } |
