-
Notifications
You must be signed in to change notification settings - Fork 282
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
65 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
name: PHPStan | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
phpVersions: | ||
required: false | ||
type: string | ||
default: '["7.2", "7.3", "7.4", "8.0", "8.1", "8.2", "8.3"]' | ||
description: 'PHP versions to test against, JSON encoded array of strings.' | ||
phpExtensions: | ||
required: false | ||
type: string | ||
description: 'PHP extensions to install, comma separated list of strings.' | ||
dependencies: | ||
required: true | ||
type: string | ||
description: 'Dependencies to install, JSON encoded map of path => repository url.' | ||
|
||
jobs: | ||
phpstan: | ||
name: Static analysis with phpstan and php ${{ matrix.php }} on ${{ matrix.os }} | ||
runs-on: ${{ matrix.os }} | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
php: ${{ fromJson(inputs.phpVersions) }} | ||
os: ['ubuntu-latest'] | ||
|
||
steps: | ||
- name: Checkout code base | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php }} | ||
extensions: ${{ inputs.phpExtensions }} | ||
|
||
- name: Setup dependencies | ||
run: | | ||
composer require -n --no-progress phpstan/phpstan | ||
sudo git clone --depth 1 -b snapshot/nightly https://github.com/Icinga/icinga-php-library.git /usr/share/icinga-php/ipl | ||
sudo git clone --depth 1 -b snapshot/nightly https://github.com/Icinga/icinga-php-thirdparty.git /usr/share/icinga-php/vendor | ||
paths=`echo '${{ inputs.dependencies }}' | jq -c -r keys[]` | ||
for path in $paths; do | ||
url=`echo '${{ inputs.dependencies }}' | jq -r --arg path $path '.[$path]'` | ||
sudo git clone --depth 1 $url $path | ||
done | ||
- name: PHPStan | ||
continue-on-error: true | ||
if: ${{ ! cancelled() }} | ||
run: ./vendor/bin/phpstan analyse |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters