Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
nilmerg committed Apr 5, 2024
1 parent 8de7d20 commit 3a97aee
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 32 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/phpstan-reusable.yml
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
42 changes: 10 additions & 32 deletions .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,35 +6,13 @@ on:
- main

jobs:
lint:
name: Static analysis with phpstan and php ${{ matrix.php }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
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@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: ldap

- 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
sudo git clone --depth 1 https://github.com/Icinga/icingaweb2-module-x509.git /usr/share/icingaweb2-modules/x509
sudo git clone --depth 1 https://github.com/Icinga/icingadb-web.git /usr/share/icingaweb2-modules/icingadb
sudo git clone --depth 1 https://github.com/Icinga/icingaweb2-module-pdfexport.git /usr/share/icingaweb2-modules/pdfexport
- name: PHPStan
if: ${{ ! cancelled() }}
run: ./vendor/bin/phpstan analyse
phpstan:
uses: ./.github/workflows/phpstan-reusable.yml
with:
phpExtensions: ldap
dependencies: |
{
"/usr/share/icingaweb2-modules/x509" : "https://github.com/Icinga/icingaweb2-module-x509.git",
"/usr/share/icingaweb2-modules/icingadb" : "https://github.com/Icinga/icingadb-web.git",
"/usr/share/icingaweb2-modules/pdfexport" : "https://github.com/Icinga/icingaweb2-module-pdfexport.git"
}

0 comments on commit 3a97aee

Please sign in to comment.