Skip to content

Commit 0c7f30f

Browse files
committed
Add support for number of test workers
1 parent b198d03 commit 0c7f30f

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

Diff for: README.md

+1
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ Build a PHP extension for a specific version.
7979
- `run-tests` (optional) - Run the extension tests. Defaults to `true`.
8080
- `test-runner` (optional) - The test runner to use. Defaults to `run-tests.php`.
8181
- `test-opcache-mode` (optional) - Run tests with opcache `on`, `off` or `both`. Defaults to `off`.
82+
- `test-workers` (optional) - The number of workers to use when running tests. Defaults to `8`.
8283
- `auth-token` (optional) - Authentication token to use in case the extension is hosted on a private repository.
8384

8485
Instead of having to configure all the inputs for the extension action, you can use the `extension-matrix` action to get the matrix of jobs with different input configurations.

Diff for: extension/BuildPhpExtension/private/Invoke-Tests.ps1

+5-1
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,12 @@ Function Invoke-Tests {
4747
'--set-timeout 120',
4848
'-g FAIL,XFAIL,BORK,WARN,LEAK,SKIP'
4949
)
50+
$test_workers = 8
51+
if($null -ne $env:TEST_WORKERS -and $env:TEST_WORKERS -ne '') {
52+
$test_workers = $env:TEST_WORKERS
53+
}
5054
if($Config.php_version -ge '7.4') {
51-
$test_runner_args += '-j8'
55+
$test_runner_args += ('-j' + $test_workers)
5256
}
5357

5458
$opcacheModes = @($env:TEST_OPCACHE_MODE)

Diff for: extension/action.yml

+5
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ inputs:
4343
description: Test opcache mode
4444
required: false
4545
default: 'off'
46+
test-workers:
47+
description: Test workers
48+
required: false
49+
default: '8'
4650
build-directory:
4751
description: Directory to build the extension in
4852
required: false
@@ -64,6 +68,7 @@ runs:
6468
RUN_TESTS: ${{inputs.run-tests}}
6569
TEST_RUNNER: ${{inputs.test-runner}}
6670
TEST_OPCACHE_MODE: ${{inputs.test-opcache-mode}}
71+
TEST_WORKERS: ${{inputs.test-workers}}
6772
BUILD_DIRECTORY: ${{inputs.build-directory}}
6873
AUTH_TOKEN: ${{inputs.auth-token}}
6974
AUTO_DETECT_ARGS: ${{env.auto-detect-args}}

0 commit comments

Comments
 (0)