Issue #3614091: Add GitLab CI to 3.0.x
Adds GitLab CI to 3.0.x. The branch has never had a pipeline (MR !14 (merged) got zero); only the dead legacy drupalci.yml was present.
Changes
- Add
.gitlab-ci.yml(Drupal Association templates). - Add
.cspell.json(ported from 4.0.x, minus the Playwright-only ignore paths). Without it the templates fall back to their generic default dictionary; with it thecspelljob is green. - Delete
drupalci.ymlanddrupalci.yml_.txt— DrupalCI has been retired. - Test fixes needed to make the pipeline actually meaningful (see below).
Configuration
The branch declares core_version_requirement: ^10 || ^11, so it takes the template defaults for core and PHP — no DRUPAL_CORE / _TARGET_PHP overrides (unlike 4.0.x, which has to force Drupal 12). Additionally:
SKIP_NIGHTWATCH: '1'— no JS tests on this branch._PHPUNIT_TESTGROUPS: '--all'— see below.OPT_IN_TEST_PREVIOUS_MAJOR: '1'+_AUTORUN_PREVIOUS_MAJOR: 'all'— the branch claims^10, so Drupal 10 is genuinely exercised. Both variables are required: the opt-in alone leaves the D10 jobs as manual, which would have looked like coverage without providing any.
The --group trap (important)
The obvious setting, _PHPUNIT_TESTGROUPS: 'layout_builder_kit', produced a green pipeline that ran only 2 of the 12 tests.
PHPUnit 10+ ignores doc-comment metadata on any class that carries at least one PHP attribute. Both Kernel classes carry #[RunTestsInSeparateProcesses], so under Drupal 11 / PHPUnit 11 their @group layout_builder_kit annotation was invisible and --group layout_builder_kit collected only the 2 Functional tests. Under Drupal 10 / PHPUnit 9 (no attribute support at all) the same config collected all 12 — so the discrepancy was only visible by reading the traces.
Two independent fixes:
_PHPUNIT_TESTGROUPS: '--all', the template's special value meaning "add no--groupfilter". The phpunit invocation is already scoped to the module directory, so this runs exactly this module's tests.#[Group('layout_builder_kit')]added to both Kernel classes, so a--grouprun works too. Harmless under PHPUnit 9, which never resolves attributes; the existing@groupdocblocks are kept for it.
$adminUser dynamic property
LayoutBuilderKitUITest assigned $this->adminUser without declaring it. On PHP 8.2+ that emits a deprecation notice, which Drupal's PHPUnit configuration turns into a risky test, which fails the run — so the Drupal 11 job could never be green. The property is now declared. (Drupal 10's job runs on PHP 8.1 and never saw this.)
Verified from the job traces, not from the aggregate status
composer |
composer (previous major) |
|
|---|---|---|
| core | Locking drupal/core (11.4.4) |
Locking drupal/core (10.6.13) |
| PHP | 8.3.33 | 8.1.34 |
| hook_event_dispatcher | Locking drupal/hook_event_dispatcher (4.2.0) |
same |
phpunit |
phpunit (previous major) |
|
|---|---|---|
| PHPUnit | 11.5.56 | 9.6.35 |
| result | Tests: 12, Assertions: 37 |
OK (12 tests, 39 assertions) |
Both test jobs pass and both genuinely execute all 12 tests. composer, composer (previous major), composer-lint, cspell, phpunit and phpunit (previous major) are green.
Pre-existing lint debt (all allow_failure: true, non-blocking)
These are pre-existing and out of scope for this issue; they are visible now only because the branch has a pipeline for the first time. They do not block the merge.
phpcs— 124 errors, 60 warnings in 31 files (184 sniff violations in 40 sources)phpstan(D11) — 20 errors;phpstan (previous major)(D10) — 18 errorsstylelint— 80 errors (68 auto-fixable with--fix)eslint— 2 errors, bothno-jquery/no-val
Recommendation: leave them advisory for now and address them in separate follow-up issues — eslint (2) and stylelint (68 of 80 auto-fixable) are cheap wins; phpcs and phpstan are better handled with a baseline or a dedicated cleanup issue. Only once each is clean should its _*_ALLOW_FAILURE be flipped to 0.
Note
Merges on this project fast-forward, so Closes #3614091 will not auto-fire — the issue must be closed manually.