Skip to content

[TASK] Check the ci/ PHP code with GrumPHP and add PHPUnit tests - #602

Merged
Kanti merged 3 commits into
webdevops:masterfrom
andersundsehr:chore/ci-quality-checks
Nov 9, 2026
Merged

Kanti merged 3 commits into
webdevops:masterfrom
andersundsehr:chore/ci-quality-checks

Conversation

@Kanti

@Kanti Kanti commented Nov 9, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds the checks of pluswerk/grumphp-config and PHPUnit tests to ci/, before the generators move to PHP. The generated files do not change; build.yaml only gets the new job and --no-dev.

Changes

  • GrumPHP in ci/: composer validate and normalize, PSR-12, PHPStan level 8, Rector, Fractor, composer audit, PHPUnit. GrumPHP's own Composer plugin is off, so it installs no Git hooks.
  • ci/src: fixes for PHPStan and Rector, #[AsCommand] instead of the deprecated $defaultName, the repository root as constructor argument for the tests, Dockerfile paths relative to the root.
  • bluem/tree 4.0 (3.2 triggers a deprecation on PHP 8.4), symfony/yaml 6.4.50 (security advisory).
  • Behaviour change: --blacklist entries also match at the start of the image name; empty entries match nothing.
  • 190 PHPUnit tests cover every class in ci/src, using a small fixture repository and fonts the tests write themselves.
  • CI: the new job "Check ci/" runs GrumPHP; no image build waits for it. "Validate Automation" installs with --no-dev.
  • Docs: README ("Building in CI") and AGENTS.md.

How it was verified

  • vendor/bin/grumphp run: all tasks pass, PHPUnit without deprecations.
  • github:generate-ci, readme-banner:generate and readme-banner:build-glyphs produce the same files as master, apart from the new job and --no-dev.
  • Seven deliberate bugs each make the tests fail.
  • Both CI jobs in a fresh clone owned by another user: exit code 0, no diff.
  • The commands in README and AGENTS.md are the ones run above.

Kanti added 2 commits November 9, 2026 13:20
ci/ now uses pluswerk/grumphp-config: composer validate and normalize,
PSR-12, PHPStan level 8, Rector, composer audit and PHPUnit, run by
`vendor/bin/grumphp run`. The new CI job "Check ci/" runs it; no image
build waits for it.

The code is changed only as far as the checks require, and the generated
files stay byte-identical: .github/workflows/build.yaml (apart from the
new job), docs/assets/readme-banner-*.svg and glyphs.json.

- Types for PHPStan level 8, Rector's PHP 8.4 and code quality rules
- FileReader, GithubJobBuilder and the commands take the repository root,
  so the tests can run them against tests/Fixtures/repository
- FileReader::collectDockerfiles() returns a sorted list of paths
- bluem/tree 4.0: Node keeps the case of property keys, so the workaround
  for imageParent/imageparent is gone, and so is the PHP 8.4 deprecation
- --blacklist entries match at the start of the image name too
- symfony/yaml 6.4.50 for a security advisory

184 PHPUnit tests cover every class in ci/src. TrueTypeFont and
GposKerning are tested with small fonts the tests write themselves.
- Empty and blank --blacklist entries, and -b without a value, match no
  image any more; str_contains() matched every image with them, and a
  missing value ended in a TypeError. Blank lines in ci/BLACKLIST are
  skipped the same way.
- The commands get their names from #[AsCommand] instead of the static
  $defaultName that symfony/console deprecated in 6.1.
- FileReader returns the Dockerfiles relative to the repository root, so
  the build context no longer depends on both classes getting the same
  root path string. GithubCommand takes autoLatestTag from FileReader
  instead of parsing conf/console.yml a second time.
- "Validate Automation" installs the generators with --no-dev.
- The test repository has docker/php/8.4 as a symbolic link, like
  docker/php/<version>, and the tests check it is not built twice.
- Tests no longer pick a step by its index or compare two realpath()
  results that can both be false; AGENTS.md says that GrumPHP, not only
  PHPStan and Rector, checks files Git knows only.
- Entries of --blacklist and ci/BLACKLIST lose surrounding whitespace;
  an entry such as "php-nginx " matched no image, so the image was built
  anyway.
- "docker: autoLatestTag" in conf/console.yml has to be a quoted tag. An
  unquoted 22.10 is a number in YAML and ended in a TypeError; a missing
  or empty value now stops with a message, too.
@sonarqubecloud

sonarqubecloud Bot commented Nov 9, 2026

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
C Reliability Rating on New Code (required ≥ A)
B Security Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@Kanti
Kanti marked this pull request as ready for review November 9, 2026 14:58
@Kanti
Kanti merged commit 0d4645d into webdevops:master Nov 9, 2026
177 of 178 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants