diff options
| -rw-r--r-- | .github/workflows/daemon.yml | 14 | ||||
| -rwxr-xr-x | build-windows-modules.sh | 19 |
2 files changed, 30 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..c66556bc67 100755 --- a/build-windows-modules.sh +++ b/build-windows-modules.sh @@ -2,6 +2,12 @@ set -eu +function usage { + echo "usage: $0 [clean] [--max-concurrent-processes <n>]" + echo " --max-concurrent-processes <n> Limit concurrent processes that msbuild can spawn to <n>. Defaults to number of processor cores." + exit 1 +} + SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" cd "$SCRIPT_DIR" @@ -22,6 +28,11 @@ ACTION=build while [[ "$#" -gt 0 ]]; do case $1 in clean) ACTION="clean";; + --max-concurrent-processes) + MAX_CPUS="$2" + shift + ;; + help | --help) usage;; *) log_error "Unknown parameter: $1" exit 1 @@ -49,8 +60,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 } |
