Skip to content

Conversation

@sukhwinder33445
Copy link
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.

require: Icinga/ipl-sql#98 (for unit tests)

  • 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-orm --pr 156 --dry-run
[INFO] Fetching PR details...
[WARNING] PR #156 is not merged; continuing anyway...
[INFO] Target branch: main
[INFO] PR head branch: php-workflows
[INFO] PR head commit SHA: 2c1a756b769a9f10e6b3f5d82764bfdc0e248d33
[INFO] Listing workflow runs triggered by commit 2c1a756b769a9f10e6b3f5d82764bfdc0e248d33...
[INFO] Workflow runs: 20133371538
[INFO] Listing jobs for workflow 20133371538...
[INFO] Jobs: PHP / Static analysis (8.2) / PHPStan 8.2, PHP / Static analysis (8.3) / PHPStan 8.3, PHP / Static analysis (8.5) / PHPStan 8.5, PHP / Lint (8.3) / Linters 8.3, PHP / Lint (8.4) / Linters 8.4, PHP / Static analysis (8.4) / PHPStan 8.4, PHP / Test (8.2) / PHPUnit 8.2, PHP / Lint (8.5) / Linters 8.5, PHP / Test (8.4) / PHPUnit 8.4, PHP / Test (8.5) / PHPUnit 8.5, PHP / Test (8.3) / PHPUnit 8.3, PHP / Lint (8.2) / Linters 8.2
[INFO] Fetching current branch protection required status checks...
[INFO] Comparing branch protection required status checks...
--- /dev/fd/63	2025-12-11 16:36:05.365134771 +0100
+++ /dev/fd/62	2025-12-11 16:36:05.365445810 +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-orm/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:12
@sukhwinder33445 sukhwinder33445 marked this pull request as ready for review December 10, 2025 12:19
Use defaults from new workflow.
`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.
Fix code sniffer warning: Visibility must be declared on all constants if your project supports PHP 7.1 or later
@lippserd lippserd merged commit 7e5c01a into main Dec 11, 2025
13 checks passed
@lippserd lippserd deleted the php-workflows branch December 11, 2025 15:37
@lippserd
Copy link
Member

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

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.

3 participants