Skip to content

Commit

Permalink
php: Split phpstan tests into a separate workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
sukhwinder33445 committed Apr 9, 2024
1 parent 5e0d57c commit 90e2be2
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 33 deletions.
15 changes: 3 additions & 12 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ jobs:
strategy:
fail-fast: false
matrix:
php: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2']
php: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3']
os: ['ubuntu-latest']

steps:
- name: Checkout code base
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand All @@ -31,12 +31,7 @@ jobs:
tools: phpcs

- name: Setup dependencies
run: |
composer require -n --no-progress overtrue/phplint
git clone --depth 1 https://github.com/Icinga/icingaweb2.git vendor/icingaweb2
git clone --depth 1 https://github.com/Icinga/icingadb-web.git vendor/icingadb-web
git clone --depth 1 -b snapshot/nightly https://github.com/Icinga/icinga-php-library.git vendor/icinga-php-library
git clone --depth 1 -b snapshot/nightly https://github.com/Icinga/icinga-php-thirdparty.git vendor/icinga-php-thirdparty
run: composer require -n --no-progress overtrue/phplint

- name: PHP Lint
if: ${{ ! cancelled() }}
Expand All @@ -45,7 +40,3 @@ jobs:
- name: PHP CodeSniffer
if: ${{ ! cancelled() }}
run: phpcs -wps --colors

- name: PHPStan
if: ${{ ! cancelled() }}
uses: php-actions/phpstan@v3
16 changes: 16 additions & 0 deletions .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: PHPStan

on:
pull_request:
branches:
- main

jobs:
phpstan:
uses: icinga/github-actions/.github/workflows/phpstan.yml@main
with:
dependencies: |
{
"/icingaweb2" : "https://github.com/Icinga/icingaweb2.git",
"/usr/share/icingaweb2-modules/icingadb" : "https://github.com/Icinga/icingadb-web.git"
}
25 changes: 5 additions & 20 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,6 @@ parameters:
count: 1
path: application/controllers/GraphController.php

-
message: "#^Parameter \\#2 \\$checkCommand of method Icinga\\\\Module\\\\Graphite\\\\Controllers\\\\GraphController\\:\\:supplyImage\\(\\) expects string, mixed given\\.$#"
count: 2
path: application/controllers/GraphController.php

-
message: "#^Parameter \\#2 \\$value of static method ipl\\\\Stdlib\\\\Filter\\:\\:equal\\(\\) expects array\\|bool\\|float\\|int\\|string, mixed given\\.$#"
count: 3
Expand Down Expand Up @@ -385,6 +380,11 @@ parameters:
count: 1
path: library/Graphite/Graphing/MetricsQuery.php

-
message: "#^Parameter \\#2 \\$object of method Icinga\\\\Module\\\\Graphite\\\\Util\\\\IcingadbUtils\\:\\:resolveMacro\\(\\) expects Icinga\\\\Module\\\\Icingadb\\\\Compat\\\\CompatHost\\|Icinga\\\\Module\\\\Icingadb\\\\Compat\\\\CompatService\\|Icinga\\\\Module\\\\Icingadb\\\\Model\\\\Host\\|Icinga\\\\Module\\\\Icingadb\\\\Model\\\\Service, ipl\\\\Orm\\\\Model given\\.$#"
count: 1
path: library/Graphite/Graphing/MetricsQuery.php

-
message: "#^Call to an undefined method Icinga\\\\Data\\\\Fetchable\\:\\:where\\(\\)\\.$#"
count: 1
Expand Down Expand Up @@ -705,21 +705,11 @@ parameters:
count: 1
path: library/Graphite/Web/Widget/Graphs/Icingadb/IcingadbHost.php

-
message: "#^Method Icinga\\\\Module\\\\Graphite\\\\Web\\\\Widget\\\\Graphs\\\\Icingadb\\\\IcingadbHost\\:\\:getMonitoredObjectIdentifier\\(\\) should return string but returns mixed\\.$#"
count: 1
path: library/Graphite/Web/Widget/Graphs/Icingadb/IcingadbHost.php

-
message: "#^Method Icinga\\\\Module\\\\Graphite\\\\Web\\\\Widget\\\\Graphs\\\\Icingadb\\\\IcingadbHost\\:\\:getObjectType\\(\\) has no return type specified\\.$#"
count: 1
path: library/Graphite/Web/Widget/Graphs/Icingadb/IcingadbHost.php

-
message: "#^Parameter \\#2 \\$value of method Icinga\\\\Web\\\\Url\\:\\:setParam\\(\\) expects array\\|bool\\|string, mixed given\\.$#"
count: 1
path: library/Graphite/Web/Widget/Graphs/Icingadb/IcingadbHost.php

-
message: "#^Cannot access property \\$name on mixed\\.$#"
count: 4
Expand All @@ -745,11 +735,6 @@ parameters:
count: 1
path: library/Graphite/Web/Widget/Graphs/Icingadb/IcingadbService.php

-
message: "#^Parameter \\#2 \\$value of method Icinga\\\\Web\\\\Url\\:\\:setParam\\(\\) expects array\\|bool\\|string, mixed given\\.$#"
count: 1
path: library/Graphite/Web/Widget/Graphs/Icingadb/IcingadbService.php

-
message: "#^Call to an undefined method Icinga\\\\Module\\\\Graphite\\\\Web\\\\Widget\\\\Graphs\\\\Icingadb\\\\IcingadbHost\\|Icinga\\\\Module\\\\Graphite\\\\Web\\\\Widget\\\\Graphs\\\\Icingadb\\\\IcingadbService\\:\\:createServiceTitle\\(\\)\\.$#"
count: 1
Expand Down
4 changes: 3 additions & 1 deletion phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ parameters:
- library

scanDirectories:
- vendor
- /icingaweb2
- /usr/share/icinga-php
- /usr/share/icingaweb2-modules

ignoreErrors:
-
Expand Down

0 comments on commit 90e2be2

Please sign in to comment.