Skip to content

Commit 1e736df

Browse files
committed
Stop grouping the unit legs by PHP version
Verified against wp-cli/wp-cli-tests#352. Grouping Behat by PHP version works — two to eight legs per group — but the unit matrix has exactly one leg per PHP version, so the same treatment produced nine groups containing one job each. Give the unit fan-out a single "Unit" group and let the PHP version distinguish the legs inside it. The grouped form of the unit name therefore keeps the version, rather than collapsing to a bare constant the way the Behat one does; the version is the only thing that tells those legs apart. Behat is unchanged. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Jy4dmjymj9VmoTBaqrV4iX
1 parent df0b144 commit 1e736df

3 files changed

Lines changed: 29 additions & 9 deletions

File tree

‎.github/workflows/reusable-unit.yml‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,13 @@ jobs:
2727
unit:
2828
# See the note on the equivalent name in reusable-functional.yml: `grouped`
2929
# picks between a name that stands on its own and one that sits inside a group
30-
# header which already states the suite and PHP version.
31-
name: ${{ !inputs.grouped && format('Unit | PHP {0}', inputs.php) || 'PHPUnit' }}${{ inputs.coverage && ' (with coverage)' || '' }}${{ startsWith( inputs.os, 'windows' ) && ' (Windows)' || '' }}${{ startsWith( inputs.os, 'macos' ) && ' (macOS)' || '' }}
30+
# header which already states the suite.
31+
#
32+
# Unlike Behat, the grouped form keeps the PHP version. There is only ever one
33+
# unit leg per PHP version, so grouping by version would produce a column of
34+
# single-job groups; a fanned-out caller should use a single "Unit" group and
35+
# let the version distinguish the legs inside it.
36+
name: ${{ !inputs.grouped && format('Unit | PHP {0}', inputs.php) || format('PHP {0}', inputs.php) }}${{ inputs.coverage && ' (with coverage)' || '' }}${{ startsWith( inputs.os, 'windows' ) && ' (Windows)' || '' }}${{ startsWith( inputs.os, 'macos' ) && ' (macOS)' || '' }}
3237
# Repositories can point the default Linux legs at a larger runner by setting
3338
# the `RUNNERS_NAME` repository variable, without having to fork this workflow.
3439
# Explicit macOS/Windows legs are unaffected.

‎.github/workflows/testing.yml‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,11 @@ jobs:
3535
# A matrix only becomes a collapsible group in the run view when it sits on a
3636
# job declared in the workflow the run belongs to, which is why this fan-out
3737
# is here and not one level down.
38-
name: Unit | PHP ${{ matrix.php }}
38+
#
39+
# Deliberately not "Unit | PHP ${{ matrix.php }}": there is only one unit leg
40+
# per PHP version, so that would produce nine groups of one job each. A single
41+
# group with the version on each leg reads better.
42+
name: Unit
3943
strategy:
4044
fail-fast: false
4145
matrix: ${{ fromJson(needs.prepare.outputs.unit) }}

‎README.md‎

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,19 +49,30 @@ wrapped shape unless a package has a large enough matrix that the flat list is
4949
genuinely hard to read.
5050

5151
A fanned-out caller should pass `grouped: true` to `reusable-unit.yml` and
52-
`reusable-functional.yml`. Their job names then leave out the suite and PHP
53-
version, because the group header already states both:
52+
`reusable-functional.yml`, so their job names leave out what the group header
53+
already states. Without it the legs read `Behat | PHP 8.5 | WP latest | SQLite`
54+
inside a group already called `Behat | PHP 8.5`.
55+
56+
Group Behat by PHP version, which gives two to eight legs per group:
5457

5558
```
5659
Behat | PHP 8.5 <- the calling job
5760
WP latest | mysql-8.0 <- the called workflow, with grouped: true
5861
WP trunk | SQLite
5962
```
6063

61-
Without it the legs read `Behat | PHP 8.5 | WP latest | mysql-8.0` inside a group
62-
already called `Behat | PHP 8.5`. Wrapped callers must leave it at its default of
63-
`false`, because there is no group header for them and the name has to stand on
64-
its own.
64+
Do not group unit tests the same way. There is only ever one unit leg per PHP
65+
version, so `Unit | PHP ${{ matrix.php }}` produces a column of single-job
66+
groups. Use one `Unit` group and let the version distinguish the legs:
67+
68+
```
69+
Unit <- the calling job
70+
PHP 7.2 <- the called workflow, with grouped: true
71+
PHP 8.5 (with coverage)
72+
```
73+
74+
Wrapped callers must leave `grouped` at its default of `false`, because there is
75+
no group header for them and the name has to stand on its own.
6576

6677
The one thing to watch is that with `grouped: true` a leg name is only unique
6778
within its group — `WP latest | SQLite` occurs under every PHP version. That is

0 commit comments

Comments
 (0)