Skip to content

GitHub Actions: Use new PHP workflows #185

Merged
lippserd merged 6 commits intomainfrom
php-workflows
Dec 11, 2025
Merged

GitHub Actions: Use new PHP workflows #185
lippserd merged 6 commits intomainfrom
php-workflows

Conversation

@sukhwinder33445
Copy link
Copy Markdown
Contributor

@sukhwinder33445 sukhwinder33445 commented Dec 9, 2025

This PR switches to the new PHP workflow, which combines linting, static analysis, and unit testing. phpcs.xml and phpunit.xml have been removed, as the new workflow provides sane defaults for both and the files did not contain any special configurations anyway. Since the new workflow uses the latest PHPUnit version by default, deprecated PHPUnit features have been migrated. In addition, code style corrections were made to comply with the latest PSR coding standards. PHPStan scanDirectories was adjusted so that tests are always run with the dependencies installed by composer install.

  • After merging, @lippserd will update the branch protection required status checks to match the new workflow - below is a dry run showing what would happen.
./gh-update-branch-protection-checks/gh-update-branch-protection-checks.sh --repo Icinga/ipl-html --pr 185 --dry-run
[INFO] Fetching PR details...
[WARNING] PR #185 is not merged; continuing anyway...
[INFO] Target branch: main
[INFO] PR head branch: php-workflows
[INFO] PR head commit SHA: 1e030f76148178011c30aa16152671498e76a945
[INFO] Listing workflow runs triggered by commit 1e030f76148178011c30aa16152671498e76a945...
[INFO] Workflow runs: 20131545127
[INFO] Listing jobs for workflow 20131545127...
[INFO] Jobs: PHP / Static analysis (8.4) / PHPStan 8.4, PHP / Lint (8.2) / Linters 8.2, PHP / Static analysis (8.2) / PHPStan 8.2, PHP / Lint (8.4) / Linters 8.4, PHP / Lint (8.3) / Linters 8.3, PHP / Test (8.4) / PHPUnit 8.4, PHP / Test (8.3) / PHPUnit 8.3, PHP / Lint (8.5) / Linters 8.5, PHP / Static analysis (8.5) / PHPStan 8.5, PHP / Static analysis (8.3) / PHPStan 8.3, PHP / Test (8.2) / PHPUnit 8.2, PHP / Test (8.5) / PHPUnit 8.5
[INFO] Fetching current branch protection required status checks...
[INFO] Comparing branch protection required status checks...
--- /dev/fd/63	2025-12-11 13:09:19.205593449 +0100
+++ /dev/fd/62	2025-12-11 13:09:19.205942658 +0100
@@ -43,27 +43,51 @@
       },
       {
         "app_id": 15368,
-        "context": "Static analysis for php 8.2 on ubuntu-latest"
+        "context": "PHP / Lint (8.2) / Linters 8.2"
       },
       {
         "app_id": 15368,
-        "context": "Static analysis for php 8.3 on ubuntu-latest"
+        "context": "PHP / Lint (8.3) / Linters 8.3"
       },
       {
         "app_id": 15368,
-        "context": "Static analysis for php 8.4 on ubuntu-latest"
+        "context": "PHP / Lint (8.4) / Linters 8.4"
       },
       {
         "app_id": 15368,
-        "context": "Unit tests with php 8.2 on ubuntu-latest"
+        "context": "PHP / Lint (8.5) / Linters 8.5"
       },
       {
         "app_id": 15368,
-        "context": "Unit tests with php 8.3 on ubuntu-latest"
+        "context": "PHP / Static analysis (8.2) / PHPStan 8.2"
       },
       {
         "app_id": 15368,
-        "context": "Unit tests with php 8.4 on ubuntu-latest"
+        "context": "PHP / Static analysis (8.3) / PHPStan 8.3"
+      },
+      {
+        "app_id": 15368,
+        "context": "PHP / Static analysis (8.4) / PHPStan 8.4"
+      },
+      {
+        "app_id": 15368,
+        "context": "PHP / Static analysis (8.5) / PHPStan 8.5"
+      },
+      {
+        "app_id": 15368,
+        "context": "PHP / Test (8.2) / PHPUnit 8.2"
+      },
+      {
+        "app_id": 15368,
+        "context": "PHP / Test (8.3) / PHPUnit 8.3"
+      },
+      {
+        "app_id": 15368,
+        "context": "PHP / Test (8.4) / PHPUnit 8.4"
+      },
+      {
+        "app_id": 15368,
+        "context": "PHP / Test (8.5) / PHPUnit 8.5"
       }
     ],
     "contexts_url": "https://api.github.com/repos/Icinga/ipl-html/branches/main/protection/required_status_checks/contexts",
[SUCCESS] [dry-run] No changes applied.

@sukhwinder33445 sukhwinder33445 self-assigned this Dec 9, 2025
@cla-bot cla-bot Bot added the cla/signed label Dec 9, 2025
@sukhwinder33445 sukhwinder33445 marked this pull request as draft December 9, 2025 15:17
@sukhwinder33445 sukhwinder33445 marked this pull request as ready for review December 10, 2025 12:30
sukhwinder33445 and others added 2 commits December 11, 2025 11:29
`scanDirectories` was set to `/usr/share/icinga-php` to simplify local testing,
as both the Icinga PHP Library and Icinga PHP Thirdparty are installed there in
our development environment. Our individual PHP library components, which make
up these libraries, are self-contained, as they define all necessary
dependencies themselves. This then requires testing with exactly these
dependencies instead of an arbitrary folder that could contain anything, e.g.,
dependencies in unexpected versions or dependencies that have not yet been
defined. For remote and local testing, `composer install` must be executed and
tests must be performed with exactly the resulting dependencies. Since PHPStan
uses the Composer autoloader by default, if available, `scanDirectories` does
not need to be defined at all.
Else, each class must be in a file by itself to comply with coding standards.
In addition, tests are now isolated, as classes only exist within their test
methods, and the namespace is cleaner, as there is no longer any top-level
class pollution.
…xpects()`

- Not available with PHPUnit 12.5.2 (current version for tests on php8.3)
@lippserd lippserd merged commit 08b34b3 into main Dec 11, 2025
13 checks passed
@lippserd lippserd deleted the php-workflows branch December 11, 2025 12:10
@lippserd
Copy link
Copy Markdown
Member

I have updated the branch protection required status checks to match the new workflow.

@lippserd lippserd added this to the v0.10.0 milestone Mar 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants