From 65e09bd852103617778b125ad4267c716111b032 Mon Sep 17 00:00:00 2001 From: hotrush Date: Mon, 13 Apr 2026 15:42:01 +0200 Subject: [PATCH 1/2] Optimize build process by enabling parallel execution in make commands --- src/index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/index.js b/src/index.js index 58e4db5..19f23c2 100644 --- a/src/index.js +++ b/src/index.js @@ -3,6 +3,7 @@ const exec = require("@actions/exec"); const github = require("@actions/github"); const fs = require("fs"); const path = require("path"); +const os = require("os"); /** * Get the docker-image input. When set, build and PHP detection @@ -149,13 +150,13 @@ async function buildExtension() { "-w", workDir, dockerImage, "sh", "-c", - `apk add --no-cache ${allPackages} && phpize && ${configureCmd} && make`, + `apk add --no-cache ${allPackages} && phpize && ${configureCmd} && make -j$(nproc)`, ]); } else { const opts = buildPath !== "." ? { cwd: buildPath } : {}; await exec.exec("phpize", [], opts); await exec.exec("./configure", configureFlags, opts); - await exec.exec("make", [], opts); + await exec.exec("make", [`-j${os.cpus().length}`], opts); } } From a6238a7226b19a966e615cc46abd899cc31c1143 Mon Sep 17 00:00:00 2001 From: hotrush Date: Mon, 13 Apr 2026 15:45:09 +0200 Subject: [PATCH 2/2] Optimize build process by enabling parallel execution in make commands --- tests/index.test.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/index.test.js b/tests/index.test.js index 6abb35f..f482254 100644 --- a/tests/index.test.js +++ b/tests/index.test.js @@ -377,7 +377,7 @@ describe('buildExtension', () => { expect(exec.exec).toHaveBeenCalledWith('phpize', [], {}); expect(exec.exec).toHaveBeenCalledWith('./configure', ['--enable-test', '--with-foo=/foo/bar'], {}); - expect(exec.exec).toHaveBeenCalledWith('make', [], {}); + expect(exec.exec).toHaveBeenCalledWith('make', [expect.stringMatching(/^-j\d+$/)], {}); }); test('builds the extension with custom build path', async () => { @@ -391,7 +391,7 @@ describe('buildExtension', () => { expect(exec.exec).toHaveBeenCalledWith('phpize', [], { cwd: 'some/ext/path' }); expect(exec.exec).toHaveBeenCalledWith('./configure', ['--enable-test'], { cwd: 'some/ext/path' }); - expect(exec.exec).toHaveBeenCalledWith('make', [], { cwd: 'some/ext/path' }); + expect(exec.exec).toHaveBeenCalledWith('make', [expect.stringMatching(/^-j\d+$/)], { cwd: 'some/ext/path' }); }); test('builds with quoted configure flags', async () => {