Skip to content

[CI] Unify unit test parallelism across Linux and Windows - #3800

Merged
Kocal merged 1 commit into
symfony:3.xfrom
Kocal:ci-parallelize-tests
Aug 22, 2026
Merged

[CI] Unify unit test parallelism across Linux and Windows#3800
Kocal merged 1 commit into
symfony:3.xfrom
Kocal:ci-parallelize-tests

Conversation

@Kocal

@Kocal Kocal commented Aug 21, 2026

Copy link
Copy Markdown
Member
Q A
Bug fix? no
New feature? no
Deprecations? no
Documentation? no
Issues Fix #...
License MIT

Alternative to #2997

The "Unit Tests" workflow ran packages differently depending on the
OS: Linux used GNU parallel, Windows fell back to a sequential
loop because parallel isn't available there. That made the two
Windows jobs by far the slowest in the matrix (~326s and ~305s,
versus ~85-107s on Linux for the same suites).

Replace both code paths with a single portable Bash function,
_run_package_tests, that caps concurrency using only Bash job
control (background jobs, wait -n, jobs -rp). It behaves the
same on Linux and on Windows (Git Bash), needs no external tool,
and reuses the existing _run_task_sequential helper. This
supersedes the rust-parallel attempt from #2997, which had to be
abandoned because rust-parallel could not be forced to use bash on
Windows.

By comparing https://github.com/symfony/ux/actions/runs/32469165022?pr=3799 and https://github.com/symfony/ux/actions/runs/32528673415?pr=3800, tests are going from ~4m30s to ~1m30s-2m30s 🚀

@Kocal Kocal self-assigned this Aug 21, 2026
@carsonbot carsonbot added the Status: Needs Review Needs to be reviewed label Aug 21, 2026
The "Unit Tests" workflow ran packages differently depending on the
OS: Linux used GNU `parallel`, Windows fell back to a sequential
loop because `parallel` isn't available there. That made the two
Windows jobs by far the slowest in the matrix (~326s and ~305s,
versus ~85-107s on Linux for the same suites).

Replace both code paths with a single portable Bash function,
`_run_package_tests`, that caps concurrency using only Bash job
control (background jobs, `wait -n`, `jobs -rp`). It behaves the
same on Linux and on Windows (Git Bash), needs no external tool,
and reuses the existing `_run_task_sequential` helper. This
supersedes the rust-parallel attempt from symfony#2997, which had to be
abandoned because rust-parallel could not be forced to use bash on
Windows.

Claude-Session: https://claude.ai/code/session_01HrLP3NMLNUXLTcHjVXG8uo
@Kocal
Kocal force-pushed the ci-parallelize-tests branch from c9fbf97 to 598bd0e Compare August 21, 2026 21:28
@Kocal
Kocal merged commit 9f6fd1b into symfony:3.x Aug 22, 2026
34 checks passed
@Kocal
Kocal deleted the ci-parallelize-tests branch August 22, 2026 06:17
Kocal added a commit that referenced this pull request Aug 24, 2026
The parallel pool added in #3800 (_run_package_tests in
.github/workflows/.utils.sh) wasn't errexit-safe, and the
Unit Tests step runs under `bash -e -o pipefail`. When a
package's suite failed, its background subshell could
abort under errexit before its exit code was written to
the .rc file, and the throttle's `wait -n` could then
abort the whole step under errexit before the replay loop
printed any per-package logs. The result was a bare
"Process completed with exit code 2" with no per-package
output, so there was no way to tell which package failed.
It was intermittent: it only happened when the failing job
got reaped by `wait -n` in the throttle instead of the
final `wait`.

Fix _run_package_tests to be errexit-safe: capture the
task's exit code with `|| code=$?` so the subshell isn't
aborted before recording it, and guard the throttle's
`wait -n` with `|| :` so a failed job doesn't abort the
step early. A failing package now yields a clean step
exit code of 1 with the full grouped logs, including the
KO block naming the package that failed.

Claude-Session: https://claude.ai/code/session_01HrLP3NMLNUXLTcHjVXG8uo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants