Split the CI workflow into static analysis and tests

Offen Anfängerfreundlich
#696 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Anfängerfreundlichkeit
72/100
Issue-Typ
Refactoring
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
github-actions, php, yaml
Bereich
ci-cd

Rechercherichtung

Lies .github/workflows/php.yml von Anfang bis Ende und notiere die Matrix, die Memcached/Redis-Service-Blöcke, den Cache-Schritt sowie die Reihenfolge der Schritte PHP-CS-Fixer, PHPStan, Rector, Tests und Coverage. Teile den einzelnen Job auf in einen Job static-analysis (PHP 8.2, ohne Services, composer validate --strict plus die drei Tools) und einen Job tests, der die Matrix 8.2/8.3/8.4, die Services, die Tests und den auf 8.2 beschränkten Coverage-Upload beibehält. Schlüssele außerdem den Composer-Cache pro PHP-Version auf composer.json und stelle actions/checkout und actions/cache auf ihre Node.js-24-Versionen um; Trigger und Testflags bleiben unverändert. Fertig ist, wenn beide Jobs in einem Pull Request erscheinen und bestehen, die statische Analyse genau einmal läuft und der Coverage-Upload genau einmal erfolgt.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

tech debt testing

Summary

.github/workflows/php.yml runs one job for each PHP version (8.2, 8.3 and 8.4), and each job runs everything in a row: it starts Memcached and Redis, installs the dependencies, runs PHP-CS-Fixer, PHPStan and Rector, runs the tests and uploads the coverage. Split it into a static analysis job that runs once and a test job that runs for each PHP version.

Problems

  • Static analysis runs three times with the same result. PHP-CS-Fixer, PHPStan and Rector check the source, not the runtime: PHPStan analyses it as PHP 8.2 (phpVersion: 80200) and Rector uses the PHP 8.2 level set, whatever PHP runs them. PHPStan is the slowest of them.
  • A style or analysis failure hides the test result. The steps run in order, so a PHP-CS-Fixer finding stops the job before the tests run.
  • The coverage is uploaded three times, once per PHP version.
  • The static checks start Memcached and Redis, which they do not use.
  • The Composer cache is keyed on composer.lock, which the repository does not track, so all PHP versions share one cache key.
  • actions/checkout@v4 and actions/cache@v4 run on Node.js 20, which GitHub is retiring on its runners.

Change

Two jobs in php.yml, which run in parallel:

  1. static-analysis: once, on PHP 8.2, without services: composer validate --strict, PHP-CS-Fixer, PHPStan, Rector.
  2. tests: the matrix PHP 8.2, 8.3 and 8.4 with Memcached and Redis: the tests, and the coverage upload from PHP 8.2 only.

Also: a Composer cache key per PHP version based on composer.json, and the Node.js 24 versions of actions/checkout and actions/cache.

The triggers (push to master and *.x, every pull_request) and the test flags (--fail-on-warning --fail-on-risky) stay as they are. Branch protection requires only the Scrutinizer check, so the new job names need no change there.

The change applies from 3.3.0 on, on master; the release lines keep their current workflow.

Out of scope

  • Other PHP versions or operating systems in the matrix.
Vorherrschende Sprache
PHP
Sterne
44
Forks
22
Ø Merge
2 Std. 57 Min.
Gemergte PRs (30 T.)
52

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus quantum-php/framework

Alle Issues in quantum-php/framework

Ähnliche Issues

Weitere Issues zu PHP

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.