diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml index cc6bef20..86b34b56 100644 --- a/.github/workflows/build-macos.yml +++ b/.github/workflows/build-macos.yml @@ -6,7 +6,7 @@ on: jobs: macos-x64: - runs-on: macos-15-intel + runs-on: macos-26-intel strategy: fail-fast: false @@ -41,9 +41,22 @@ jobs: df -h echo "::endgroup::" + # install GNU make v4 to fix make -j N option https://github.com/nodejs/node/issues/53176#issuecomment-2134740862 + - name: Install build tools + run: brew install ninja make + + - name: Put new GNU Make binary first in PATH + run: echo "$(brew --prefix)/opt/make/libexec/gnubin" >> "$GITHUB_PATH" + + - name: Check make + run: | + which make + make --version + - run: yarn start --node-range node${{ matrix.target-node }} --arch x64 --output dist env: MAKE_JOB_COUNT: 4 # prevent to run out of memory + NODE_CONFIGURE_ARGS: --ninja # speed up compilation - name: Check if binary is compiled, skip if download only id: check_file @@ -58,7 +71,7 @@ jobs: path: dist/* macos-arm64: - runs-on: macos-14 # macos-14 is arm64: https://github.com/actions/runner-images#available-images + runs-on: macos-26 # is arm64: https://github.com/actions/runner-images#available-images strategy: fail-fast: false @@ -87,8 +100,17 @@ jobs: - run: yarn install --ignore-engines # add missing distutils package to python 3.12 + # install GNU make v4 to fix make -j N option https://github.com/nodejs/node/issues/53176#issuecomment-2134740862 - name: Install distutils - run: brew install python-setuptools + run: brew install python-setuptools ninja make + + - name: Put new GNU Make binary first in PATH + run: echo "$(brew --prefix)/opt/make/libexec/gnubin" >> "$GITHUB_PATH" + + - name: Check make + run: | + which make + make --version # Remove unneeded stuff to free up build space (from Node https://github.com/nodejs/build/issues/3878) - name: Cleanup before build @@ -102,6 +124,7 @@ jobs: - run: yarn start --node-range node${{ matrix.target-node }} --arch arm64 --output dist env: MAKE_JOB_COUNT: 2 # prevent to run out of memory + NODE_CONFIGURE_ARGS: --ninja # speed up compilation - name: Check if binary is compiled id: check_file diff --git a/lib/build.ts b/lib/build.ts index 4bc5110f..feb23c2a 100644 --- a/lib/build.ts +++ b/lib/build.ts @@ -288,6 +288,10 @@ async function compileOnUnix( args.push(...getConfigureArgs(getMajor(nodeVersion), targetPlatform, targetArch)); + // Accept extra configuration coming from github action like "--ninja" to speed up macos build + const extraConfigureArgs = (process.env.NODE_CONFIGURE_ARGS || '').split(/\s+/).filter(Boolean); + args.push(...extraConfigureArgs); + log.info("Running configure with: ", args.join(" ")); // TODO same for windows? await spawn('/bin/sh', ['./configure', ...args], {